Skip to content
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

client->server request: matching brace #999

Closed
matklad opened this issue May 24, 2020 · 3 comments
Closed

client->server request: matching brace #999

matklad opened this issue May 24, 2020 · 3 comments
Labels
feature-request Request for new features or functionality new request

Comments

@matklad
Copy link
Contributor

matklad commented May 24, 2020

Another request from rust-analyzer

Matching Brace

Server Capability: { "matchingBrace": boolean }

This request is send from client to server to handle "Matching Brace" editor action.

Method: experimental/matchingBrace

Request:

interface MatchingBraceParams {
    textDocument: TextDocumentIdentifier,
    /// Position for each cursor
    positions: Position[],
}

Response:

Position[]

Example

fn main() {
    let x: Vec<()>/*cursor here*/ = vec![]
}

experimental/matchingBrace yields the position of <.
In many cases, matching braces can be handled by the editor.
However, some cases (like disambiguating between generics and comparison operations) need a real parser.
Moreover, it would be cool if editors didn't need to implement even basic language parsing

Unresolved Question

  • Should we return a a nested brace structure, to allow paredit-like actions of jump out of the current brace pair?
    This is how SelectionRange request works.
  • Alternatively, should we perhaps flag certain SelectionRanges as being brace pairs?
@matklad
Copy link
Contributor Author

matklad commented May 24, 2020

This basically documents what rust-analyzer is doing today, but now I lean towards the last alternative for the general protocol -- just stuffing info about braces into SelectionRange request.

@dbaeumer dbaeumer added the feature-request Request for new features or functionality label May 26, 2020
@dbaeumer dbaeumer added this to the Backlog milestone May 26, 2020
@dbaeumer
Copy link
Member

@jrieken FYI.

@dbaeumer
Copy link
Member

Dups #672.

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 27, 2020
@dbaeumer dbaeumer removed this from the Backlog milestone Nov 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality new request
Projects
None yet
Development

No branches or pull requests

2 participants