-
Notifications
You must be signed in to change notification settings - Fork 781
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
Clarify responses to rename request. #616
Conversation
The main goal is to clarify how the `null` value should be used. Currently it is not clear in what cases server is allowed to return it, and how clients should interpret it.
Why?First, let me explain why I would like to add this clarification here. ~2 months ago I was playing with RLS (Rust language server) and vim-lsp (client for vim) and I found that rename was not a great user experience. Here is why:
This means that when I tried to rename something and it failed, I had no message telling me that something failed. From the client (vim-lsp) perspective, it is not clear how to interpret the AlternativeIn my Pull Request, I went with the proposal of treating If this one is preferred, I would propose:
After writing this explanation, I am slightly starting to lean toward the alternative proposal, but I will wait for the feedback first. |
@@ -4063,8 +4063,8 @@ interface RenameParams { | |||
``` | |||
|
|||
_Response_: | |||
* result: [`WorkspaceEdit`](#workspaceedit) \| `null` describing the modification to the workspace. | |||
* error: code and message set in case an exception happens during the rename request. | |||
* result: [`WorkspaceEdit`](#workspaceedit) \| `null` describing the modification to the workspace. `null` should be treated the same was as [`WorkspaceEdit`](#workspaceedit) with no changes, and should only be returned when `newName` is the same as the old name (no change was required). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "the same way as".
* result: [`WorkspaceEdit`](#workspaceedit) \| `null` describing the modification to the workspace. | ||
* error: code and message set in case an exception happens during the rename request. | ||
* result: [`WorkspaceEdit`](#workspaceedit) \| `null` describing the modification to the workspace. `null` should be treated the same was as [`WorkspaceEdit`](#workspaceedit) with no changes, and should only be returned when `newName` is the same as the old name (no change was required). | ||
* error: code and message set in case when rename could not be performed for any reason. Examples include: there is nothing at given `position` to rename (like a space), given symbol does not support renaming by the server or the code is invalid (e.g. does not compile). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use either "in case" or "when", not both.
@doriath there is now a Can you adjust the PR accordingly ? |
dbaeumer@ I agree that there is now Just so that I understand, is there another case where null / empty edit could be returned, other than newName equal oldName? |
@doriath there is a difference between a rename request at an invalid position. In this case a server should return an error. If it did nothing (for whatever reason) then it should return null or an [] array. |
Merged by hand into 3.17. |
The main goal is to clarify how the
null
value should be used.Currently it is not clear in what cases server is allowed to return it,
and how clients should interpret it. #566