aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2021-03-21 20:22:58 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2021-03-21 20:22:58 +0100
commitf6ed2142e0c7e3a2e605fb1217cc62195f7f418d (patch)
tree569c5cc95b3c26aca51d0fa4648cff1eaef89067 /init.lua
parent7624250719ac0bff87796fc9dc74e97c0295e50b (diff)
downloadvis-lspc-f6ed2142e0c7e3a2e605fb1217cc62195f7f418d.tar.gz
vis-lspc-f6ed2142e0c7e3a2e605fb1217cc62195f7f418d.zip
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.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua4
1 files changed, 2 insertions, 2 deletions
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)