-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: LSP willRenameFiles: "no such file" (src) error if WorkspaceEdit
response part contained RenameFile
part
#337
Comments
What LSP server is this? It sounds like it's behaving off-spec. If the client sends a "willRenameFiles" message to it, that means that the client is in the process of renaming these files. The server should not try to send back operations that will perform that rename. |
@stevearc thank you for the answer. I will try to explain why I have a different opinion.
The problem is that I didn't find such an assumption in the specification. On the other side I see the presence of the "RenameFile" part in the response (WorkspaceEdit) spec.
Please keep in mind that my English is still poor. In my interpretation of this spec part, both your and my version are allowed. The presence of the "RenameFile" part also seems good from a practical perspective. The response is then complete and the additional rename seems to be redundant. In particular by using the built-in Neovim library I can apply workspace edit directly (as Oil also does). The background is my PR to phpactor/phpactor#2531. It adds the RenameFile part and fixes other things needed to rename. |
The way I would read this is that willRenameFiles can be triggered from either a user action (e.g. renaming a file in oil) or a workspace edit (e.g. a code action). The very next sentence is:
While it does not say it explicitly, this strongly suggests to me that the workspace edit should not include a "rename file" operation, because these edits will be applied "before the files are renamed". The next sentences:
So the clients may end up dropping the workspace edits entirely in order to "keep renames fast and reliable". This is explicitly saying that the client is going to be performing the rename operation, regardless of any workspace edits from the server. Another piece of evidence is that I have not seen any other LSP server respond to |
If the client dropped entirely applying the response containing (or not) |
At the moment I'm not able to quickly create repro with some mock response on
workspace/willRenameFiles
request so I'll try to describe it.RenameFile
partError applying actions: ENOENT: no such file or directory
for the old path.vim.lsp.util.apply_workspace_edit
applieddocumentChanges
(i.e. file has been renamed) - probably we should check if the old file exists.Edit: I used the fresh master of Neovim, but the stable version shouldn't result in any different reproduction for usual cases.
Edit2: severity: minor - the error does not prevent from renaming.
The text was updated successfully, but these errors were encountered: