mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
perf(treesitter): parse multiple ranges in languagetree, eliminate flickering #36503
**Problem:** Whenever `LanguageTree:parse()` is called, injection trees from previously parsed ranges are dropped. **Solution:** Allow the function to accept a list of ranges, so it can return injection trees for all the given ranges. Co-authored-by: Jaehwang Jung <tomtomjhj@gmail.com>
This commit is contained in:
@@ -340,6 +340,7 @@ TREESITTER
|
||||
|
||||
• |Query:iter_captures()| supports specifying starting and ending columns.
|
||||
• |:EditQuery| command gained tab-completion, works with injected languages.
|
||||
• |LanguageTree:parse()| now accepts a list of ranges.
|
||||
|
||||
TUI
|
||||
|
||||
|
||||
@@ -1345,7 +1345,9 @@ LanguageTree:is_valid({exclude_children}, {range})
|
||||
Parameters: ~
|
||||
• {exclude_children} (`boolean?`) whether to ignore the validity of
|
||||
children (default `false`)
|
||||
• {range} (`Range?`) range to check for validity
|
||||
• {range} (`Range|Range[]?`) range (or list of ranges,
|
||||
sorted by starting point in ascending order) to
|
||||
check for validity
|
||||
|
||||
Return: ~
|
||||
(`boolean`)
|
||||
@@ -1421,11 +1423,12 @@ LanguageTree:parse({range}, {on_parse}) *LanguageTree:parse()*
|
||||
if {range} is `true`).
|
||||
|
||||
Parameters: ~
|
||||
• {range} (`boolean|Range?`) Parse this range in the parser's
|
||||
source. Set to `true` to run a complete parse of the
|
||||
source (Note: Can be slow!) Set to `false|nil` to only
|
||||
parse regions with empty ranges (typically only the root
|
||||
tree without injections).
|
||||
• {range} (`boolean|Range|Range[]?`) Parse this range (or list of
|
||||
ranges, sorted by starting point in ascending order) in
|
||||
the parser's source. Set to `true` to run a complete parse
|
||||
of the source (Note: Can be slow!) Set to `false|nil` to
|
||||
only parse regions with empty ranges (typically only the
|
||||
root tree without injections).
|
||||
• {on_parse} (`fun(err?: string, trees?: table<integer, TSTree>)?`)
|
||||
Function invoked when parsing completes. When provided and
|
||||
`vim.g._ts_force_sync_parsing` is not set, parsing will
|
||||
|
||||
Reference in New Issue
Block a user