lazy-loading data for very large files (>100MB)


#1

Hello,

I’m interested in using codemirror to look at very large files (>100MB) because of the file size I’d rather use a lazy-loading/infinite-scroll method to only load the data displayed on the screen from the server with HTTP Range requests.

Is it possible to use codemirror in this way where only a subset of the total text is loaded and loading on-demand ? If so what would be the best way to implement this ? (bonus points for being able to show the full scroll bar and being able to scroll really fast)

Did


#2

No, this isn’t something that CodeMirror handles. You could probably hack something on top of the editor, for example by putting a DOM widget with the approximate height of the unloaded content below the loaded document, and replacing parts of that with lazily loaded content as it comes into view, but you’ll have to write the magic yourself.


#3

Thanks for the quick answer, that’s what I thought.
Do you know of any example of something like this ?


#4

Nope, I’m not aware of an existing implementation.


#5

I see how I could artificially modify the size of the scrollbar, what I’m not too sure about is if the user is looking at the begin of the file and then jumps in the middle, all data between the start and middle would not be loaded (and probably the start data would be removed), how do I get codemirror to show the correct line numbers ?


#6

You could use this or this.