Adding code folding support to JavaScript files in Visual Studio 2010
Posted: (EET/GMT+2)
Today, an interactive web application without any JavaScript sounds like an oddity. As your JavaScript code grows in length, you will soon notice that at least in Visual Studio 2010, there is no support for code folding or minimizing and expanding blocks of code. In Visual Studio 2012, this feature is part of the new functionality, so it is built-in
Luckily, Visual Studio 2010 can be extended, and for this particular problem, you can download a nice extension from the Visual Studio Gallery. There is a free extension called JScript Editor Extensions that does what you need: adds code folding support to .js files, but also to HTML and ASPX files that have script blocks.
Note that this extension doesn't unfortunately support #region and #endregion blocks, and neither does Visual Studio 2012, it seems. Nonetheless, folding occurs at the block level at every { and } characters, so it's a big step forward nonetheless.
PS. If you are interested in other nice extensions, take a look at the Productivity Power Tools extension, also from Microsoft.
Let's stay productive!