3

In vs2010 was an Outlining option to set all blocks of code appears collapsed by default. Is there some way to do same thing in vs2012?

3 Answers 3

2

Not as a default.

I know it's a workaround, but as Visual Studio retains the collapsed/expanded state of the outlining when closing and reopening files you could use the Outlining -> Collapse to Definitions command to quickly collapse files when you open them and the state will be retained the next time you open that file. It's pretty quick to do and much less annoying if you use the keyboard short cut for it.

If that's too painful you'll probably need to find an extension that could do what you want, though I don't of one at this point in time.

Sign up to request clarification or add additional context in comments.

Comments

2

This isn't available as a default, however you can press CTRL + M, O when editing a code file to collapse everything.

Comments

0

Have a look at this workaround from MSDN (only works up to VS2012 though).

Could you please open the marco IDE by click Tools->Macros->Macros IDE.

You can find a modual named EnvironmentEvents in project MyMacros.

Then could you please try to add this code in EnvironmentEvents?

Private opened As Boolean Private Sub WindowEvents_WindowActivated(ByVal GotFocus As EnvDTE.Window, ByVal LostFocus As EnvDTE.Window) Handles WindowEvents.WindowActivated If GotFocus.Document Is Nothing Then Return End If If GotFocus.Document.FullName.EndsWith(".cs") And opened = True Then DTE.ExecuteCommand("Edit.CollapsetoDefinitions") End If opened = False End Sub Private Sub DocumentEvents_DocumentOpened(ByVal Document As EnvDTE.Document) Handles DocumentEvents.DocumentOpened opened = True End Sub 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.