You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VS Code has proposed a smart selection API (microsoft/vscode#63935) that allows language extensions to intelligently control how selections are expanded and collapsed.
If the user starts with their cursor in the a in a === b expression, progressively running expand selection may result in the following selections:
The identifier a
The expression a === b
The body of the bar method
The entire bar method declaration
The entire Foo class
The exact selections we want may differ.
You can find the current state of the VS Code API proposal in vscode.proposed.d.ts under the name selection range provider
Proposal
I think we should investigate supporting smart select for JavaScript and TypeScript users, but do so in a cross editor compatible way. The current proposal is derived from VS Code's needs so we should make sure it will work for other editors too
The current VS Code smart selection API proposal takes a position in a document and returns a list of potential expansion ranges. Each returned range also has some metadata about the range's kind (class, expression, statement, interface, ...)
On the TS Server side, a possible API would be:
interfaceSelectionRangeRequestextendsFileLocationRequest{command: "selectionRanges";arguments: SelectionRangeRequestArgs;}interfaceSelectionRangeRequestArgsextendsFileLocationRequestArgs{}interfaceSelectionRangeResponse{body?: ReadOnlyArray<SelectionRange>;}interfaceSelectionRange{textSpan: TextSpan;kind: SelectionKind;}// Either enum or string?// VS Code has proposed a dot separated scope: expression.identifier, statement.ifenumSelectionKind{Expression,Statement,Class}
We also need to determine which selection ranges we should target for a first iteration. A few basic ones: