ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.89k stars 453 forks source link

Lspsaga preview_definition not working #95

Closed p1k0pan closed 2 years ago

p1k0pan commented 2 years ago

Describe the bug ["n|gd"] = map_cr("Lspsaga preview_definition"):with_noremap():with_silent() 没有反应,从命令行输入也没有反应,也没有报错信息,lsp也安装了该语言的插件

Screenshots

Screen Shot 2022-03-18 at 14 25 15

Environment (please complete the following information):

ayamir commented 2 years ago

这个bug之前我也遇到过,但是不可复现,重新启动neovim编辑之后就没有了

p1k0pan commented 2 years ago

这个bug之前我也遇到过,但是不可复现,重新启动neovim编辑之后就没有了

重启了neovim和电脑几次,还是这样

ayamir commented 2 years ago

我这边一切正常。

  1. 你那边是所有语言都有问题还是就go语言有问题?
  2. 是就这个文件有问题还是所有的go文件都有问题?
  3. 你要preview的符号是否跨文件?
p1k0pan commented 2 years ago
  1. 目前我只安装了go和lua,但是lua和go都不行
  2. 都不行
  3. 新建了文件,测试在同一个文件内都不行 Screen Shot 2022-03-18 at 16 12 34

    gd testFunc都不行

ayamir commented 2 years ago

执行lua vim.lsp.buf.definition()之后能否完成定义跳转?

p1k0pan commented 2 years ago

能完成跳转

image

回车就能跳转过去。顺便问一下右边这个zsh框是什么插件,可以配置的吗

ayamir commented 2 years ago

https://github.com/RishabhRD/nvim-lsputils 可以配置 现在默认的lsp跳转到定义处的功能就被这个插件功能所覆盖了 Lspsage的功能这个插件基本上也能实现 由于在我这边这个功能无法稳定复现,你可以自行修改gd键位对应的命令

Lraxer commented 2 years ago

是否有可能是 efm-langserver 的问题?我这里使用了 efm-langserver 的语言(cpp, go, python, rust) gd 预览都不能用, gD 跳转是可以的,无论有没有通过 nvim-lsp-installer 安装其他 LSP 。我把efm的配置注释掉,用其他 LSP 就好了。 https://github.com/ayamir/nvimdots/blob/5177255cb8d07117cd414cad08b01ca255a708c5/lua/modules/completion/lsp.lua#L309

p1k0pan commented 2 years ago

是否有可能是 efm-langserver 的问题?我这里使用了 efm-langserver 的语言(cpp, go, python, rust) gd 预览都不能用, gD 跳转是可以的,无论有没有通过 nvim-lsp-installer 安装其他 LSP 。我把efm的配置注释掉,用其他 LSP 就好了。

https://github.com/ayamir/nvimdots/blob/5177255cb8d07117cd414cad08b01ca255a708c5/lua/modules/completion/lsp.lua#L309

我尝试了一下确实是这个问题,难道是我efm-langserver没设置好吗

ayamir commented 2 years ago

是否有可能是 efm-langserver 的问题?我这里使用了 efm-langserver 的语言(cpp, go, python, rust) gd 预览都不能用, gD 跳转是可以的,无论有没有通过 nvim-lsp-installer 安装其他 LSP 。我把efm的配置注释掉,用其他 LSP 就好了。

https://github.com/ayamir/nvimdots/blob/5177255cb8d07117cd414cad08b01ca255a708c5/lua/modules/completion/lsp.lua#L309

你的efm对应的linter&formatter装好了吗? 我这边就算卸载对应的linter&formatter也不影响lspsaga的使用 倒是我发现这个Lspsaga的preview功能只对第一次打开的文件所处的工作区的文件起作用,如果这时候切换其他工作区的文件preview就会失效(不管有没有使用efm)

ayamir commented 2 years ago

能完成跳转 image 回车就能跳转过去。顺便问一下右边这个zsh框是什么插件,可以配置的吗

对了,这个说明nvim-lsputils的代码预览和高亮直接用了bat,配色什么的设置直接用得是bat的设置(之前wiki里面没有写这个依赖,刚加上)

Lraxer commented 2 years ago

是否有可能是 efm-langserver 的问题?我这里使用了 efm-langserver 的语言(cpp, go, python, rust) gd 预览都不能用, gD 跳转是可以的,无论有没有通过 nvim-lsp-installer 安装其他 LSP 。我把efm的配置注释掉,用其他 LSP 就好了。 https://github.com/ayamir/nvimdots/blob/5177255cb8d07117cd414cad08b01ca255a708c5/lua/modules/completion/lsp.lua#L309

你的efm对应的linter&formatter装好了吗? 我这边就算卸载对应的linter&formatter也不影响lspsaga的使用 倒是我发现这个Lspsaga的preview功能只对第一次打开的文件所处的工作区的文件起作用,如果这时候切换其他工作区的文件preview就会失效(不管有没有使用efm)

efm 是可以正常使用的,只是写 cpp 的时候也有点问题,我得在 lsp.lua 里面自己写 clang-format 的配置,自动格式化才能生效。另外 linter (clang-tidy) 提示的错误经常一直留在屏幕上消除不掉,不过别的语言没有这个问题。现在我还是放弃用 efm 了,也就是 cpp 的格式化稍微麻烦一点。 Lspsaga 我平常用得不多,目前只发现 gd 这一个问题,code actions 都是正常的。 我的 Neovim 版本是 v0.6.1 。

p1k0pan commented 2 years ago

重装了一下efm和语言插件,可以用了