Issue
Old trees are only re-used if the byte ranges match, so a single character can break all trees. The trees are never edited either.
Proposal
We should reparse injection layers incrementally instead, keep the trees, edit them and map the ranges instead of throwing them away. This will save a lot of foreground time in markdown files and other languages with injection layers.
How to test
This is further amplified by multi cursors, e.g. select 8 columns, add some text and then undo. This will reparse injection layers from scratch 8 times.
Issue
Old trees are only re-used if the byte ranges match, so a single character can break all trees. The trees are never edited either.
Proposal
We should reparse injection layers incrementally instead, keep the trees, edit them and map the ranges instead of throwing them away. This will save a lot of foreground time in markdown files and other languages with injection layers.
How to test
This is further amplified by multi cursors, e.g. select 8 columns, add some text and then undo. This will reparse injection layers from scratch 8 times.