mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(lsp): trim trailing whitespace from completion words (#29122)
the `complete()` mechanism doesn't play nicely with trailing newlines or tabs. A newline causes it to insert a null character, showing up as `^@`.
This commit is contained in:
committed by
GitHub
parent
24cb9ba6d3
commit
19be3d2683
@ -153,7 +153,8 @@ local function get_completion_word(item)
|
||||
return item.label
|
||||
end
|
||||
elseif item.textEdit then
|
||||
return item.textEdit.newText
|
||||
local word = item.textEdit.newText
|
||||
return word:match('^(%S*)') or word
|
||||
elseif item.insertText and item.insertText ~= '' then
|
||||
return item.insertText
|
||||
end
|
||||
|
Reference in New Issue
Block a user