liuchengxu / vista.vim

:cactus: Viewer & Finder for LSP symbols and tags
https://liuchengxu.github.io/vista.vim
MIT License
1.88k stars 89 forks source link

lsp+fzf preview show incorrect line. #463

Open lzh01 opened 1 year ago

lzh01 commented 1 year ago

In code https://github.com/liuchengxu/vista.vim/blob/f925e481bba7cd5451fb8bca9a6ecfc2bf1f2858/autoload/vista/finder.vim#L158-L193

It all depends on ':' as field separator, but when 'symbol' name or the line of code contains ':', the fzf preview can't get the correct line, will mostly end up showing from the start of the file.

For example, it can't handle lsp result line like

ClassA::varName:250 Variable yyy = "asdf:asdf";
function:275 Function ClassA::function() {

Tried to fix, but seems we have to use a different separator like '|' for the input.

lzh01 commented 1 year ago

Also another issue for this part: https://github.com/liuchengxu/vista.vim/blob/f925e481bba7cd5451fb8bca9a6ecfc2bf1f2858/autoload/vista/finder.vim#L168-L174

g:vista_fzf_preview got updated everytime we call a preview, and ':+{-1}-5' end up being added many times.