Refactoring Tools โ
Problem โ
Renames and structural edits must touch every real occurrence and nothing else โ comments and strings that merely mention a name must be left alone.
Why tree-sitter.zig helps โ
Queries return only structural matches (identifiers in code positions, never inside unrelated tokens), each with an exact byte range to rewrite.
API โ
Query with predicates (#eq? on the old name), Node.range, incremental reparse to verify.
Architecture โ
text
Query old name โ ranges โ apply text edits โ reparse โ no stale matches