update
Recompute the styled AnnotatedString for newCode using theme.
Branches on engine state:
First call: equivalent to highlight — full parse + full query iteration.
newCode == oldCode: theme-only short-circuit — re-resolves the cached captures through theme without re-parsing.Otherwise: tree-sitter incremental parse + scoped query over the affected byte range.
The incremental branch mutates captureSpans, oldTree, and the underlying tree-sitter Tree in several stages. Today those mutations cannot be interrupted mid-call — Parser.timeoutMicros is not exposed by the engine, so a partially updated state is unreachable in practice. If a future change exposes cancellation, the engine must be extended to roll back to its pre-call state on interrupt; that rollback contract is aspirational, not satisfied by the current implementation.
Throws
if close has already been called.