I am experimenting with syntax highlighting (using decorations, very similar to lint example). For smaller document it works fine. But when document is a bit larger it takes longer time to load it. Because it is doing everything (loading document and highlight), so ‘tasks’ that need to be done are sync. A lot of editors split tasks, so user has better experience. User can see that ‘it is doing something’ and have incremented results, instead of waiting longer time with ‘nothing state’ and then ‘boom, here we go with everything’.
My question is, is it possible to split tasks? Or make them async? Or enable plugins ‘onload’. If so how?
In this simple scenario there would be 3 tasks:
- load the editor
- load hole document
- when editor is ready, run syntax highlighting (or enable syntax plugin)
- then words are highlighted, show in toolbar how word are in document or so.
Thanks for an advise.