feat: incremental highlight #111

Closed
opened 2026-02-11 17:10:19 +00:00 by phanen · 3 comments
phanen commented 2026-02-11 17:10:19 +00:00

Prerequisites

Problem

I notice treesitter hl make thing a bit slow on large file. (when there's hundred of hunks/injections)

I make a branch to highlight only on-screen content first: https://github.com/phanen/diffs.nvim/tree/faster

But it have a bit flicker. But maybe worth exploration.

Proposed solution

.

Alternatives considered

.

closes #108

### Prerequisites - [x] I have searched [existing issues](https://github.com/barrettruth/diffs.nvim/issues) ### Problem I notice treesitter hl make thing a bit slow on large file. (when there's hundred of hunks/injections) I make a branch to highlight only on-screen content first: https://github.com/phanen/diffs.nvim/tree/faster But it have a bit flicker. But maybe worth exploration. ### Proposed solution . ### Alternatives considered . closes #108
barrettruth commented 2026-02-11 17:15:16 +00:00

@phanen hm. obviously, fantastic idea. do you think the flicker is genuinely avoidable in any way?

Throw some ideas at me. May be worth considering before we implement such solution.

@phanen hm. obviously, fantastic idea. do you think the flicker is genuinely avoidable in any way? Throw some ideas at me. May be worth considering before we implement such solution.
phanen commented 2026-02-11 17:28:34 +00:00

Not sure. iirc nvim_set_decoration_provider() is also used for builtin semantic token/builtin treesitter implementation, but both they have flicker issue, just more or less. We can reduce it as much as possible I think, will explore when I have more time.

Actually the main issue I want to resolve is it's slow on enter the fugitive diff buffer (highlight is called 3 times for me (in different autocmd), each time cost ~500ms).

... when I frequently navigate between alternate file (:e #, even with :b #), the block is also frequent.

Not sure. iirc `nvim_set_decoration_provider()` is also used for builtin semantic token/builtin treesitter implementation, but both they have flicker issue, just more or less. We can reduce it as much as possible I think, will explore when I have more time. Actually the main issue I want to resolve is it's slow on enter the fugitive diff buffer (highlight is called 3 times for me (in different autocmd), each time cost ~500ms). ... when I frequently navigate between alternate file (`:e #`, even with `:b #`), the block is also frequent.
barrettruth commented 2026-02-11 19:39:26 +00:00

Thanks. Not surprised as I was definitely just iterating on this and making sure things are highlighted as a baseline. I edited your issue to close #108 (since, well, it ought to).

Thanks. Not surprised as I was definitely just iterating on this and making sure things are highlighted as a baseline. I edited your issue to close #108 (since, well, it ought to).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/diffs.nvim#111
No description provided.