Skip to content

Commit

Permalink
docs: document how lsp file renaming works
Browse files Browse the repository at this point in the history
  • Loading branch information
mikavilpas committed Apr 21, 2024
1 parent e134752 commit c6bcb4a
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions dev-documentation/lsp-renaming.md
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
```

0 comments on commit c6bcb4a

Please sign in to comment.