summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/config.lua5
-rw-r--r--server/src/core/completion.lua13
2 files changed, 11 insertions, 7 deletions
diff --git a/server/src/config.lua b/server/src/config.lua
index 491613b4..f58df498 100644
--- a/server/src/config.lua
+++ b/server/src/config.lua
@@ -120,8 +120,9 @@ local ConfigTemplate = {
)}
},
completion = {
- enable = {true, Boolean},
- callSnippet = {true, Boolean},
+ enable = {true, Boolean},
+ callSnippet = {'Both', String},
+ keywordSnippet = {'Both', String},
},
plugin = {
enable = {false, Boolean},
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua
index 5c86aa7e..69d68a8a 100644
--- a/server/src/core/completion.lua
+++ b/server/src/core/completion.lua
@@ -941,17 +941,20 @@ local function makeList(source, pos, word)
end
list[#list+1] = data
if data.snip then
- if config.config.completion.callSnippet then
+ local snipType = config.config.completion.callSnippet
+ if snipType ~= 'Disable' 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
+ if snipType == 'Both' then
+ list[#list+1] = snipData
+ elseif snipType == 'Replace' then
+ list[#list] = snipData
+ end
end
+ data.snip = nil
end
end, list
end