euclidianAce / ltreesitter

Standalone tree sitter bindings for the Lua language
MIT License
85 stars 4 forks source link

Add facilities for incremental parsing #12

Closed xcb-xwii closed 1 year ago

xcb-xwii commented 1 year ago

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.

euclidianAce commented 1 year ago

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!