summaryrefslogtreecommitdiff
path: root/server/src/method/textDocument
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-18 18:08:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-18 18:08:58 +0800
commit063b9a38ed5480dff0ef4571d1c820123ae030b3 (patch)
treea798c62c890fa9e821dba7544529993842862082 /server/src/method/textDocument
parente8158fd4de7e076ef019493afa33b9c2820de75a (diff)
downloadlua-language-server-063b9a38ed5480dff0ef4571d1c820123ae030b3.zip
文件符号不再自己编译文件了
Diffstat (limited to 'server/src/method/textDocument')
-rw-r--r--server/src/method/textDocument/documentSymbol.lua28
1 files changed, 9 insertions, 19 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