0

How can I set auto inserting curly brackets after loop/IF + [ENTER] in C# ReSharper 8.2.3?

Example:

if (statement) //+[ENTER]

should gives me:

if (statement)
{
    //CURSOR HERE
}
tomaszu
  • 5
  • 1
  • You could also [clean up your code on saving][1] and set your options to add brackets on saving. [1]: http://stackoverflow.com/questions/3071953/how-can-i-configure-resharpers-code-cleanup-on-save – Carra Dec 05 '14 at 12:20

2 Answers2

1

I don't know if it will insert both braces for you, however, there is an option to complete your brace. I.e., if you type:

if(statement) // + {

it will auto add and format your braces to be on the next line as follows

if(statement)
{
    // Cursor here
}

From the IDE, the option is in TOOLS -> Options -> ReSharper, "Options...". then under Environment -> Editor -> Editor Behavior Check the 'Auto-insert closing brace and choose the first option.

GEEF
  • 1,175
  • 5
  • 17
  • Also, consider the second radio button in that option as well, as it might better suit your needs. This will require you type the first brace and hit ENTER, then it will format down as you requested. – GEEF Dec 04 '14 at 14:32
0

You can use ReSharper's Complete Statement command to auto-insert the braces for you. This is Ctrl+Shift+Enter. It's useful all over the place, automatically inserting semi-colons and closing brackets and so on.

citizenmatt
  • 18,085
  • 5
  • 55
  • 60