Add code folding capability to editor. This has to be document type sensitive and not for all document types this can be done.
Lexers can be used extensively to detect tokens and language specific blocks like methods, loops etc. Refer Netbeans code folding functionality (complex one) or Notepad++ code folding functionality (simple one).
This might have performance impact on editing documents.