ProfK
ProfK

Reputation: 51104

Autoformat of single statement blocks to one line with braces on same line

Just recently, I suspect after a ReSharper update, VS2015 has started with an auto-format that is blood-curdling:

If I type e.g:

using(var x = new Disposable())
{
...
}

as soon as I type the closing brace, it gets formatted to an ugly bloody single line:

using(var x = new Disposable()) { ... }

I have checked every formatting setting in VS and R# and can find nothing except 'Autoformat after }' in the VS settings, and have naturally turned it off. Does anyone have any idea what setting or device or demon is doing this to me?

Upvotes: 0

Views: 942

Answers (1)

Alexander Kurakin
Alexander Kurakin

Reputation: 13533

  1. To disable auto-formatting on closing brace in R#, please untick ReSharper | Options | Environment | Editor | Editor Behavior | Auto-format on closing brace
  2. To disable moving braces to a single line with using statement, please select "Do not change" or "Force line breaks" here ReSharper | Options | Code Editing | C# | Formatting Style | Line Breaks and Wrapping | Preserve Existing Formatting | Break line in a block with a single statement

Upvotes: 2

Related Questions