Skip to content

Commit 1886d68

Browse files
L-TChenprabirshrestha
authored andcommitted
Display detail of a completion item as info for omnifunc (#136)
* Display `detail` of a completion item as `info` for omnifunc * Avoid unnecessary string allocations * Fix "info not always exists in l:completion"
1 parent 9806023 commit 1886d68

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

autoload/lsp/omni.vim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,18 @@ function! lsp#omni#get_vim_completion_item(item) abort
162162
let l:abbr = a:item['label']
163163
endif
164164
let l:menu = lsp#omni#get_kind_text(a:item)
165-
let l:completion = { 'word': l:word, 'abbr': l:abbr, 'menu': l:menu, 'icase': 1, 'dup': 1 }
165+
let l:completion = { 'word': l:word, 'abbr': l:abbr, 'menu': l:menu, 'info': "", 'icase': 1, 'dup': 1 }
166+
167+
if has_key(a:item, 'detail')
168+
let l:completion['info'] .= a:item['detail'] . " "
169+
endif
170+
166171
if has_key(a:item, 'documentation')
167172
if type(a:item['documentation']) == type('')
168-
let l:completion['info'] = a:item['documentation']
173+
let l:completion['info'] .= a:item['documentation']
169174
endif
170175
endif
176+
171177
return l:completion
172178
endfunction
173179

0 commit comments

Comments
 (0)