Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I keep Resharper from massively indenting lambdas?

Tags:

I have Resharper installed with mainly default settings. Currently, I'd like my multi-line lambda expressions to look something like this:

foobarclass.biz.baz.Event += (s, e) =>
  {
    foo.Bar.DoThings.Whatever();
  };

However, Resharper "helpfully" will reformat my code to be like this:

foobarclass.biz.baz.Event += (s, e) =>
                                 {
                                     foo.Bar.DoThings.Whatever();
                                 };

And in some cases, will also break up long statements so it ends up looking like this:

foobarclass.biz.baz.Event += (s, e) =>
                                 {
                                     foo.
                                        Bar.
                                        DoThings.
                                        Whatever();
                                 };

As you can tell, this auto-formatting makes code a lot less readable. How can I fix this kind of behavior?

like image 245
Earlz Avatar asked Dec 12 '12 18:12

Earlz


1 Answers

Try unchecking:

RESHARPER -> OPTIONS -> C# -> Formatting Style -> Other -> Indent Anonymous Method Body

like image 158
Levi Botelho Avatar answered Nov 01 '22 11:11

Levi Botelho