Added Tree.get_changed_ranges — allows comparison of two trees to know the ranges of nodes that changed.
Added optional start and end parameters to Query.{match,capture,exec} — sets the query cursor to be within the specified range.
These changes should allow the incremental parsing TS provides to be better taken advantage of, as users can now incrementally update the information they get from queries.
The code looks good to me. If you could add a quick test that parses some code, makes an edit, gets the ranges, and asserts that they are correct I'd be happy to merge this. Thanks!
Added
Tree.get_changed_ranges
— allows comparison of two trees to know the ranges of nodes that changed. Added optionalstart
andend
parameters toQuery.{match,capture,exec}
— sets the query cursor to be within the specified range.These changes should allow the incremental parsing TS provides to be better taken advantage of, as users can now incrementally update the information they get from queries.