Delete Matching Braces in Visual Studio

后端 未结 3 520
刺人心
刺人心 2021-01-12 04:15

In Visual Studio I can jump from/to opening/closing brace with the Control+] shortcut.

Is there a shortcut that will allow me to delete both braces at o

3条回答
  •  一整个雨季
    2021-01-12 04:33

    There isn't an inherent way to do this with Visual Studio. You would need to implement a macro in order for this.

    If you choose the macro route you'll want to get familiar with the Edit.GoToBrace command. This is the command which will jump you from the current to the matching brace. Note it will actually dump you after the matching brace so you may need to look backwards one character to find the element to delete.

    The best way to implement this as a macro is to

    • Save the current caret position
    • Execute Edit.GoToBrace
    • Delete the brace to the left of the caret
    • Delete the brace at the original caret position

提交回复
热议问题