13

Say you have a large amount of C# code in an if statement. If you place your carat next to the opening bracket, is there a hotkey or something in ReSharper that will automatically take you to the closing bracket?

Dan Appleyard
  • 7,405
  • 14
  • 49
  • 80
  • See http://stackoverflow.com/q/1501921/171703 – akiller Dec 16 '11 at 21:08
  • akiller - please entered this as an answer. while you are not the first one telling me about Ctrl + ], you are the first one telling me it is already part of VS and not ReSharper. – Dan Appleyard Dec 16 '11 at 21:12
  • That's the problem with using a tool like re#... sometimes you don't know where the line is (I, too, didn't realize it was a Studio shortcut). – JNadal Dec 16 '11 at 21:36

4 Answers4

21

VS offers this shortcut, regardless of whether you have R# installed.

Ctrl + ] will take you to the opening brace. Subsequent presses will jump between the RHS/LHS of the scope.

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
6

See Go to Matching Brace in Visual Studio? (now as an answer as requested!)

Community
  • 1
  • 1
akiller
  • 2,462
  • 22
  • 30
3

ReSharper assigns the shortcut (Control + ´ - I have german keyboard) to a different command. In order to restore it go to Tools - Options - Environment - Keyboard, search for Edit.GotoBrace and enter the desired shortcut key. See to what command it is currently assigned and then remove it for this command first by searching this command and clicking Remove. Then again search for Edit.GotoBrace and assign the shortcut.

Directly assigning without Removing it first didn´t work.

huha
  • 4,053
  • 2
  • 29
  • 47
  • The normal procedure worked well for me. No need to remove the shortcut on the other command first. VS 2019, v.16.11.9. – Tobias Knauss Apr 01 '22 at 09:16
1

Visual Studio's shortcut is (under the IntelliJ shortcut set): Control + ] when your cursor is on the opening brace goes to the ending brace. The inverse is also true.

JNadal
  • 408
  • 2
  • 8
  • 2
    Resharper has no such shortcut, that's Visual Studio. Resharper does have Ctrl+[ in the IDEA and VS schemes though--which is actually /go to containing declaration/ and doesn't have anything to do with brackets – Peter Ritchie Dec 17 '11 at 15:18