Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command to collapse all sections of code?

In Visual Studio is there a command to collapse/expand all the sections of code in a file?

like image 527
Mr. Flibble Avatar asked Jun 11 '09 18:06

Mr. Flibble


People also ask

How do you collapse all sections in VS code?

How to Collapse All Source Code in VS Code? To fold all top-level and child elements of your code: Enter command >fold and hit enter.


2 Answers

CTRL + M + O will collapse all.

CTRL + M + L will expand all. (in VS 2013 - Toggle All outlining)

CTRL + M + P will expand all and disable outlining.

CTRL + M + M will collapse/expand the current section.

CTRL + M + A will collapse all even in Html files.

These controls are also in the context menu under Outlining.

Right click in editor -> Outlining to find these controls. (After disabling outlining, use same steps to enable outlining.)

For outlining options: Go to Tools -> Options -> Text Editor -> C# -> Advanced -> Outlining for outlining options.

Tools -> Options -> Text Editor -> C# -> Advanced -> OutliningRight-click > Outlining menu

like image 181
Bob Avatar answered Oct 04 '22 23:10

Bob


The following key combinations are used to do things:

CTRL + M + M → Collapse / Expand current preset area (e.g. Method)

CTRL + M + H → Collapse / Hide (Expand) current selection

CTRL + M + O → Collapse all(Collapse declaration bodies)

CTRL + M + A → Collapse all

CTRL + M + X → Expand all

CTRL + M + L → Toggle all

There some options in the context menu under Outlining.

like image 41
Bhavesh Kachhadiya Avatar answered Oct 05 '22 00:10

Bhavesh Kachhadiya