mirror of
https://github.com/neovim/neovim.git
synced 2025-12-23 14:48:58 +00:00
runtime/lua/vim/lsp: check emptyness in get_completion_word
This commit is contained in:
@@ -518,13 +518,13 @@ end
|
|||||||
--- precedence is as follows: textEdit.newText > insertText > label
|
--- precedence is as follows: textEdit.newText > insertText > label
|
||||||
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
|
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
|
||||||
local function get_completion_word(item)
|
local function get_completion_word(item)
|
||||||
if item.textEdit ~= nil and item.textEdit.newText ~= nil then
|
if item.textEdit ~= nil and item.textEdit.newText ~= nil and item.textEdit.newText ~= "" then
|
||||||
if protocol.InsertTextFormat[item.insertTextFormat] == "PlainText" then
|
if protocol.InsertTextFormat[item.insertTextFormat] == "PlainText" then
|
||||||
return item.textEdit.newText
|
return item.textEdit.newText
|
||||||
else
|
else
|
||||||
return M.parse_snippet(item.textEdit.newText)
|
return M.parse_snippet(item.textEdit.newText)
|
||||||
end
|
end
|
||||||
elseif item.insertText ~= nil then
|
elseif item.insertText ~= nil and item.insertText ~= "" then
|
||||||
if protocol.InsertTextFormat[item.insertTextFormat] == "PlainText" then
|
if protocol.InsertTextFormat[item.insertTextFormat] == "PlainText" then
|
||||||
return item.insertText
|
return item.insertText
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user