aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/_range.lua
Commit message (Collapse)AuthorAge
* feat(treesitter)!: incremental injection parsingLewis Russell2023-08-12
| | | | | | | | | | | | | | | | | | | | | Problem: Treesitter highlighting is slow for large files with lots of injections. Solution: Only parse injections we are going to render during a redraw cycle. --- - `LanguageTree:parse()` will no longer parse injections by default and now requires an explicit range argument to be passed. - `TSHighlighter` now parses injections incrementally during on_win callbacks for the line range being rendered. - Plugins which require certain injections to be parsed must run `parser:parse({ start_row, end_row })` before using the tree.
* fix(treesitter): correctly calculate bytes for text sources (#23655)Lewis Russell2023-05-16
| | | Fixes #20419
* refactor(treesitter): add Range type aliase for Range4|Range6Lewis Russell2023-03-11
|
* feat(treesitter)!: consolidate query util functionsLewis Russell2023-03-10
| | | | | | - And address more type errors. - Removed the `concat` option from `get_node_text` since it was applied inconsistently and made typing awkward.
* refactor(treesitter): use byte ranges from treesitter (#22589)Lewis Russell2023-03-09
|
* Revert "refactor(treesitter): delegate region calculation to treesitter" ↵Lewis Russell2023-03-08
| | | | | | | (#22575) Revert "refactor(treesitter): delegate region calculation to treesitter (#22553)" This reverts commit 276b647fdba07bf1762d8dd371c4b655b8a418df.
* refactor(treesitter): delegate region calculation to treesitter (#22553)Lewis Russell2023-03-08
|
* refactor(treesitter): simplify some range functionsLewis Russell2023-03-06
|
* fix(treesitter): typos in _range.luaJaehwang Jung2023-03-03
| | | fix(treesitter): typos _range.lua
* perf(treesitter): smarter languagetree invalidationLewis Russell2023-02-23
Problem: Treesitter injections are slow because all injected trees are invalidated on every change. Solution: Implement smarter invalidation to avoid reparsing injected regions. - In on_bytes, try and update self._regions as best we can. This PR just offsets any regions after the change. - Add valid flags for each region in self._regions. - Call on_bytes recursively for all children. - We still need to run the query every time for the top level tree. I don't know how to avoid this. However, if the new injection ranges don't change, then we re-use the old trees and avoid reparsing children. This should result in roughly a 2-3x reduction in tree parsing when the comment injections are enabled.