-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LSP client doesn't delete old buffers after renaming a directory #22617
Comments
#22618 my ugly fix which tries to fix it. if you think it is a viable solution I can try to clean it up and write some tests |
Related: #22075
what exactly does that mean? rename() is called by Though in general the idea makes sense. If |
I meant renaming package name in Go. When you rename it, the directory is renamed as well, which is causing problems with old buffers. |
Problem: When LSP client renames a directory, opened buffers in the edfitor are not renamed or closed. Then `:wall` shows errors. https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp/util.lua#L776 works correctly if you try to rename a single file, but doesn't delete old buffers with `old_fname` is a dir. Solution: Update the logic in runtime/lua/vim/lsp/util.lua:rename() Fixes neovim#22617
Problem: When LSP client renames a directory, opened buffers in the edfitor are not renamed or closed. Then `:wall` shows errors. https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp/util.lua#L776 works correctly if you try to rename a single file, but doesn't delete old buffers with `old_fname` is a dir. Solution: Update the logic in runtime/lua/vim/lsp/util.lua:rename() Fixes neovim#22617
Problem
When I'm renaming a directory, LSP client doesn't delete opened buffers from that directory after renaming is done, which causes an error when trying to save renaming result with
wa
.I think the problem is in this function https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp/util.lua#L776, which is working correctly if you try to rename a single file, but doesn't delete old buffers with
old_fname
is a dir.Steps to reproduce using "nvim -u minimal_init.lua"
Try call rename action by placing cursor on
pack
and then:wa
.Expected behavior
All files open buffers within the renamed directory are deleted.
Neovim version (nvim -v)
NVIM v0.9.0-dev-1189+gd3c8d104b-dirty
Language server name/version
gopls
Operating system/version
macos
Log file
No response
The text was updated successfully, but these errors were encountered: