#1794 - Handle LSP documentation content as a Dictionary
This commit is contained in:
parent
1a13963f0d
commit
f9e99d81a4
@ -360,12 +360,18 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
||||
let l:kind = 'v'
|
||||
endif
|
||||
|
||||
let l:doc = get(l:item, 'documentation', '')
|
||||
|
||||
if type(l:doc) is v:t_dict && has_key(l:doc, 'value')
|
||||
let l:doc = l:doc.value
|
||||
endif
|
||||
|
||||
call add(l:results, {
|
||||
\ 'word': l:word,
|
||||
\ 'kind': l:kind,
|
||||
\ 'icase': 1,
|
||||
\ 'menu': get(l:item, 'detail', ''),
|
||||
\ 'info': get(l:item, 'documentation', ''),
|
||||
\ 'info': (type(l:doc) is v:t_string ? l:doc : ''),
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
@ -447,3 +447,27 @@ Execute(Should handle missing keys):
|
||||
\ ]
|
||||
\ }
|
||||
\ })
|
||||
|
||||
Execute(Should handle documentation in the markdown format):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {'word': 'migrations', 'menu': 'xxx', 'info': 'Markdown documentation', 'kind': 'f', 'icase': 1},
|
||||
\ ],
|
||||
\ ale#completion#ParseLSPCompletions({
|
||||
\ 'jsonrpc': '2.0',
|
||||
\ 'id': 6,
|
||||
\ 'result': {
|
||||
\ 'isIncomplete': v:false,
|
||||
\ 'items': [
|
||||
\ {
|
||||
\ 'label': 'migrations',
|
||||
\ 'kind': 3,
|
||||
\ 'detail': 'xxx',
|
||||
\ 'documentation': {
|
||||
\ 'kind': 'markdown',
|
||||
\ 'value': 'Markdown documentation',
|
||||
\ },
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ })
|
||||
|
Loading…
Reference in New Issue
Block a user