summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-24 17:36:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-24 17:36:25 +0800
commitff6a7e95e1a6be16338bcd1819b512cb36960e3b (patch)
tree891fe9bf0955a9ade03ed792297a517e3284c8cd
parent46f7d5bc7af55a3d13a2f5edc70667f360b8bd4d (diff)
downloadlua-language-server-ff6a7e95e1a6be16338bcd1819b512cb36960e3b.zip
fix
-rw-r--r--script/core/completion.lua3
-rw-r--r--test/completion/continue.lua14
2 files changed, 16 insertions, 1 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index 843a8317..a2eaca4e 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -1956,7 +1956,8 @@ local function getCache(uri, offset)
if results.enableCommon and result.kind == define.CompletionItemKind.Text then
results[i] = results[#results]
results[#results] = nil
- elseif matchKey(word, match) then
+ elseif matchKey(word, match)
+ or (result.textEdit and matchKey(word, result.textEdit.newText:match '[%w_]*')) then
if result.textEdit then
result.textEdit.finish = result.textEdit.finish + ext
end
diff --git a/test/completion/continue.lua b/test/completion/continue.lua
index 96ec4964..a548859a 100644
--- a/test/completion/continue.lua
+++ b/test/completion/continue.lua
@@ -41,4 +41,18 @@ pro$
}
}
+TEST [[
+---@param n '"abcdefg"'
+local function f(n) end
+
+f 'abc$'
+]]
+{
+ {
+ label = "'abcdefg'",
+ kind = define.CompletionItemKind.EnumMember,
+ textEdit = EXISTS,
+ }
+}
+
ContinueTyping = false