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

Commit a3e51bc

Browse files
committed
Fix LSP completion when applying a TextEdit with newText
1 parent f5ee2a3 commit a3e51bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lua/source/lsp.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ M.getCompletionItems = function(_, _)
1010
return M.items
1111
end
1212

13-
local function get_completion_word(item)
13+
local function get_completion_word(item, prefix)
1414
if item.textEdit ~= nil and item.textEdit ~= vim.NIL
1515
and item.textEdit.newText ~= nil and (item.insertTextFormat ~= 2 or vim.fn.exists('g:loaded_vsnip_integ')) then
16-
return item.textEdit.newText
16+
return prefix .. item.textEdit.newText
1717
elseif item.insertText ~= nil and item.insertText ~= vim.NIL then
1818
return item.insertText
1919
end
@@ -49,7 +49,7 @@ local function text_document_completion_list_to_complete_items(result, prefix)
4949
end
5050
item.info = info
5151

52-
item.word = get_completion_word(completion_item)
52+
item.word = get_completion_word(completion_item, prefix)
5353
item.user_data = {
5454
lsp = {
5555
completion_item = completion_item

0 commit comments

Comments
 (0)