summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/completion.vim2
-rw-r--r--test/completion/test_lsp_completion_parsing.vader26
2 files changed, 27 insertions, 1 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 1d42c489..e775347b 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -386,6 +386,8 @@ function! ale#completion#ParseLSPCompletions(response) abort
if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN
\&& type(get(l:item, 'textEdit')) is v:t_dict
let l:text = l:item.textEdit.newText
+ elseif type(get(l:item, 'insertText')) is v:t_string
+ let l:text = l:item.insertText
else
let l:text = l:item.label
endif
diff --git a/test/completion/test_lsp_completion_parsing.vader b/test/completion/test_lsp_completion_parsing.vader
index a8e00260..ef954564 100644
--- a/test/completion/test_lsp_completion_parsing.vader
+++ b/test/completion/test_lsp_completion_parsing.vader
@@ -486,7 +486,7 @@ Execute(Should handle completion messages with textEdit objects):
\ {
\ 'detail': 'PlayTimeCallback',
\ 'filterText': 'next_callback',
- \ 'insertText': 'next_callback',
+ \ 'insertText': 'ignoreme',
\ 'insertTextFormat': 1,
\ 'kind': 6,
\ 'label': ' next_callback',
@@ -502,3 +502,27 @@ Execute(Should handle completion messages with textEdit objects):
\ ],
\ },
\ })
+
+Execute(Should handle completion messages with the deprecated insertText attribute):
+ AssertEqual
+ \ [
+ \ {'word': 'next_callback', 'menu': 'PlayTimeCallback', 'info': '', 'kind': 'v', 'icase': 1},
+ \ ],
+ \ ale#completion#ParseLSPCompletions({
+ \ 'id': 226,
+ \ 'jsonrpc': '2.0',
+ \ 'result': {
+ \ 'isIncomplete': v:false,
+ \ 'items': [
+ \ {
+ \ 'detail': 'PlayTimeCallback',
+ \ 'filterText': 'next_callback',
+ \ 'insertText': 'next_callback',
+ \ 'insertTextFormat': 1,
+ \ 'kind': 6,
+ \ 'label': ' next_callback',
+ \ 'sortText': '3ee19999next_callback',
+ \ },
+ \ ],
+ \ },
+ \ })