Query executes a tree-sitter query on a specific Node. Nodes captured by the query are passed one at a time to the provided callback function. See https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries for query syntax documentation.
(query string, fn func(*Node))
| 372 | // See https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries |
| 373 | // for query syntax documentation. |
| 374 | func (n *Node) Query(query string, fn func(*Node)) { |
| 375 | n.QueryMulti(query, func(qr QueryResult) { |
| 376 | for _, n := range qr { |
| 377 | fn(n) |
| 378 | } |
| 379 | }) |
| 380 | } |
| 381 | |
| 382 | // QueryResult is a map of capture names to the corresponding nodes that they matched |
| 383 | type QueryResult map[string]*Node |
no test coverage detected