Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 8bca7ac

Browse files
authored
Merge pull request #333 from garypippi/when_text_insert_format_is_nil
fix: InsertTextFormat should fallback to PlainText
2 parents 02df2fd + e9d4dae commit 8bca7ac

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lua/completion/source/lsp.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ local function get_completion_word(item, prefix, suffix)
3030
else
3131
newText = item.textEdit.newText
3232
end
33-
if protocol.InsertTextFormat[item.insertTextFormat] == "PlainText"
34-
or opt.get_option('enable_snippet') == "snippets.nvim" then
33+
if not item.insertTextFormat
34+
or protocol.InsertTextFormat[item.insertTextFormat] == "PlainText"
35+
or opt.get_option('enable_snippet') == "snippets.nvim" then
3536
return newText
3637
else
3738
return vim.lsp.util.parse_snippet(newText)
3839
end
3940
elseif item.insertText ~= nil and item.insertText ~= vim.NIL then
40-
if protocol.InsertTextFormat[item.insertTextFormat] == "PlainText"
41-
or opt.get_option('enable_snippet') == "snippets.nvim" then
41+
if not item.insertTextFormat
42+
or protocol.InsertTextFormat[item.insertTextFormat] == "PlainText"
43+
or opt.get_option('enable_snippet') == "snippets.nvim" then
4244
return item.insertText
4345
else
4446
return vim.lsp.util.parse_snippet(item.insertText)

0 commit comments

Comments
 (0)