liuchengxu / vista.vim

:cactus: Viewer & Finder for LSP symbols and tags

Home Page:https://liuchengxu.github.io/vista.vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to show or hide the textual description of the symbol kind in lsp renderer

emarbo opened this issue Β· comments

Hi! Thank you for this great plugin πŸ‘

I have recently enabled the icons (g:vista#renderer#enable_icon) and configured them properly to work with my font but now I see the kind information duplicated by the icon and the textual description:

x

It would be great to disable the textual description as it's more verbose and redundant. If I'm right, there's no option yet for doing so.

I think the best solution is to add a new flag g:vista#renderer#enable_kind that defaults to 1 for backwards compatibility. As far as I know, modifying this function should do the trick for the CoC:

function! s:IntoLSPHirRow(row) abort
let icon = vista#renderer#IconFor(a:row.kind).' '
let indented = repeat(' ', a:row.level * s:indent_size).icon.a:row.text.' '.a:row.kind
let lnum = ':'.a:row.lnum
return indented.lnum
endfunction

And these lines for the ctags:

function! s:Assemble(line, depth) abort
let line = a:line
let kind = get(line, 'kind', '')
let row = vista#util#Join(
\ repeat(' ', a:depth * s:indent_size),
\ s:GetVisibility(line),
\ vista#renderer#IconFor(kind).' ',
\ get(line, 'name'),
\ get(line, 'signature', ''),
\ ' '.kind,
\ ':'.get(line, 'line', '')
\ )
return row
endfunction

If you think this flag worths it, let me know and I can prepare a PR in the next days.

Please go ahead, it's ok with me.