diff options
| author | L Lllvvuu <git@llllvvuu.dev> | 2023-09-16 02:48:49 -0700 |
|---|---|---|
| committer | Lewis Russell <me@lewisr.dev> | 2023-09-16 13:52:42 +0100 |
| commit | 07080f67fe7e526576d5d50777fb122a99b3e183 (patch) | |
| tree | f26ba869b3828683ce5936ddce3fd67d7c5b788b /runtime/doc | |
| parent | 091b57d766a48768ca97240a0ec8f63d2c1aaac0 (diff) | |
| download | rneovim-07080f67fe7e526576d5d50777fb122a99b3e183.tar.gz rneovim-07080f67fe7e526576d5d50777fb122a99b3e183.tar.bz2 rneovim-07080f67fe7e526576d5d50777fb122a99b3e183.zip | |
perf(treesitter): do not scan past given line for predicate match
Problem
---
If a highlighter query returns a significant number of predicate
non-matches, the highlighter will scan well past the end of the window.
Solution
---
In the iterator returned from `iter_captures`, accept an optional
parameter `end_line`. If no parameter provided, the behavior is
unchanged, hence this is a non-invasive tweak.
Fixes: #25113 nvim-treesitter/nvim-treesitter#5057
Diffstat (limited to 'runtime/doc')
| -rw-r--r-- | runtime/doc/treesitter.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 64b4ca7ca2..ee34c45cce 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -976,8 +976,8 @@ Query:iter_captures({node}, {source}, {start}, {stop}) • {stop} (integer) Stopping line for the search (end-exclusive) Return: ~ - (fun(): integer, TSNode, TSMetadata): capture id, capture node, - metadata + (fun(end_line: integer|nil): integer, TSNode, TSMetadata): capture id, + capture node, metadata *Query:iter_matches()* Query:iter_matches({node}, {source}, {start}, {stop}, {opts}) |