ast-grep bindings add named-child access
Introduced 2026-08-23 · score 0.90
HOW TO USE IT
When traversing a parsed source tree, call `namedChildren()` in the WebAssembly or napi binding, or `named_children()` in PyO3, to get named AST nodes only.
const nodes = root.namedChildren()named = node.named_children()WHY THIS HELPS
Traverse AST nodes through ast-grep's WebAssembly, napi, or PyO3 binding while working with a source tree.
REQUIREMENTS AND LIMITATIONS
- Version: 0.45.2
- namedChildren() (required): Returns an array of named AST child nodes; takes no parameters.
- named_children() (required): Returns a list of named AST child nodes; takes no parameters.
- Prerequisite: WebAssembly: install `@ast-grep/wasm` and its `web-tree-sitter` peer dependency; initialize the runtime and register a parser for the language before parsing.
- Prerequisite: PyO3: install the Python library with `pip install ast-grep-py`.
FIRST-PARTY EVIDENCE
- https://github.com/ast-grep/ast-grep/releases/tag/0.45.2
- https://ast-grep.github.io/guide/api-usage/wasm-api
- https://ast-grep.github.io/guide/api-usage/py-api
Check the installed version and the source before using it. Entry JSON