How to disable region collapsing or expand ALL regions in Visual Studio VB.NET?

Viewed 34256

In Visual Studio C# (2008), Ctrl+M+L expand all the regions.

There's also a setting in menu:

Tools -> Options -> Text Editor -> C# -> Advanced

to not collapse during file open. I see no equivalents in VB.NET.

Is there a way to expand all the regions, not just the one which has focus in VB.NET?

Or a macro or add-in that does it? I just hate not being able to see all the code.

8 Answers

If you are willing to remove regions you can try this:

Ctrl+F

  • Quick Replace
  • Find Options
  • Use: Regular Expressions

Find What:

^\s*#(end)?region.*$

Replace with:

[leave replace box empty]

Explanation:

  • ^ - Match the start of a line
  • \s* - Match zero or more whitespace characters
  • # - Match one # character
  • (end)? - Optionally match the string end
  • region - Match the string region
  • .* - Match zero or more of any other characters
  • $ - Match the end of the line

This will effectively find all #region or #endregion lines, whether they are indented or not, and whether they have description text after them or not.

In the Edit Menu, the Outlining submenu, you have all the options. Including Toggle All Outlining (Ctrl+M+L by default).

Maybe your key mappings were altered.

If you so desire, you can even select menu:

Edit -> Outlining -> Stop Outlining

That's pretty odd. The default profile settings for VB.Net and C# should bind the outlining functions to Ctrl+M, Ctrl+L combos.

It's possible that your profile is in a weird state. Try resetting your profile to VB.Net settings and see if that fixes the problem.

Tools → Import / Export Settings → Reset All Settings → VB.Net Profile

Related