Is there a shortcut to jump to a closing brace?

Is there a shortcut to jump outside of a code block, right after a closing brace } of a current code block?

 

Let me explain.

Let's say there's a method:

private void Button_Click(object sender, EventArgs e)
{
    if (enableCheckbox.Checked == true)
    {
        if (labelToChange.Text == "Right")
        {
            labelToChange.Text = "Left";
        }
        else
        {
            labelToChange.Text = "Right";
        }
    }
}

And my cursor is somewhere on the line labelToChange.Text = "Left";.

I would like to make it to jump to the closing brace } of current if (labelToChange.Text == "Right") code block by pressing Ctrl+].

Then if I press Ctrl+] again, I would like it to jump to closing brace } of if (enableCheckbox.Checked == true) code block.

And then if Press Ctrl+] for the third time in a row, I would like to jump to the closing brace } of a code block of a method private void Button_Click(object sender, EventArgs e).

Here's what I'm trying to achieve in motion:

I managed to achieve this behavior in WebStorm and PhpStorm by using a macro: 

It goes to the end of code block and then it goes to the end of the line, so it stops outside of closing brace.

Comes very handy all the time when I am working with multiple code blocks: if/else, writing methods, anything, I use it all the time in WebStorm and PhpStorm.

Is there a way to achieve this in Visual Studio?

I know about default Ctrl+] shortcut, the problem with Edit.GoToBrace command is that it goes to the closing brace } only when cursor is at the opening brace { but not when cursor is anywhere else inside the code block.

1 comment
Comment actions Permalink

Submitted a feature request if anyone is interested:

https://youtrack.jetbrains.com/issue/RSRP-467830

0

Please sign in to leave a comment.