How can I make Resharper wrap very long lines properly?
Asked Answered
P

2

7

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?

Pieeyed answered 29/3, 2011 at 18:26 Comment(2)
I'm also irritated by this. One way to get somewhat better formatting is by placing a new-line after your first "=" (i.e. start a new line at Fakes.ReportClientAssignmentsRepository).Darcydarda
@telewin: That's pretty much the same thing I keep doing, but if I forget to add my line breaks before hitting ctrl-e-f, the formatting is messed up and stays that way unless I manually remove a lot of line breaks.Pieeyed
P
2

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.

Pieeyed answered 31/3, 2011 at 15:11 Comment(0)
U
0

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
Uric answered 29/3, 2011 at 19:26 Comment(1)
I already did... several times. But I could not find any setting that would make the indentation wrapping work correctly.Pieeyed

© 2022 - 2024 — McMap. All rights reserved.