idea: renaming files with LSP support
Describe the problem you're having Hi! I don't actually use this plugin but I think it looks great. Wanted to provide an idea that I implemented as an experiment in another project that's kinda similar.
The idea is: when a file is renamed, neovim can notify running LSP servers and they can help the user by providing updated references to the renamed file. I found this not too difficult to do, and at least for simple cases it's working great.
Proposed solution(s) [Optional] Do you have any ideas for how the feature could be implemented?
I drew a fancy diagram that explains the sequence of things taking place here https://github.com/mikavilpas/yazi.nvim/blob/master/dev-documentation/lsp-renaming.md
I have also copied it here to keep it simpler:
sequenceDiagram
participant lsp
participant neovim
participant yazi
neovim->>yazi: open yazi inside neovim
yazi->>yazi: rename files and close
yazi->>neovim: provide rename events
neovim->>lsp: send rename request (willRenameFiles)
lsp->>neovim: changes to related files
neovim->>neovim: apply changes to related files
neovim->>lsp: send 'renaming finished' notification (didRenameFiles)
neovim->>neovim: user saves changes
My hope is that this idea can be reproduced in this project in some way, and that way it can benefit more people in the neovim plugin ecosystem 👍🏻
Hi @mikavilpas. I like the idea. It seems like it's already been implement in a plugin called nvim-lsp-file-operations, which handles deletes as well. I might see about adding Triptych support to that one
PR raised https://github.com/antosha417/nvim-lsp-file-operations/pull/40
This has now been implemented via integration with antosha417/nvim-lsp-file-operations. See readme for details