perf(highlight): allow decoration providers to skip ranges without data

Continuing the work of #31400

That PR allowed the provider to be invoked multiple times per line.
We want only to do that when there actually is more data later on the
line. Additionally, we want to skip over lines which contain no new
highlight items. The TS query cursor already tells us what the next
position with more data is, so there is no need to reinvoke the range
callback before that.

NB: this removes the double buffering introduced in #32619 which
is funtamentally incompatible with this (nvim core is supposed to keep
track of long ranges by itself, without requiring a callback reinvoke
blitz). Need to adjust the priorities some other way to fix the same issue.
This commit is contained in:
bfredl
2025-08-29 12:22:25 +02:00
parent 1cb1cfead0
commit f9d2115a35
9 changed files with 133 additions and 106 deletions

View File

@@ -1051,6 +1051,13 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start,
/// ```
/// ["range", winid, bufnr, begin_row, begin_col, end_row, end_col]
/// ```
///
/// In addition to returning a boolean, it is also allowed to
/// return a `skip_row, skip_col` pair of integers. This implies
/// that this function does not need to be called until a range
/// which continues beyond the skipped position. A single integer
/// return value `skip_row` is short for `skip_row, 0`
///
/// - on_end: called at the end of a redraw cycle
/// ```
/// ["end", tick]