Skip to content

Commit a3dd298

Browse files
committed
Send the correct insertTextFormat
Per LSP specification, `insertTextFormat` should be `2` for snippets and `1` for plain text. Using `2` unconditionally can make clients behave in unexpected ways. The code calling into `provider.lua` sets `insertTextFormat` to 2 for all snippets and leaves it nil for other types, so we can reuse that information in `provider.lua` to make sure we send the correct value.
1 parent cdb1b09 commit a3dd298

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

script/provider/provider.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ m.register 'textDocument/completion' {
661661
sortText = res.sortText or ('%04d'):format(i),
662662
filterText = res.filterText,
663663
insertText = res.insertText,
664-
insertTextFormat = 2,
664+
insertTextFormat = res.insertTextFormat or 1,
665665
commitCharacters = res.commitCharacters,
666666
command = res.command,
667667
textEdit = res.textEdit and {

0 commit comments

Comments
 (0)