diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-12 13:54:28 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-12 13:54:28 +0800 |
commit | 2048a535657992ff5573c692541cf10b9146f3bd (patch) | |
tree | 9672d3a61b56ff2475b3abfd7490fb3328b5e30f | |
parent | 3e71bf6a712cc008e95caa2a3c38aa41b700d95d (diff) | |
download | lua-language-server-2048a535657992ff5573c692541cf10b9146f3bd.zip |
修正bug
-rw-r--r-- | server/src/core/completion.lua | 6 | ||||
-rw-r--r-- | server/test/completion/init.lua | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index f5444e67..eab35ea0 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -338,6 +338,9 @@ local function searchInRequire(vm, select, source, callback) return end local list = vm.lsp.workspace:matchPath(vm.uri, source[1]) + if not list then + return + end for _, str in ipairs(list) do callback(str, nil, CompletionItemKind.File, { textEdit = { @@ -420,6 +423,9 @@ local function searchAllWords(vm, source, word, callback) if word == '' then return end + if source.type == 'string' then + return + end for _, src in ipairs(vm.sources) do if src.type == 'name' and matchKey(word, src[1]) diff --git a/server/test/completion/init.lua b/server/test/completion/init.lua index 55a71b53..5b3cf678 100644 --- a/server/test/completion/init.lua +++ b/server/test/completion/init.lua @@ -674,3 +674,10 @@ end kind = CompletionItemKind.Field, }, } + +TEST [[ +local ast = 1 +local t = 'as@' +local ask = 1 +]] +(nil) |