Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically open regions in Visual Studio 2010

I'd like the regions that show up in my Visual Studio window to be expanded by default when I open a code file. Is this possible in VS2010, or is there an extension that will do that for me?

Barring that, is my request a thing that can be written in an extension?

like image 402
thepaulpage Avatar asked Sep 17 '10 18:09

thepaulpage


People also ask

How do I open all regions in Visual Studio?

CTRL + M + P will expand all and disable outlining. CTRL + M + M will collapse/expand the current section.

How do I close all regions in Visual Studio?

(Ctrl+M, Ctrl+P) - Removes all outlining information for the entire document. (Ctrl+M, Ctrl+U) - Removes the outlining information for the currently selected user-defined region. Not available in Visual Basic. (Ctrl+M, Ctrl+O) - Collapses the members of all types.

How do I enable outlining in Visual Studio?

Tools -> Options -> Text Editor -> C# -> Advanced -> Outlining. Show activity on this post. Show activity on this post. For VS2008, it's under Tools – Options – Text Editor – C/C++ - Formatting - Enter outlining mode when files open.


2 Answers

If you would like Regions turned off, right click any code window, choose Outlining, then Stop Outlining.

like image 81
Daniel A. White Avatar answered Sep 30 '22 12:09

Daniel A. White


you could write a macro that calls the Visual Studio Command Edit.StopOutlining for you every time you are opening a document.

This MSDN Page describes how to write a basic macro that handles events: http://msdn.microsoft.com/en-us/library/ee1f34as.aspx Instead of handle the WindowClosing you should handle WindowActivated.

Like this:

Public Sub windowopen(ByVal window As EnvDTE.Window, ByVal lostFocus As EnvDTE.Window) Handles WindowEvents.WindowActivated
    DTE.ExecuteCommand("Edit.StopOutlining")
End Sub

Of course, this will call Edit.StopOutlining on every window you are opening; so maybe you have to do a little bit of filtering what documenttype was activated.

like image 36
Noffls Avatar answered Sep 30 '22 13:09

Noffls