ray-x / navigator.lua

Code analysis & navigation plugin for Neovim. Navigate codes like a breeze🎐 Exploring LSP and 🌲Treesitter symbols a piece of 🍰 Take control like a boss 🦍
MIT License
1.31k stars 58 forks source link

Missing preview window when showing references #34

Closed RobertBuhren closed 2 years ago

RobertBuhren commented 3 years ago

Issue

When pressing "gr" on a symbol to list it's references a popup window with the list of references appears. However, there is no preview window when selecting an entry of that list. Pressing "Enter" on an entry will open the respective entry in the same window without changing it's size. See the screenshots attached.

Screenshot

Result of "gr" on the function "ccp_reverse_buf": Screenshot from 2021-07-19 09-43-38

Result of pressing "Enter" on an entry: Screenshot from 2021-07-19 09-56-54

Expected result

I'd expect that a preview window that displays the respective entry is created. Upon selecting an entry via "Enter" the respective location is opened in the current buffer.

Please close this issue if the shown behavior is indeed expected.

Setup

Tested with this minimal config and neovim-0.5 on archlinux. Language server is clangd.

set termguicolors
call plug#begin('~/.local/share/nvim/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-treesitter/nvim-treesitter'

Plug 'ray-x/guihua.lua'
Plug 'ray-x/navigator.lua'

call plug#end()

lua <<EOF
local single = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}
require"navigator".setup({
  debug = true,
  width = 0.7,
  border = single, -- "single"
})
EOF
set mouse=a
ray-x commented 3 years ago

This is not correct behaviour. But I can not reproduce.

One question. Do you have multiple LSP install. E.g ccls and clangd? It may introduce some issue if you have multiple lsp installed.

You can disable lsp by setting filetype={}

feedoom commented 3 years ago

This is not correct behaviour. But I can not reproduce.

One question. Do you have multiple LSP install. E.g ccls and clangd? It may introduce some issue if you have multiple lsp installed.

You can disable lsp by setting filetype={}

I has the same problem.It missing preview window when i edit javascript .And i only install tsserver

ray-x commented 3 years ago

Could you post your minimum vimrc, and a piece of source code so I can check what the issue is?

e.g.

set termguicolors
call plug#begin('~/.local/share/nvim/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-treesitter/nvim-treesitter'

Plug 'ray-x/guihua.lua'
Plug 'ray-x/navigator.lua'

call plug#end()

lua <<EOF
local single = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}
require"navigator".setup({
  debug = true,
  width = 0.7,
  border = single, -- "single"
})
EOF
set mouse=a

Also if debug is enabled. Would be great to send you log as well (by default under $HOME/.local/share/nvim/gh.log)

Thanks!

feedoom commented 3 years ago

Could you post your minimum vimrc, and a piece of source code so I can check what the issue is?

e.g.

set termguicolors
call plug#begin('~/.local/share/nvim/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-treesitter/nvim-treesitter'

Plug 'ray-x/guihua.lua'
Plug 'ray-x/navigator.lua'

call plug#end()

lua <<EOF
local single = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}
require"navigator".setup({
  debug = true,
  width = 0.7,
  border = single, -- "single"
})
EOF
set mouse=a

Also if debug is enabled. Would be great to send you log as well (by default under $HOME/.local/share/nvim/gh.log)

Thanks!

My configuration is from README. And this is gh.log gh.log

ray-x commented 3 years ago

Strange, But still failed to reproduce. I used javascript a lot and should have spot the issue. The logs show lsp diagnostic messages. I but it missing the log for plugin launch. Also missing go to reference and I can not tell why the preview failed to show. It will be helpful if you could remove gh.log and restart neovim. Then, open your code and search for LSP reference and show preview by move the cursor up and down.

fky2015 commented 2 years ago

I encounter the same problem here. So I create a minimal reproducible example. Hope it will help.

https://github.com/fky2015/navigator.nvim-bug-report

ray-x commented 2 years ago

I did some update to your init.lua and it not reproduce (I am using packer and can not re-install with your setup path)

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'

local function load_plugins()
  require('packer').startup({
    function(use)
      use({ 'wbthomason/packer.nvim' })
      use('nvim-treesitter/nvim-treesitter')
      use('neovim/nvim-lspconfig')
      use({
        'ray-x/navigator.lua',
        requires = { 'ray-x/guihua.lua', run = 'cd lua/fzy && make' },
        config = function()
          require('navigator').setup()
        end,
      })
    end,
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      -- git = { default_url_format = 'https://hub.fastgit.org/%s' },
    },
  })
end

if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system({
    'git',
    'clone',
    'https://github.com/wbthomason/packer.nvim',
    install_path,
  })
  load_plugins()
  require('packer').sync()
else
  load_plugins()
end
fky2015 commented 2 years ago

I've updated the repo and recorded the problem as below. asciicast

ray-x commented 2 years ago

I tried ubuntu and archlinux today. Both do not reproduce. I noticed from your video 1) You are on nvim 0.6.1. But the freeze version is using LuaJit 2.1, You are using 2.0. Did you build the image yourself? 2) As I can not see your keypress. It is supposed to move cursor in the list with <Up> <Down> or <C-p> <C-n> or <PageUp/Dow>or with a number key 1~9. From the video, seems you are moving both vertically and horizontally. Which make me think you are not using those keymaps. Please check above keys are mapped in ListView floating windows and you are using those keymaps (e.g :nmap <Up>). Also as you are using a default colorscheme, I can not really tell your cursor selected the list items. Could you check if colorscheme ray-x/aurora will looks better. 2) I updated guihua.lua for archlinux. Not sure if it is relevant. Please update the plugins and try again.

Thanks!

fky2015 commented 2 years ago

2. As I can not see your keypress. It is supposed to move cursor in the list with <Up> <Down> or <C-p> <C-n> or <PageUp/Dow>or with a number key 1~9.

I see where the problem is. I was using h/j/k/l to move around in the list.

After using <Up>/<Down>/<c-p>/<c-n>/<PageUp>/<PageDown>, everything work as intended.

Sorry for not carefully reading the docs and making the wrong assumptions on key mapings. Thanks for your work and your help!


  1. You are on nvim 0.6.1. But the freeze version is using LuaJit 2.1, You are using 2.0. Did you build the image yourself?

No, I didn't. LuaJit in Arch Linux is 2.0.5.

ray-x commented 2 years ago

@RobertBuhren @feedoom Please check if you are still seeing the issue?