From a3dd298664a55be46a2603642559eb91656ba18e Mon Sep 17 00:00:00 2001 From: Andrew Braxton Date: Tue, 24 Dec 2024 22:21:01 -0500 Subject: [PATCH] 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. --- script/provider/provider.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/provider/provider.lua b/script/provider/provider.lua index af65110a5..08031213e 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -661,7 +661,7 @@ m.register 'textDocument/completion' { sortText = res.sortText or ('%04d'):format(i), filterText = res.filterText, insertText = res.insertText, - insertTextFormat = 2, + insertTextFormat = res.insertTextFormat or 1, commitCharacters = res.commitCharacters, command = res.command, textEdit = res.textEdit and {