[Feature] Use a function to selectively update highlights
Groctel opened this issue · 0 comments
Is your feature request related to a problem? Please describe.
Right now, providers can be updated when a function returns true
or when an autocmd is triggered, but hl
functions are run every single iteration the statusline is drawn. I think it would be great for performance to only run the highlight functions when the provider is updated.
Describe the solution you'd like
Use the provider.update
field to also decide when the hl
function should be called. Since the field now affect an element in an parent context, it should be moved to the component table, which would most probably start an architectural refactor that would also let the user define a local function provider with an update strategy. It's a big update, but I would personally love it.
Describe alternatives you've considered
An hl.update
field could also be used, but since hl
is already a table, checking the fields could be more cumbersome both for the maintainers and the users.
Additional context
I don't have time right now because I'm in the middle of my uni exams, but I can write a PR in the close future. I'm reporting it first just in case the solution is not welcome and no one's time is wasted :p