microsoft / microsoft/language-server-protocol

How to respond to rename request if user cancelled (via a showMessageRequest)?

Open
#1,104 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clarification rename
Dominant language
TypeScript
Stars
13k
Forks
1k
Avg merge
6d 1h
Merged PRs (30d)
10

Description

I have this scenario:

  • User invokes rename
  • The location is valid, so prepareRename returns normally
  • User enters a name that is already in use (or some other name that would result in invalid code)
  • Server sends a showMessageRequest informing the user this will produce an error, with options to "Rename anyway" or "Cancel rename"
  • User clicks "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 return null, it will show an information notification showing "No result":

Screenshot 2020-10-14 at 16 24 11

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 a showMessageRequest, 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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the specification sections covering rename requests, null results, RequestCancelled, and showMessageRequest responses. Determine how a server-side cancellation should be represented and whether clients should display a notification; done means documenting an unambiguous behavior for this scenario and similar requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.