ojroques / nvim-lspfuzzy

A Neovim plugin to make the LSP client use FZF
BSD 2-Clause "Simplified" License
316 stars 11 forks source link

fzf doesn't scroll preview to actual position #17

Closed astavonin closed 3 years ago

astavonin commented 3 years ago

Issue:

Open a file with active LSP and call references. FZF window with references will pop up, but when you change the selected reference, the preview window shows the file in its current position (0 line for a closed file or current cursor position for an open file).

Expected behavior:

FZF window will scroll to a line with the selected reference.

Environment:

LSP clangd and pyls (the issue is reproducable on both LSPs) Ubuntu 20.04 NeoVim 0.6.0 nvim-lspfuzzy - latest fzf and fzf.vim installed, latest version

ojroques commented 3 years ago

I personally use pyls, Ubuntu 20.04 and Neovim nightly and have never run into this issue.

Do you have bat installed? Do you use custom options for lspfuzzy or the defaults? If you're using custom options maybe try this.

astavonin commented 3 years ago

Yes, sure, bat is installed.

ojroques commented 3 years ago

Can you share your Neovim config ? Or at least the parts related to LSP / FZF / the plugin.

astavonin commented 3 years ago

I had just:

lua require('lspfuzzy').setup {}

Plug 'ojroques/nvim-lspfuzzy'

This is my full config, but already replaced nvim-lspfuzzy with fzf_lsp that's why it's in diff form

https://github.com/astavonin/configs/commit/b32e6c091d62bd2ab2c10e63d24aac4bd6f13799#diff-553fdc02bfc19357d03441ac4b6cd4fd423fe261abd391d2dc82d3d209e73644R255

ojroques commented 3 years ago

Looking at your config, replacing

let g:fzf_preview_window = ['up:50%']

with

let g:fzf_preview_window = ['up:50%:+{2}-/2']  "+{2}-/2 makes the preview centered

would likely solve your issue. But if fzf_lsp works for you feel free to keep it.