-
Notifications
You must be signed in to change notification settings - Fork 818
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
How to respond to rename request if user cancelled (via a showMessageRequest)? #1104
Comments
I think the right approach is to use So the question for me is how this is best signaled in VS Code itself. @jrieken currently I will convert this into an Error with the name set to |
I think the problem begins with showing a "custom" message with options. You leaving the flow of rename. This is also a problem for scenarios like LiveShare. The cancel-error thing might work for VS Code, worth trying. |
Are there any alternatives for this? I had this functionality in the non-LSP implementation and it was noticed as missing from LSP, so I added this. It doesn't seem like a weird case to want to prompt the user if the rename might introduce errors (though this request was more general - there could be many reasons why a server wants to cancel a request and may wish to communicate this to the user itself instead of making it seem like something has gone wrong at the protocol level). In this case, returning an empty WorkspaceEdit works fine (it's what I've done with for now), though it's just not clear if it's the "best" way.
Can you elaborate? As far as the client knows, there was a rename request and it either returns a rename edit or it returns an empty edit. I wouldn't expect that there was a user prompt somewhere in the middle that influenced that decision to change how the rename would work? It's not much different to a ContentModified response - which I think is already silently dropped by the client. |
Another feature request came up that makes it attractive to prompt the user mid-rename, but it's not clear from the above if it's a bad idea): In this case we don't need to be able to cancel, but we might want to prompt the user (in this case, asking if they want to rename the file when they rename the class inside it). |
I have this scenario:
showMessageRequest
informing the user this will produce an error, with options to "Rename anyway" or "Cancel rename"In this case, if I respond to the original rename request with
RequestCancelled
, VS Code will show an information notification saying it was cancelled. If I returnnull
, it will show an information notification showing "No result":So my next thought is to return a
WorkspaceEdit
that has no changes in it. However, it feels awkward and it's not clear whether this is the correct route.The spec isn't really clear what a
null
response means here (nor is it generally clear when clients should/should not show notifications for some responses). This is just one example, but I can imagine many other types of requests could be cancelled by the user via ashowMessageRequest
, so I think it should be clear how servers should response to requests cancelled in this way (that the client doesn't know were cancelled, because it was server-logic) and how clients should handle that.The text was updated successfully, but these errors were encountered: