Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 Collapsing Regions

I've noticed that in Visual Studio 2017, when I hit CTRL+M, CTRL+O, regions do not collapse to definitions. Has there been a change on this? How do I collapse everything -- including regions?

BTW, I get the same results whether I use the keyboard shortcut or go through the context menu by right-clicking. Regions just do not collapse at all.

like image 830
Sam Avatar asked Mar 16 '17 19:03

Sam


People also ask

How do you collapse a region in Visual Studio 2017?

(Ctrl+M, Ctrl+H) - Collapses a selected block of code that would not normally be available for outlining, for example an if block. To remove the custom region, use Stop Hiding Current (or Ctrl+M, Ctrl+U). Not available in Visual Basic.

How do you collapse and expand code in Visual Studio 2017?

CTRL + M + O will collapse all. 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.

How do I create a collapsible section in Visual Studio?

Ctrl + Shift + [ on Windows and Linux. ⌥ + ⌘ + [ on macOS.

How do I collapse all projects in Visual Studio 2017?

Here's how to assign a keyboard shortcut to collapse all projects in Visual Studio Solution Explorer. In Visual Studio, go to Tools > Options > Keyboard. In the Show commands containing text box, type in CollapseProjects.


1 Answers

It seems that this behavior is turned off by default. It can be enabled under Tools > Options > Text Editors > C# > Advanced > Outlining > "Collapse #regions when collapsing to definitions"

like image 199
Gelásio Avatar answered Sep 22 '22 18:09

Gelásio