Fix willRename behavior by afonsocarlos · Pull Request #2494 · phpactor/phpactor · GitHub
Skip to content

Fix willRename behavior#2494

Open
afonsocarlos wants to merge 1 commit into
phpactor:masterfrom
afonsocarlos:master
Open

Fix willRename behavior#2494
afonsocarlos wants to merge 1 commit into
phpactor:masterfrom
afonsocarlos:master

Conversation

@afonsocarlos

Copy link
Copy Markdown

Rename only the original reference as described in WillRenameFiles LSP specifications

@dantleech

dantleech commented Jan 7, 2024

Copy link
Copy Markdown
Collaborator

@afonsocarlos

Copy link
Copy Markdown
Author

Of course, my bad 😅

If you rename a file from within a neovim plugin that supports willRename LSP integration this neovim plugin will request the LSP renaming BEFORE it actually renames the file. Therefore, the TextDocumentLocator can't find any reference to the new file (as it still doesn't exist) and throws an error "Text Document not found".
According to the LSP specifications, we should send a response with the WorkspaceEdits which will be applied to workspace before the files are renamed, so it would make sense to find references for the class references before the rename.

By the way, I tested the rename feature with both nvim-lsp-file-operations and oil.nvim plugins and both broke with the same error from phpactor lsp server

@afonsocarlos

Copy link
Copy Markdown
Author

Have the issue and the solution become clear?

@przepompownia

Copy link
Copy Markdown
Contributor

Rename only the original reference as described in WillRenameFiles LSP
specifications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants