I have a viewPlugin that adds decorations to lines. On every update it creates the decorations.
If I’m scrolling through a large document it causes problems as it’s running while the scrolling is happening. I’d like it to wait until scrolling has finished or timeout after scrolling.
Is the best place to add decorations in the update method of a ViewPlugin?
If so, how should I detect if the user is scrolling from within that update method?
View updates with no document changes but a viewport change are likely to be scroll updates. But there’s no precise way to tell.
In case anyone else finds this useful I had a gutter that held pages numbers and could increase in width due to the increase in the size of the numbers, 1 is wider that 100. This change of width while scrolling caused issues with rendering when using the scroll bar and moving quickly through a large document. Setting the gutter width vastly improved things.