vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Semantic tokens are causing a large changed range onTokensChanged event to fire

Open Tyriar opened this issue 1 year ago • 0 comments

I was working on https://github.com/microsoft/vscode/issues/227107 which involves listening to various view events and updating a cache. But I'm running into this problem where I want to clear all lines when new tokens come in, but it seems that a large range is being fired as changed when scrolling stops.

Here are a few logs that show that when scrolling only a single write occurs (the new line), 1 for each of the 2 mirrored buffers sent to the GPU. But when I stop scrolling I need to clear 33 lines from the cache (approximately the height of the viewport):

Image

This is where the event originates after scrolling stops:

Image

Image

Would it be possible to tighten this to only fire for the ranges that actually change? AFAICT it's not changing any tokens.

Tyriar avatar Nov 15 '24 19:11 Tyriar