tomaszu
tomaszu

Reputation: 5

Resharper: auto-insert culry brackets after loops

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
}

Upvotes: 0

Views: 498

Answers (2)

citizenmatt
citizenmatt

Reputation: 18583

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.

Upvotes: 0

GEEF
GEEF

Reputation: 1185

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.

Upvotes: 1

Related Questions