Surround code block with curly braces?

后端 未结 6 1000
Happy的楠姐
Happy的楠姐 2021-02-18 22:53

Is there a shortcut to surround a given (selected) code block with curly braces?

VS 2015 + R# 2016.1

6条回答
  •  深忆病人
    2021-02-18 23:45

    At least in Visual Studio 2019, this is a built-in optional feature, albeit it is:

    1. Disabled by default
    2. Buried deep in the Options

    To enable this feature, select Tools->Options to open the Options dialog. In the left-hand pane that shows the options groups, expand the Text Editor group, then expand the C/C++ sub-group, then select the Advanced item. Now scroll all the way to the bottom of the right-hand pane and you'll see the following options under the Text Editor section:
    | Option | Value |
    | ------ | ----- |
    | Enable Surround with Braces | False |
    | Enable Surround with Parentheses | False |
    Change both of those to "True" (assuming you want both behaviors) and you're good to go!

提交回复
热议问题