summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-08-27 21:22:56 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-08-27 21:22:56 +0800
commit7d041b4d7507190141eaac05501d479b77aa8771 (patch)
treed02c4a5a98d4d1b746ccb1d2f7a51a307b99cea8 /server/src
parent90fb20579113cd580faf030332c2007b40a6fe2e (diff)
downloadlua-language-server-7d041b4d7507190141eaac05501d479b77aa8771.zip
可以禁用函数调用片段
Diffstat (limited to 'server/src')
-rw-r--r--server/src/config.lua3
-rw-r--r--server/src/core/completion.lua18
2 files changed, 14 insertions, 7 deletions
diff --git a/server/src/config.lua b/server/src/config.lua
index ec01bd08..24e0d53e 100644
--- a/server/src/config.lua
+++ b/server/src/config.lua
@@ -119,6 +119,9 @@ local ConfigTemplate = {
Or(Boolean, Array(String))
)}
},
+ completion = {
+ callSnippet = {true, Boolean},
+ },
}
local OtherTemplate = {
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua
index b9191568..d47f768f 100644
--- a/server/src/core/completion.lua
+++ b/server/src/core/completion.lua
@@ -930,13 +930,17 @@ local function makeList(source, pos, word)
end
list[#list+1] = data
if data.snip then
- local snipData = table.deepCopy(data)
- snipData.insertText = data.snip
- snipData.kind = CompletionItemKind.Snippet
- snipData.label = snipData.label .. '()'
- snipData.snip = nil
- data.snip = nil
- list[#list+1] = snipData
+ if config.config.completion.callSnippet then
+ local snipData = table.deepCopy(data)
+ snipData.insertText = data.snip
+ snipData.kind = CompletionItemKind.Snippet
+ snipData.label = snipData.label .. '()'
+ snipData.snip = nil
+ data.snip = nil
+ list[#list+1] = snipData
+ else
+ data.snip = nil
+ end
end
end, list
end