Feature Request: Document Symbols support for Angular templates
✅ Status: Implemented in PR #66690
Description
The Angular Language Service should provide Document Symbols for Angular templates to enhance IDE features like the Outline panel, breadcrumbs navigation, and "Go to Symbol" (Cmd+Shift+O / Ctrl+Shift+O).
Implementation
PR #66690 implements comprehensive Document Symbols support including:
Features
- Block syntax:
@if, @for, @switch, @defer, @let with their expressions
- Structural directives:
*ngIf, *ngFor, *ngSwitch with their expressions
- Context variables: Loop items, aliases (
let i = $index), expression aliases (as alias)
- Template references:
#ref variables
- HTML elements: With semantically appropriate icons
- Hybrid approach: Default shows only component classes with templates (configurable)
SymbolKind Mapping
| Template Element |
SymbolKind |
Icon |
@if, @switch |
Struct |
🔶 |
@for |
Array |
📦 |
@defer |
Event |
⚡ |
| HTML elements |
Object |
🟡 |
| Variables |
Variable |
|
Configuration
{
// Disable Angular document symbols
"angular.documentSymbols.enabled": false,
// Show implicit @for variables ($index, $count, etc.)
"angular.documentSymbols.showImplicitForVariables": true,
// Show all TypeScript symbols (methods, properties)
"angular.documentSymbols.showTypescriptSymbols": false
}
Default Output (Hybrid Approach)
MyComponent (class)
└── (template)
├── @if (condition)
└── <button>
With showTypescriptSymbols: true
MyComponent (class)
├── ngOnInit (method)
├── onClick (method)
├── someProperty (property)
└── (template)
├── @if (condition)
└── <button>
Example
Template:
@for (item of items; track item.id; let i = $index) {
@if (item.visible; as isVisible) {
<div #container>{{ item.name }}</div>
}
}
Outline:
@for (item of items) 📦
├── let item
├── let i
├── @if (item.visible; as isVisible) 🔶
│ ├── let isVisible
│ └── <div> 🟡
│ └── #container
Motivation
- Improved navigation: Quickly jump to any template element
- Better overview: Understand template structure at a glance
- Consistency: Match experience with TypeScript code navigation
- Modern Angular: Full support for new control flow syntax
Labels
area: language-service
feature
vscode-extension
Feature Request: Document Symbols support for Angular templates
✅ Status: Implemented in PR #66690
Description
The Angular Language Service should provide Document Symbols for Angular templates to enhance IDE features like the Outline panel, breadcrumbs navigation, and "Go to Symbol" (Cmd+Shift+O / Ctrl+Shift+O).
Implementation
PR #66690 implements comprehensive Document Symbols support including:
Features
@if,@for,@switch,@defer,@letwith their expressions*ngIf,*ngFor,*ngSwitchwith their expressionslet i = $index), expression aliases (as alias)#refvariablesSymbolKind Mapping
@if,@switch@for@deferConfiguration
{ // Disable Angular document symbols "angular.documentSymbols.enabled": false, // Show implicit @for variables ($index, $count, etc.) "angular.documentSymbols.showImplicitForVariables": true, // Show all TypeScript symbols (methods, properties) "angular.documentSymbols.showTypescriptSymbols": false }Default Output (Hybrid Approach)
With
showTypescriptSymbols: trueExample
Template:
@for (item of items; track item.id; let i = $index) { @if (item.visible; as isVisible) { <div #container>{{ item.name }}</div> } }Outline:
Motivation
Labels
area: language-servicefeaturevscode-extension