#2481 - Use text to insert from insertText
This commit is contained in:
parent
bff3d253e9
commit
722c3e8dae
@ -386,6 +386,8 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
|||||||
if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN
|
if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN
|
||||||
\&& type(get(l:item, 'textEdit')) is v:t_dict
|
\&& type(get(l:item, 'textEdit')) is v:t_dict
|
||||||
let l:text = l:item.textEdit.newText
|
let l:text = l:item.textEdit.newText
|
||||||
|
elseif type(get(l:item, 'insertText')) is v:t_string
|
||||||
|
let l:text = l:item.insertText
|
||||||
else
|
else
|
||||||
let l:text = l:item.label
|
let l:text = l:item.label
|
||||||
endif
|
endif
|
||||||
|
@ -486,7 +486,7 @@ Execute(Should handle completion messages with textEdit objects):
|
|||||||
\ {
|
\ {
|
||||||
\ 'detail': 'PlayTimeCallback',
|
\ 'detail': 'PlayTimeCallback',
|
||||||
\ 'filterText': 'next_callback',
|
\ 'filterText': 'next_callback',
|
||||||
\ 'insertText': 'next_callback',
|
\ 'insertText': 'ignoreme',
|
||||||
\ 'insertTextFormat': 1,
|
\ 'insertTextFormat': 1,
|
||||||
\ 'kind': 6,
|
\ 'kind': 6,
|
||||||
\ 'label': ' next_callback',
|
\ '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',
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ },
|
||||||
|
\ })
|
||||||
|
Loading…
Reference in New Issue
Block a user