jump to other delimiter (brace, bracket or quote)

Currently, ReSharper will automatically highlight the other bracket, brace or quote (depending on settings I can configure under ReSharper > Options > Environment > Editor).

Does anyone know if there is a a way to configure a keyboard shortcut to jump to that other delimiter?

I see this usefull in a couple of scenarios:

* I want to cut or copy a string.  I put my cursor at the opening or closing double quote.  Then I hold shift (for selection) along with the keyboard shortcut I seek.  Voila, the whole string is selected.

* I want to add another parameter to a method and my cursor is at the opening parentheses.  I hit the keyboard shortcut.  Hey, presto, I'm positioned to type some more.

* (This one happens to me more than I like).  I'm throwing an exception and I start typing my message.  Midway through I realize this is going to be a format string so I continue and finish up my message.  I now have something like [throw new MyException("Invalid option={0}", option)] and I proceed to insert a [string.Format(] in before the format string.  Yay, ReSharper adds the closing parentheses for me, but oh no, it is in the wrong place.  I hit my keyboard shortcut and my cursor jumps to the offending closing parentheses and I can fix it.

* I want to copy a whole compound statement (i.e. a code block already surrounded by curly braces).  I put my cursors at the opening or closing curly brace.  Then I hold shift (for selection) along with the keyboard shortcut and then the whole block is magically selected.  Nice!

Thanks,
Andre

4 comments
Comment actions Permalink

Hello Andre,

May be Ctrl-} and Ctrl-Shift-} are what you are looking for?

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


AL> Currently, ReSharper will automatically highlight the other bracket,
AL> brace or quote (depending on settings I can configure under
AL> ReSharper > Options > Environment > Editor).
AL>
AL> Does anyone know if there is a a way to configure a keyboard
AL> shortcut to jump to that other delimiter?
AL>
AL> I see this usefull in a couple of scenarios:
AL>
AL> * I want to cut or copy a string. I put my cursor at the opening or
AL> closing double quote. Then I hold shift (for selection) along with
AL> the keyboard shortcut I seek. Voila, the whole string is selected.
AL>
AL> * I want to add another parameter to a method and my cursor is at
AL> the opening parentheses. I hit the keyboard shortcut. Hey, presto,
AL> I'm positioned to type some more.
AL>
AL> * (This one happens to me more than I like). I'm throwing an
AL> exception and I start typing my message. Midway through I realize
AL> this is going to be a format string so I continue and finish up my
AL> message. I now have something like [throw new MyException("Invalid
AL> option=", option)] and I proceed to insert a in
AL> before the format string. Yay, ReSharper adds the closing
AL> parentheses for me, but oh no, it is in the wrong place. I hit my
AL> keyboard shortcut and my cursor jumps to the offending closing
AL> parentheses and I can fix it.
AL>
AL> * I want to copy a whole compound statement (i.e. a code block
AL> already surrounded by curly braces). I put my cursors at the
AL> opening or closing curly brace. Then I hold shift (for selection)
AL> along with the keyboard shortcut and then the whole block is
AL> magically selected. Nice!
AL>
AL> Thanks,
AL> Andre
AL> ---
AL> Original message URL:
AL> http://www.jetbrains.net/devnet/message/5238294#5238294


0
Comment actions Permalink

Yep, that did the trick.  I was looking at the ReSharper keyboard shortcuts -- didn't occur to me to look at the regular Visual Studio keyboard shortcuts.  Thanks!

0
Comment actions Permalink

I also use "Expand Selection" in cases like that. With the IntelliJ
IDEA/Resharper 2.x keymap, it's a very conveniently located "Ctrl-W"... just
keep pressing it until you have selected all the text you want (holding
Shift will shrink the selection). I use this feature constantly, and it
would certainly work in many of the scenarios you outlined as well.

"Andre Lombard" <no_reply@jetbrains.com> wrote in message
news:30951302.12171242615104070.JavaMail.clearspace@app8.labs.intellij.net...

Yep, that did the trick. I was looking at the ReSharper keyboard
shortcuts -- didn't occur to me to look at the regular Visual Studio
keyboard shortcuts. Thanks!

>

---
Original message URL:
http://www.jetbrains.net/devnet/message/5238334#5238334


0
Comment actions Permalink

Hello,

I also use "Expand Selection" in cases like that. With the IntelliJ
IDEA/Resharper 2.x keymap, it's a very conveniently located
"Ctrl-W"... just keep pressing it until you have selected all the text
you want (holding Shift will shrink the selection). I use this
feature constantly, and it would certainly work in many of the
scenarios you outlined as well.


Ctrl+W is the standard Visual Studio shortcut, but originally it selects
just the word, i.e. it cannot extend selection further. R# introduces multi-stage
selection expansion.

There's one more action that could be interesting in this context, ReSharper
-> Goto -> Containing Declaration that jumps to the method or class declaration.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

Please sign in to leave a comment.