summaryrefslogtreecommitdiff
path: root/server/src/method/textDocument/completion.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-19 14:26:08 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-19 14:26:08 +0800
commit2e634c583108b627ec941b8e178e74f19104ee7e (patch)
tree54d9b7c5b4fbb5d177d78eb0d26809d65faf7f87 /server/src/method/textDocument/completion.lua
parent16019a66f988f24fa0dd195cea4497d1b08acdc8 (diff)
downloadlua-language-server-2e634c583108b627ec941b8e178e74f19104ee7e.zip
修正报错
Diffstat (limited to 'server/src/method/textDocument/completion.lua')
-rw-r--r--server/src/method/textDocument/completion.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/server/src/method/textDocument/completion.lua b/server/src/method/textDocument/completion.lua
index 24961f43..2ecc06a5 100644
--- a/server/src/method/textDocument/completion.lua
+++ b/server/src/method/textDocument/completion.lua
@@ -9,6 +9,9 @@ return function (lsp, params)
-- lua是从1开始的,因此都要+1
local position = lines:position(params.position.line + 1, params.position.character + 1)
local items = matcher.completion(vm, position)
+ if not items then
+ return nil
+ end
for i, item in ipairs(items) do
item.sortText = ('%04d'):format(i)
end