16

If i have the following

#region
blah;
blahblah;
.....
moar;
#endregion

how can i jump to the top #region label if i see the #endregion tag on my screen?

Is there a short cut?

jordan
  • 3,092
  • 8
  • 38
  • 72

4 Answers4

20

Ctrl+] will jump between the start and end of blocks. I just tested, and it works for #region blocks for me in VS2010.

Edit: The relevant command is Edit.GoToBrace

DanM7
  • 2,101
  • 3
  • 25
  • 45
TheEvilPenguin
  • 5,363
  • 1
  • 23
  • 46
19

The answer is Ctrl + ] as already answered by @TheEvilPenguin.

But I thought to add this awesome link for other shortcuts as well, which can be helpful in speeding up routine tasks in VS.

Save the link page as html in your system, as the link might expire in future.

Robert Harvey
  • 168,684
  • 43
  • 314
  • 475
Devraj Gadhavi
  • 3,259
  • 3
  • 34
  • 61
15

For Visual Studio 2015, Ctrl + ] doesn't work anymore. But you can use the following:

  1. Click on region
  2. And use following shortcuts: Ctrl + shift + ↑ and Ctrl + shift + ↓
Ozkan
  • 3,481
  • 7
  • 35
  • 65
  • Thanks for the workaround. With a future update of VS 2015, this issue will be fixed. There is an issue on [GitHub](https://github.com/dotnet/roslyn/issues/7120) for that which is already resolved, so it's just a matter of when the next milestone will be published. – Tobias Mar 01 '16 at 09:50
  • Let me clarify. Hovering will not do. you need to click on the very word (region or endregion) for this workaround to work. (VS2015SP3) – Shaul Jan 09 '17 at 18:51
1

I don't believe there's a standard shortcut in Visual Studio.

Within Visual Studio's options dialog, I did a search through all available commands for anything containing the word "region":

Region commands

But didn't find anything related to navigation, just expand/collapse.

Addins like Resharper and CodeRush may give you what you want, if you have the budget for it. (And they do a lot more besides.)

Bevan
  • 40,925
  • 10
  • 77
  • 128