diff options
author | Jaehwang Jung <tomtomjhj@gmail.com> | 2024-03-02 23:21:53 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-02 15:21:53 +0100 |
commit | dc8c086c7e73a9035c34be6416e7c465d61edc0e (patch) | |
tree | 1245199c87904a96e2d37ac14893a1cb11a7ce51 /runtime/doc | |
parent | 0d553c83474b8d024d74e9f66b77dc62380241ef (diff) | |
download | rneovim-dc8c086c7e73a9035c34be6416e7c465d61edc0e.tar.gz rneovim-dc8c086c7e73a9035c34be6416e7c465d61edc0e.tar.bz2 rneovim-dc8c086c7e73a9035c34be6416e7c465d61edc0e.zip |
fix(lsp): directly rename the existing buffers when renaming (#27690)
Problem:
`vim.lsp.util.rename()` deletes the buffers that are affected by
renaming. This has undesireable side effects. For example, when renaming
a directory, all buffers under that directory are deleted and windows
displaying those buffers are closed. Also, buffer options may change
after renaming.
Solution:
Rename the buffers with :saveas.
An alternative approach is to record all the relevant states and restore
it after renaming, but that seems to be more complex. In fact, the older
version was attempting to restore the states but only partially and
incorrectly.
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/lsp.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index d78189780d..511fb590cc 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -2068,6 +2068,14 @@ preview_location({location}, {opts}) *vim.lsp.util.preview_location()* rename({old_fname}, {new_fname}, {opts}) *vim.lsp.util.rename()* Rename old_fname to new_fname + Existing buffers are renamed as well, while maintaining their bufnr. + + It deletes existing buffers that conflict with the renamed file name only + when + • `opts` requests overwriting; or + • the conflicting buffers are not loaded, so that deleting thme does not + result in data loss. + Parameters: ~ • {old_fname} (`string`) • {new_fname} (`string`) |