-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: document how lsp file renaming works
Related: sxyazi/yazi#755
- Loading branch information
1 parent
e134752
commit c6bcb4a
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Lsp file renaming feature | ||
|
||
This document explains how this plugin works with yazi and the LSP (language | ||
server protocol) server to provide renaming functionality for files. | ||
|
||
## What is LSP file renaming? | ||
|
||
Many LSP servers support a feature where the user can rename a file in the | ||
project. The LSP server can help the user by renaming all references to the file | ||
in the project. | ||
|
||
For example, if you have a file that's imported in many other files, you can | ||
rename the file and the LSP server will update all the references to the new | ||
file name. | ||
|
||
## How does this plugin work with LSP file renaming? | ||
|
||
When files are renamed in yazi, this plugin will detect that via events that | ||
yazi sends using its Data Distribution Service (DDS), specifically the | ||
[rename events](https://yazi-rs.github.io/docs/dds/#rename). | ||
|
||
Here is a sequence diagram that shows the different actors and steps involved in | ||
the file renaming process: | ||
|
||
```mermaid | ||
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 | ||
``` |