Skip to content

added selection range provider support to lsp capabilities#1657

Open
chrisdp wants to merge 1 commit intomasterfrom
feature/selection-ranges-support
Open

added selection range provider support to lsp capabilities#1657
chrisdp wants to merge 1 commit intomasterfrom
feature/selection-ranges-support

Conversation

@chrisdp
Copy link
Contributor

@chrisdp chrisdp commented Mar 24, 2026

Implements the LSP textDocument/selectionRange request, which allows clients to request a set of expanded selection ranges for given cursor positions. Each response is a linked list of ranges from innermost to outermost, giving clients a syntactically-aware path from the cursor outward through the AST.

The server now advertises selectionRangeProvider: true in its capabilities. When a request comes in, it finds the deepest AST node at each position, prepends the exact lexer token range as the tightest step (handling cases like AssignmentStatement.name which is stored as a raw Token rather than a child AST node), then walks the .parent chain collecting each node's range — deduplicating any consecutive identical ranges along the way.

@chrisdp chrisdp added enhancement New feature or request LanguageServer labels Mar 24, 2026
@chrisdp chrisdp requested a review from TwitchBronBron March 26, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request LanguageServer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement grow/shrink selection

1 participant