Skip to content

Commit 9ac195c

Browse files
committed
fix: multi-line snippet indentation when no placeholders
Closes #1635
1 parent 69dc479 commit 9ac195c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lua/blink/cmp/completion/accept/init.lua

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ local function apply_item(ctx, item)
3333
local parsed_snippet = require('blink.cmp.sources.snippets.utils').safe_parse(item.textEdit.newText)
3434
if
3535
parsed_snippet ~= nil
36+
-- snippets automatically handle identation on newlines, while our implementation does not,
37+
-- so ignore for muli-line snippets
38+
and #vim.split(tostring(parsed_snippet), '\n') == 1
3639
and #parsed_snippet.data.children == 1
3740
and parsed_snippet.data.children[1].type == vim.lsp._snippet_grammar.NodeType.Text
3841
then

0 commit comments

Comments
 (0)