Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
using `Snippet` only when `callSnippet` is `Both`
  • Loading branch information
sumneko committed Apr 4, 2022
1 parent ed95ca7 commit c74a408
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion script/core/completion/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ local function buildFunction(results, source, value, oop, data)
if snipType == 'Both' or snipType == 'Replace' then
local snipData = util.deepCopy(data)

snipData.kind = define.CompletionItemKind.Snippet
snipData.kind = snipType == 'Both'
and define.CompletionItemKind.Snippet
or data.kind
snipData.insertText = buildFunctionSnip(source, value, oop)
snipData.insertTextFormat = 2
snipData.command = {
Expand Down
23 changes: 23 additions & 0 deletions test/completion/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,29 @@ zac<??>
},
}

config.set(nil, 'Lua.completion.callSnippet', 'Disable')
TEST [[
ass<??>
]]
{
{
label = 'assert(v, message)',
kind = define.CompletionItemKind.Function,
},
}

config.set(nil, 'Lua.completion.callSnippet', 'Replace')
TEST [[
ass<??>
]]
{
{
label = 'assert(v, message)',
kind = define.CompletionItemKind.Function,
},
}

config.set(nil, 'Lua.completion.callSnippet', 'Both')
TEST [[
ass<??>
]]
Expand Down

0 comments on commit c74a408

Please sign in to comment.