Is there any way to control the start time of an overlay tokenization? Another option would be to prevent the overlay from running, and then activate it later. Removing and adding the overlay causes whole document to be processed twice, so this doesn't really help.
Background: I'm building a code editor where tokenization depends on re-evaluating the code, which is delayed to keep the editor responsive.
Tokenization (including applying overlays) happens on-demand, as the display is being kept up-to-date. If you add an overlay, it will immediately be applied to the visible content. If you don't want that to happen yet, don't apply the overlay yet. (If you are trying to optimize re-tokenization, you might be able to use
operation
to prevent display updates between a (synchronous) set of API calls).