diff options
| author | bfredl <bjorn.linse@gmail.com> | 2025-08-29 12:22:25 +0200 |
|---|---|---|
| committer | bfredl <bjorn.linse@gmail.com> | 2025-09-09 12:54:04 +0200 |
| commit | f9d2115a359c7846056bb2eb31f9eae818c6d510 (patch) | |
| tree | 3f64199641f291e6ee9d84f6018dbca9207754bd /runtime/lua/vim/_meta/api.lua | |
| parent | 1cb1cfead017df79aa590d1d297b116a85cb31c0 (diff) | |
| download | rneovim-f9d2115a359c7846056bb2eb31f9eae818c6d510.tar.gz rneovim-f9d2115a359c7846056bb2eb31f9eae818c6d510.tar.bz2 rneovim-f9d2115a359c7846056bb2eb31f9eae818c6d510.zip | |
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.
Diffstat (limited to 'runtime/lua/vim/_meta/api.lua')
| -rw-r--r-- | runtime/lua/vim/_meta/api.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 61e4a28704..abda4dead0 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -2175,6 +2175,13 @@ function vim.api.nvim_set_current_win(window) end --- ``` --- ["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] |