Is there a more efficient approach to updating decorations when the document changes than scanning the entire document?

If there’s a way to change the decorations when the document changes without having to re-process the entire document upon every change, I’m overlooking it. Is there some approach to this?

Depends on what you need to decorate. Mapping the decorations and only scanning near changes should be possible. But in general doing a scan over the document is also not going to be very expensive.

Thanks for your reply. My concern is mostly that we have say 5 types of decorations which each are managed in their own plugins. Is worrying about those premature optimization, or does this become something to worry about at a certain point?

Measure it, I would say.

1 Like