diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-10-22 21:00:24 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-10-22 21:00:24 +0800 |
commit | 863f1fc0350fff0d7b7e2a376d82ccaaf301f4ce (patch) | |
tree | e5da7c758612ccf574f0dfc563690306550a1d36 /server-beta/src/files.lua | |
parent | 1f0a645cddeae4caba21c655651d97b5313d2302 (diff) | |
download | lua-language-server-863f1fc0350fff0d7b7e2a376d82ccaaf301f4ce.zip |
整理代码
Diffstat (limited to 'server-beta/src/files.lua')
-rw-r--r-- | server-beta/src/files.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/server-beta/src/files.lua b/server-beta/src/files.lua index 1873637d..67a13aa8 100644 --- a/server-beta/src/files.lua +++ b/server-beta/src/files.lua @@ -131,12 +131,31 @@ function m.getLines(uri) uri = uri:lower() end local file = m.fileMap[uri] + if not file then + return nil + end if not file.lines then file.lines = parser:lines(file.text) end return file.lines end +--- 获取搜索器 +function m.getSearcher(uri) + if platform.OS == 'Windows' then + uri = uri:lower() + end + local file = m.fileMap[uri] + if not file then + return nil + end + if not file.searcher then + local seacher = require 'seacher' + file.searcher = seacher.create(uri) + end + return file.searcher +end + --- 判断文件名相等 function m.eq(a, b) if platform.OS == 'Windows' then |