DOM class definitions before viewport establishes them?

I’ve created a minimap scroller, which works great, but gets its syntax highlighted code display from CodeMirror and needs viewportMargin: Infinity in order to grab all the DOM content including spans with classes (variable, atom etc)

As stated in the manual, setting Infinity as the value does have a big hit on performance. It’s fine once loaded, but is causing quite a delay to paint to screen initially on say a 5000 line file.

Is there anywhere else in CodeMirror (even in its internals), where I can get the content with the classes to be applied to areas or is it really on defined when within viewport margin?

You could just compute it separately using the runmode addon

Ah OK, I’ve not really delved into runmode as yet, but sounds ideal for this job, thanks.

Just wanted to say I’ve implemented runMode now instead and it does indeed work brilliantly. Minimap now loading extremely quickly and usable an on a 5000+ line doc. Many thanks Marijn!