Reputation:
Every time I type an object initializer as a parameter, like this:
SomeFunc(new { Id = id })
and type the semicolon afterwards, ReSharper formats what I just typed, as configured. However, I cannot find an option in ReSharper to make it not turn my code into this:
SomeFunc(new {
Id = id
});
I did confirm it actually is ReSharper doing the formatting.
Upvotes: 11
Views: 2184
Reputation:
If you want to keep ReSharper from formatting your object initializers (so you can decide how you want to format them yourself), I think a combination of these settings will do the job.
Keep existing line breaks
: [Checked]
Place simple array, object and collection on single line
: [Checked]
Wrap object and collection initializer
: 'Simple wrap'
Wrap long lines
: [Unchecked]
Of course, these settings might not fit everyone's situation, but I'm sure you can adapt them to your needs.
Upvotes: 13
Reputation: 7747
It looks like you need to set Wrap object and collection initializer
option to Chop if long
in Code Editing -> C# -> Formatting Style -> Line Breaks and Wrapping
section.
Upvotes: 1