Skip to content

Commit

Permalink
Add preview info to completion items (#57)
Browse files Browse the repository at this point in the history
* Add preview info from the 'documentation' fields of completion items
  • Loading branch information
rliang authored and prabirshrestha committed Nov 23, 2017
1 parent f151702 commit e7ab592
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions autoload/lsp/omni.vim
Expand Up @@ -143,12 +143,16 @@ function! s:get_completion_result(data) abort
endfunction

function! s:format_completion_item(item) abort
let l:word = a:item['label']
let l:comp = {'word': a:item['label'], 'abbr': a:item['label'], 'menu': lsp#omni#get_kind_text(a:item), 'icase': 1, 'dup': 1}

if has_key(a:item, 'insertText') && !empty(a:item['insertText'])
let l:word = a:item['insertText']
let l:comp['word'] = a:item['insertText']
endif
if has_key(a:item, 'documentation') && !empty(a:item['documentation'])
let l:comp['info'] = a:item['documentation']
endif

return {'word': l:word, 'abbr': a:item['label'], 'menu': lsp#omni#get_kind_text(a:item), 'icase': 1, 'dup': 1}
return l:comp
endfunction

" }}}

0 comments on commit e7ab592

Please sign in to comment.