Rider Format Style on Initializer Help

I have a problem with my style and I need direction for how to solve this.
The highlighted line is a new item, but I don't want it to make a new line between "}," and "{".
- I don't want to have lose formatting with the "keep existing arrangement" in initializer options.
- I don't want to change the brace style to GNU since it will change every single one to use 1 extra line.

How I want it to look
How it looks after formatting
0
1 comment

Hello Gustafkrister, thank you for your question. The only workaround I came up with is to put the // @formatter:initializer_braces next_line_shifted_2 comment before the initializer, and then turn off this rule using such a comment: // @formatter:initializer_braces restore

I don't want to change the brace style to GNU since it will change every single one to use 1 extra line.

I just would like to let you know that there is a more specific setting that only affects initializers, switch expressions, patterns and collection expressions - “(Extensions) | ReSharper | Options | Code Editing | C# | Formatting Style | Braces Layout | Braces Layout | Expressions”.  Perhaps this option also will suit you.

Please let me know what you think about these options. Thank you!

0

Please sign in to leave a comment.