ops/:kind
TreeSitter node kind matching
clojure
(:kind val)Where:
- val: TreeSitter node kind to match *
Behavior
- Matches nodes by their TreeSitter grammar kind name (e.g., 'identifier', 'string_node', 'call_expression').
- Useful as an escape hatch when SYNG doesn't expose a specific node type as a selector, or when you need language-specific matching.
- Kind names are grammar-specific and may differ between languages (JavaScript's 'identifier' vs Rust's 'scoped_identifier').
Examples
Extract TODO and FIXME comments from code for issue tracking.
clojure
(:and (:kind /comment/) (:text /TODO|FIXME/))Selects in lines { 1, 2 } but not in { 3, 4 }:
typescript
// TODO: optimize this algorithm
/* FIXME: handle edge case */
// Regular comment
const x = 1;Locate Rust token trees that aren't parsed into structured macro bodies.
clojure
(:kind "token_tree")Selects in lines { 2 } but not in { }:
typescript
macro_rules! m {
() => { Foo::Bar }
}Match TypeScript-specific type annotation nodes.
clojure
(:kind "type_annotation")Selects in lines { 1, 1 } but not in { }:
typescript
function f(x: number): string {
return String(x);
}Arguments
val
• String • Pattern
Does NOT support: Composition — Free-form Selection — Refinement — Replacement