How to stop ReSharper removing spaces in object initializer

Viewed 4368

I like my object initializers to look like this:

new Point { Label = g.Key.Name, Claims = g };

When hit the semicolon key, they get reformatted like this:

new Point {Label = g.Key.Name, Claims = g};

Where is the option to stop my padding from being removed?

2 Answers

If you are using an .editorconfig file, you can control this behaviour by adding:

space_within_single_line_array_initializer_braces = true

See also the official resharper documentation on supported .editorconfig entries. These typically let you customize everything you could customize from the formatting styles menu for all of Jetbrains' IDEs.

Related