Evergreen-lxl / Evergreen.lxl

🌳 Treesitter support for Lite XL.
MIT License
35 stars 7 forks source link

fix: incremental highlighting #44

Closed xcb-xwii closed 1 year ago

xcb-xwii commented 1 year ago
  1. Fix issue where all lines after the edited line gets re-tokenised, because we return a new table for state instead of simply returning the one given in the params.
  2. Refactor how we calculate the start byte for edits since the old way involved obtaining a slice of a table, which is not necessary.
  3. Fix the oversight of nodes with predicates not being reported as changed when the predicate changes. We work around this by triggering re-tokenisation of all other lines the nodes on the changed line reside upon.
  4. Temporary workaround to get source text due to ltreesitter giving rubbish values.
xcb-xwii commented 1 year ago

The fix for rubbish values does degrade performance a bit, but honestly, since upstream is taking so long to respond, I think we should just merge it for now. Better to have something usable than wait for a fix indefinitely.