summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-07 16:25:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-07 16:25:30 +0800
commit24b83882cfca469a797bf5536f2d5c68762189bb (patch)
tree98f81c31f04733a86d48da2d31a45c96f69284aa
parentd0f2fff90e56a6e2b1448217174e29fb0d17d05a (diff)
downloadlua-language-server-24b83882cfca469a797bf5536f2d5c68762189bb.zip
fix insertText
-rw-r--r--script/core/completion.lua2
-rw-r--r--test/completion/init.lua4
2 files changed, 6 insertions, 0 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index 03d17a22..60c3e16d 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -288,6 +288,7 @@ local function checkLocal(ast, word, offset, results)
local funcLabel = name .. getParams(def, false)
buildFunction(results, source, false, {
label = funcLabel,
+ insertText = name,
kind = define.CompletionItemKind.Function,
id = stack(function ()
return {
@@ -436,6 +437,7 @@ local function checkFieldThen(name, src, word, start, offset, parent, oop, resul
buildFunction(results, src, oop, {
label = name,
kind = kind,
+ insertText = name:match '^[^(]+',
deprecated = vm.isDeprecated(src) or nil,
id = stack(function ()
return {
diff --git a/test/completion/init.lua b/test/completion/init.lua
index d5631564..b2cac99d 100644
--- a/test/completion/init.lua
+++ b/test/completion/init.lua
@@ -1001,6 +1001,7 @@ xpcal$
{
label = 'xpcall(f, msgh, arg1, ...)',
kind = define.CompletionItemKind.Function,
+ insertText = EXISTS,
},
{
label = 'xpcall(f, msgh, arg1, ...)',
@@ -1019,6 +1020,7 @@ mt:f$
{
label = 'f(a, b, c)',
kind = define.CompletionItemKind.Method,
+ insertText = EXISTS,
},
{
label = 'f(a, b, c)',
@@ -1786,6 +1788,7 @@ zzz$
{
label = 'zzzzz(list, sep, i, j)',
kind = define.CompletionItemKind.Function,
+ insertText = EXISTS,
},
{
label = 'zzzzz(list, sep, i, j)',
@@ -2269,6 +2272,7 @@ m.f$
{
label = "f()",
kind = define.CompletionItemKind.Function,
+ insertText = EXISTS,
},
{
label = "f()",