diff options
-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) |