Skip to main content

Module query

Module query 

Source
Expand description

Host-side tree-sitter query helper.

Built-in plugins receive ctx.tree and ctx.ts_language and can run tree-sitter S-expression queries directly via run_query. WASM plugins go through the tree_query host import (see crate::wasm) — both paths ultimately call this helper.

Lines in QueryMatch are 1-based to match FunctionInfo / ClassInfo / CommentInfo. Columns are 0-based byte offsets.

Structs§

QueryMatch

Functions§

node_to_match
1-based lines (matches FunctionInfo convention).
run_queries
run_query
Outer Vec = each pattern match, inner = captures within that match (in capture-list order). Empty on pattern compile error rather than panic — pattern strings can come from external plugins.