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
Pointrepresentation.parse_file,symbols, andoutlineshare one convention. parse_fileemits a flat node list withparent_idrather than nested children — keeps the wire JSON-serializable without inflating it with object copies.symbolsandoutlinecarry asignaturestring (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.
- Outline
Item - One node in a hierarchical outline. The
childrenlist nests in document order; see [crate::ast::outline] for the fold algorithm. - Parse
Error - One ERROR / MISSING node from a tree-sitter parse. All row/column coordinates are 0-based, matching tree-sitter’s native Point.
- Parsed
Node - One tree-sitter node, flattened for
parse_file’s wire format. Matchesschemas/ast/parse_file.response.json#/$defs/Node. - Symbol
- A flat symbol record. All row/col coordinates are 0-based, matching tree-sitter native positions.
- Undefined
Name - Reference to an identifier that wasn’t defined within the current
file. Coordinates are 0-based.
kindis"identifier"for value-side references and"type"for type-only references (TypeScript only).
Enums§
- Language
- Languages with tree-sitter symbol extraction support.
- Symbol
Kind - Symbol kind. The wire form is the lowercase string returned by
SymbolKind::as_str.