diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-18 18:08:58 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-18 18:08:58 +0800 |
commit | 063b9a38ed5480dff0ef4571d1c820123ae030b3 (patch) | |
tree | a798c62c890fa9e821dba7544529993842862082 /server/src | |
parent | e8158fd4de7e076ef019493afa33b9c2820de75a (diff) | |
download | lua-language-server-063b9a38ed5480dff0ef4571d1c820123ae030b3.zip |
文件符号不再自己编译文件了
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/method/textDocument/documentSymbol.lua | 28 | ||||
-rw-r--r-- | server/src/service.lua | 9 |
2 files changed, 14 insertions, 23 deletions
diff --git a/server/src/method/textDocument/documentSymbol.lua b/server/src/method/textDocument/documentSymbol.lua index 4e7c3808..f9823385 100644 --- a/server/src/method/textDocument/documentSymbol.lua +++ b/server/src/method/textDocument/documentSymbol.lua @@ -40,36 +40,26 @@ return function (lsp, params) timerCache[uri] = nil end - local vm, lines = lsp:loadVM(uri) - if not vm then - return nil - end - return function (response) - local co = coroutine.create(function () - return core.documentSymbol(vm) - end) - timerCache[uri] = ac.loop(0.001, function (t) - local suc, res = coroutine.resume(co) - if not suc then - t:remove() - error(res) - return - end - if coroutine.status(co) == 'suspended' then + timerCache[uri] = ac.loop(0.1, function (t) + local vm, lines = lsp:getVM(uri) + if not vm then return end t:remove() - if not res then + + local symbols = core.documentSymbol(vm) + if not symbols then response(nil) + return end - for _, symbol in ipairs(res) do + for _, symbol in ipairs(symbols) do convertRange(lines, symbol) end - response(res) + response(symbols) end) end end diff --git a/server/src/service.lua b/server/src/service.lua index 0ec563e8..2026bfa9 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -484,10 +484,11 @@ function mt:_createCompileTask() local uri = self._needCompile[1] if uri then self:compileVM(uri) - end - uri = next(self._needDiagnostics) - if uri then - self:doDiagnostics(uri) + else + uri = next(self._needDiagnostics) + if uri then + self:doDiagnostics(uri) + end end end) end |