Skip to content

Commit db2b675

Browse files
Christian Clasonthomasfaingnaert
andcommitted
Allow for MarkupContent in completion info (#500)
* allow for MarkdownContent in completion info * add check for correct type in MarkupContent * also pass Markdown, and hope for the best * d'oh! * advertise plaintext preference in documentation * fix documentationFormat Co-Authored-By: Thomas Faingnaert <[email protected]>
1 parent d5ab74c commit db2b675

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

autoload/lsp.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ function! lsp#default_get_supported_capabilities(server_info) abort
386386
\ },
387387
\ 'textDocument': {
388388
\ 'completion': {
389+
\ 'completionItem': {
390+
\ 'documentationFormat': ['plaintext']
391+
\ },
389392
\ 'completionItemKind': {
390393
\ 'valueSet': lsp#omni#get_completion_item_kinds()
391394
\ }

autoload/lsp/omni.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,12 @@ function! lsp#omni#default_get_vim_completion_item(item, ...) abort
268268
endif
269269

270270
if has_key(a:item, 'documentation')
271-
if type(a:item['documentation']) == type('')
271+
if type(a:item['documentation']) == type('') " field is string
272272
let l:completion['info'] .= a:item['documentation']
273+
elseif type(a:item['documentation']) == type({}) &&
274+
\ has_key(a:item['documentation'], 'value')
275+
" field is MarkupContent (hopefully 'plaintext')
276+
let l:completion['info'] .= a:item['documentation']['value']
273277
endif
274278
endif
275279

0 commit comments

Comments
 (0)