Incremental FAQ โ
How does incremental parsing work? โ
Describe the change as an InputEdit, pass the old tree with the new source to Parser.parse, and unaffected subtrees are spliced in without re-lexing. See Incremental Parsing.
How do I reuse a tree? โ
Keep the old tree alive and hand it to parse โ it is only read, never mutated. copy() snapshots it.
Is the tree reusable? โ
Yes: old trees feed incremental parses, and copy() duplicates them. New trees are independent values.
How do I run a query (on a new tree)? โ
Queries are independent of parsing โ execute against any tree. Reuse compiled queries and cursors across trees.
Why are my changed ranges empty? โ
Same-span substitutions change no positions or structure. Insertions and deletions report normally. See Troubleshooting.
Are included ranges enforced? โ
Yes: setIncludedRanges validates (sorted, non-overlapping) and the lexer skips excluded gaps while keeping document coordinates. See Included Ranges.
