I did some poking around CodeMirror and how it works, particularly with it's current code folding implementation. My goal was to see if there was a way to only have part of the string in memory, render those parts, and still have line numbers be correct. My goal was to have the editor display something like this:
1
2
3 function() {
27 }
28