summaryrefslogtreecommitdiff
path: root/script-beta/provider/provider.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-15 18:57:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-15 18:57:58 +0800
commit674892abc53ad6752326135c8aaf60073f80b632 (patch)
treec9376e1f76975834ad49f785f7f31b33e7661059 /script-beta/provider/provider.lua
parent67eae45b182fc8a7302970d71af4e76eafab0a2e (diff)
downloadlua-language-server-674892abc53ad6752326135c8aaf60073f80b632.zip
先保证自动完成的速度
Diffstat (limited to 'script-beta/provider/provider.lua')
-rw-r--r--script-beta/provider/provider.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/script-beta/provider/provider.lua b/script-beta/provider/provider.lua
index aa649370..ba635255 100644
--- a/script-beta/provider/provider.lua
+++ b/script-beta/provider/provider.lua
@@ -319,7 +319,7 @@ proto.on('textDocument/completion', function (params)
if not result then
return nil
end
- local easy = true
+ local easy = false
local items = {}
for i, res in ipairs(result) do
local item = {
@@ -332,11 +332,13 @@ proto.on('textDocument/completion', function (params)
if res.id then
if easy and os.clock() - clock < 0.05 then
local resolved = core.resolve(res.id)
- item.detail = resolved.detail
- item.documentation = resolved.description and {
- value = resolved.description,
- kind = 'markdown',
- }
+ if resolved then
+ item.detail = resolved.detail
+ item.documentation = resolved.description and {
+ value = resolved.description,
+ kind = 'markdown',
+ }
+ end
else
easy = false
item.data = {
@@ -362,6 +364,9 @@ proto.on('completionItem/resolve', function (item)
end
await.setPriority(1000)
local resolved = core.resolve(id)
+ if not resolved then
+ return nil
+ end
item.detail = resolved.detail
item.documentation = resolved.description and {
value = resolved.description,