From f6ed2142e0c7e3a2e605fb1217cc62195f7f418d Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 21 Mar 2021 20:22:58 +0100 Subject: use completionItem.label as default insertText as specified by LSP https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion states that if no insertText is present the label should be interpreted as inertText. --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index ddb3a3d..f3685db 100644 --- a/init.lua +++ b/init.lua @@ -468,7 +468,7 @@ local function lspc_handle_completion_method_response(win, result, old_pos) return end - if completion.insertText then + if completion.insertText or completion.label then -- Does our current state correspont to the state when the completion method -- was called. -- Otherwise we don't have a good way to apply the 'insertText' completion @@ -476,7 +476,7 @@ local function lspc_handle_completion_method_response(win, result, old_pos) lspc_warn('can not apply textInsert because the cursor position changed') end - local new_word = completion.insertText + local new_word = completion.insertText or completion.label local old_word_range = win.file:text_object_word(old_pos) local old_word = win.file:content(old_word_range) -- cgit v1.2.3