Skip to content

Add textDocument/documentSymbol support #28

@Jason-Abbott

Description

@Jason-Abbott

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions