Implement document symbols to provide an outline/symbol tree for templates.
Symbols to expose:
- Template definitions:
{{define "name"}} and {{block "name"}}
- Variable declarations:
$var := ...
- Control flow blocks:
if, range, with (as a hierarchy)
Symbol kinds (LSP SymbolKind):
- Template definitions → Function (12) or Module (2)
- Variables → Variable (13)
- Control flow → Struct (23) or Namespace (3)
Implementation notes:
- Walk AST and collect symbols with their ranges
- Preserve hierarchy (variables inside templates, etc.)
- Include symbol details like template parameter type if known
LSP methods:
textDocument/documentSymbol - return symbol hierarchy
Implement document symbols to provide an outline/symbol tree for templates.
Symbols to expose:
{{define "name"}}and{{block "name"}}$var := ...if,range,with(as a hierarchy)Symbol kinds (LSP SymbolKind):
Implementation notes:
LSP methods:
textDocument/documentSymbol- return symbol hierarchy