Feature Request
Description
Add support for Selection Range (LSP 3.15) in the Angular Language Service to enable smart selection expansion in Angular templates.
Use Case
When working with Angular templates, developers use "Expand Selection" (Ctrl+Shift+Right/Left on Windows/Linux, Cmd+Shift+Right/Left on macOS) to quickly select code structures. The current selection expansion in Angular templates is suboptimal as it doesn't understand the template AST.
With Selection Range support:
- Select a word → Expand to attribute value → Expand to attribute → Expand to element → Expand to parent
- Works intelligently with Angular-specific structures like control flow blocks
Example
@if (user.isAuthenticated) {
<div class="profile">
<span>{{user.name}}</span>
</div>
}
With cursor inside user.name:
- First expand:
user.name
- Second expand:
{{user.name}}
- Third expand:
<span>{{user.name}}</span>
- Fourth expand: entire
<div class="profile">...</div>
- Fifth expand: entire
@if block
Technical Details
- LSP method:
textDocument/selectionRange
- VS Code command: "Expand Selection" / "Shrink Selection"
- Works with both external HTML templates and inline templates in TypeScript files
- Handles Angular-specific nodes:
- Control flow blocks (
@if, @for, @switch, @defer)
- Template syntax (
*ngIf, *ngFor, ng-template)
- Bindings and events (
[property], (event), [(banana)])
Related
Feature Request
Description
Add support for Selection Range (LSP 3.15) in the Angular Language Service to enable smart selection expansion in Angular templates.
Use Case
When working with Angular templates, developers use "Expand Selection" (Ctrl+Shift+Right/Left on Windows/Linux, Cmd+Shift+Right/Left on macOS) to quickly select code structures. The current selection expansion in Angular templates is suboptimal as it doesn't understand the template AST.
With Selection Range support:
Example
@if (user.isAuthenticated) { <div class="profile"> <span>{{user.name}}</span> </div> }With cursor inside
user.name:user.name{{user.name}}<span>{{user.name}}</span><div class="profile">...</div>@ifblockTechnical Details
textDocument/selectionRange@if,@for,@switch,@defer)*ngIf,*ngFor,ng-template)[property],(event),[(banana)])Related