Adrian Grigore
Adrian Grigore

Reputation: 33318

How can I make Resharper wrap very long lines properly?

Resharper's code formatting is generally fine, but it seems completely broken when dealing with very long lines. For example look at this piece of code:

enter image description here

I do want some kind of line wrapping, but it should look ahead and indent less if necessary to avoid ridiculous amounts of line breaks. Something like this would be great:

enter image description here

Is there any way to make Resharper do this?

Upvotes: 7

Views: 3147

Answers (2)

Adrian Grigore
Adrian Grigore

Reputation: 33318

Alex Berezoutsky of Jetbrains has suggested to turn off "Indent array, object and collection initializer" checkbox in the "ReSharper | Options | Languages | C# | Formatting Style | Other" dialog. It's not ideal IMO for shorter lines, but it does look much better on very long code lines.

I guess it's the best workaround for this problem at the current time.

Upvotes: 2

squillman
squillman

Reputation: 13641

I admittedly haven't plugged your code into my IDE to try it so I don't have exact setting values for you, but have a go at tweaking the line wrapping options in R# options.

  • Go to Resharper | Options
  • Under Languages expande C# and then Formatting Style, click on Line Breaks and Wrapping
  • Review the settings in that category

Upvotes: 0

Related Questions