Open hendrikiseke1979 opened 3 months ago
It works fine for me Also could you update to neovim 0.10 as 0.9 is no longer supported.
Having the same issue with 0.10:
If I can provide anymore information, please let me know.
Can this issue be reproduced with the following config init_lazy.lua
with
nvim -u init_lazy.lua main.go
Can this issue be reproduced with the following config init_lazy.lua
with
nvim -u init_lazy.lua main.go
Unfortunately yes, the problem persists:
GoRename
shells out to an external command, and should probably be avoided if you have a LSP client attached.
My intuition is that the file you are editing isn't being written after performing the first rename, so the file that is passed to the command on the second rename differs from what is shown in the Neovim buffer.
My intuition is that the file you are editing isn't being written after performing the first rename, so the file that is passed to the command on the second rename differs from what is shown in the Neovim buffer.
I explicitly saved both files after the first rename, without any success. However, when I restart nvim after the first rename, things work just fine. Unfortunately, I don't know enough about the internals of neovim and plugins to debug this any further.
Actually it seems like I was wrong about this:
GoRename
shells out to an external command -- https://github.com/ray-x/go.nvim/issues/482#issuecomment-2247743882
The documentation might be a bit outdated (?). GoRename
seems to consistently call lsprename()
:
https://github.com/ray-x/go.nvim/blob/033344ddfa3cd5cfd55037903264b2bb86691619/lua/go/commands.lua#L378-L380
Which itself calls vim.lsp.buf.rename()
:
https://github.com/ray-x/go.nvim/blob/033344ddfa3cd5cfd55037903264b2bb86691619/lua/go/rename.lua#L6-L10
I just tried performing :GoRename
twice in a row on the same symbol, without writing the buffer between the two actions, and everything worked as expected across multiple project packages.
I did find some issue with the LSP key bindings provided by the plugin though.
If you have lsp_keymaps
set to true
(the default), <space>rn
will call the old implementation (which I suspect to be broken):
https://github.com/ray-x/go.nvim/blob/033344ddfa3cd5cfd55037903264b2bb86691619/lua/go/lsp.lua#L66
This does seem like a bug, but you didn't mention anything about using this key binding, so I assume the problem is unrelated.
Thanks @antoineco for your explanation. I do have this keymapping in my init.lua:
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
When I use this keymapping, it does not open the popup prompts for the new name on the bottom of the screen. This way, the renaming works, if I however call :GoRename
it does not.
I didn't mention the binding, because I could reproduce the issue with @ray-x's init_lazy.lua as well.
Hi, I'm not sure, if I'm missing anything, but I ran into issues when using
GoRename
(usingvim.lsp.buf.rename
works). These are the steps to reproduce:Create a
main
function calling a functionFoo()
in some package:Renaming the function to
FooBar
work out pretty well:Renaming the function again results in an error:
Neovim: 0.9.5 go.nvim: current master