How to turn off autoformat which is getting rid of curly bracket spacing in collection initializer?

484 views Asked by At

I have visual studio 2013, Resharper 8.1 and Stylecop.

I'm not sure what setting is doing this, but I can't seem to find it!?

I pristine visual studio 2013 will take something like this:

var tmp = new List<string> {"this"};

and make it into this (like I want):

var tmp = new List<string> { "this" };

This happens upon typing the semicolon.

Right now my setup will do the opposite, it get's rid of the spaces (although it then grey underlines the braces because this is a StyleCop violation.

Where's the setting to HAVE spaces there, I've tried to go through all the VS and Resharper settings!?

Thanks for any insights.

1

There are 1 answers

0
Grant Winney On BEST ANSWER

That's the default setting in my environment too (VS2012 / ReSharper 7).

You can change it in the ReSharper options:

Code Editing » C# » Formatting Style » Spaces » Within single-line initializer braces

enter image description here