There is a way to do this in VS2008: select the section of code that you want to collapse, then press the chord Ctrl-M+H
I use this quite a bit when editing javascript files, but unfortunately it is not permanent - javascript code will return to its regular self if you close and reopen the file. In the past, I had js files for several weeks in the editor, just so as not to lose all the carefully crafted folding regions.
source share