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

@@ -38,10 +38,11 @@ typedef struct {
} while (0)
typedef enum {
kRetObject, ///< any object, but doesn't preserve nested luarefs
kRetObject, ///< any object, but doesn't preserve nested luarefs
kRetNilBool, ///< NIL preserved as such, other values return their booleanness
///< Should also be used when return value is ignored, as it is allocation-free
kRetLuaref, ///< return value becomes a single Luaref, regardless of type (except NIL)
kRetLuaref, ///< return value becomes a single Luaref, regardless of type (except NIL)
kRetMulti, ///< like kRetObject but return muliple return values as an Array
} LuaRetMode;
/// Maximum number of errors in vim.ui_attach() and decor provider callbacks.