Skip to main content

Module ast

Module ast 

Source
Expand description

AST host capability.

Wraps tree-sitter parsing, symbol extraction, and outline generation. The implementation is fully wired so AST builtins share one canonical wire format.

§Wire format

  • Row/column coordinates are 0-based across all three builtins, matching tree-sitter’s native Point representation. parse_file, symbols, and outline share one convention.
  • parse_file emits a flat node list with parent_id rather than nested children — keeps the wire JSON-serializable without inflating it with object copies.
  • symbols and outline carry a signature string (e.g. "fn foo(bar: i32)") on every entry.

§Languages

language::Language covers TypeScript/TSX, JavaScript/JSX, Python, Go, Rust, Java, C, C++, C#, Ruby, Kotlin, PHP, Scala, Bash, Swift, Zig, Elixir, Lua, Haskell, and R. Adding/dropping languages requires coordinated schema, fixture, and host-bridge updates.

Modules§

api
Programmatic entry point to the AST builtins. Embedders typically go through the registered builtins, but tests and tools that want strongly-typed access can use these helpers directly.

Structs§

AstCapability
AST capability handle. Stateless; tree-sitter parsers are constructed per-call (cheap relative to grammar lookup) so the capability itself has nothing to own.
OutlineItem
One node in a hierarchical outline. The children list nests in document order; see [crate::ast::outline] for the fold algorithm.
ParseError
One ERROR / MISSING node from a tree-sitter parse. All row/column coordinates are 0-based, matching tree-sitter’s native Point.
ParsedNode
One tree-sitter node, flattened for parse_file’s wire format. Matches schemas/ast/parse_file.response.json#/$defs/Node.
Symbol
A flat symbol record. All row/col coordinates are 0-based, matching tree-sitter native positions.
UndefinedName
Reference to an identifier that wasn’t defined within the current file. Coordinates are 0-based. kind is "identifier" for value-side references and "type" for type-only references (TypeScript only).

Enums§

Language
Languages with tree-sitter symbol extraction support.
SymbolKind
Symbol kind. The wire form is the lowercase string returned by SymbolKind::as_str.