diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-22 17:01:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-22 17:01:01 +0800 |
commit | f6cf28b71d81785a29a163a82427a9276744793e (patch) | |
tree | c23170a8ded44ff30a8d2f9af06e67dd6c963520 /server/src | |
parent | 382a83df0058bd6243a06f1129399060c9cb9303 (diff) | |
download | lua-language-server-f6cf28b71d81785a29a163a82427a9276744793e.zip |
忽略目录也交给后端处理
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/async/scanfiles.lua | 9 | ||||
-rw-r--r-- | server/src/workspace.lua | 17 |
2 files changed, 12 insertions, 14 deletions
diff --git a/server/src/async/scanfiles.lua b/server/src/async/scanfiles.lua index e114eca8..650141a2 100644 --- a/server/src/async/scanfiles.lua +++ b/server/src/async/scanfiles.lua @@ -1,14 +1,17 @@ -local root = ... +local args = ... require 'utility' local fs = require 'bee.filesystem' -local list = {} local ignore = { ['.git'] = true, ['node_modules'] = true, } -for path in io.scan(fs.path(root), ignore) do +for _, name in pairs(args.ignore) do + ignore[name] = true +end + +for path in io.scan(fs.path(args.root), ignore) do if path:extension():string() == '.lua' then local buf = io.load(path) if buf then diff --git a/server/src/workspace.lua b/server/src/workspace.lua index a0641b2d..8f51fc11 100644 --- a/server/src/workspace.lua +++ b/server/src/workspace.lua @@ -78,14 +78,15 @@ function mt:init(rootUri) log.info('Log path: ', logPath) log.init(ROOT, logPath) - local ignored = {} + local ignore = {} for name in pairs(config.config.workspace.ignoreDir) do - local path = fs.absolute(self.root / name) - local str = path:string():lower() - ignored[#ignored+1] = str + ignore[#ignore+1] = name end - async.run('scanfiles', self.root:string(), function (file) + async.run('scanfiles', { + root = self.root:string(), + ignore = ignore, + }, function (file) if file == 'ok' then self:reset() self._complete = true @@ -93,12 +94,6 @@ function mt:init(rootUri) end local path = fs.path(file.path) local name = path:string():lower() - for _, ignore in ipairs(ignored) do - if name:sub(1, #ignore) == ignore then - ok = false - return - end - end local uri = self:uriEncode(path) self.files[name] = uri self.lsp:readText(uri, path, file.buf) |