ReSharper LINQ extension method formatting
Asked Answered
O

1

7

I'm struggling with Resharpers formatting. Consider the following Code:

product.Resources.Where(x => x.Tracked).Pipe(y =>
                                             {
                                                 //Action       
                                             });

How can I tell ReSharper to indent the part in the curly braces and the curly braces itself only a little bit? I've tried several Resharper formatting settings but none had any effect in this case.

Edit:

I would like to have a format similar to this:

product.Resources.Where(x => x.Tracked).Pipe(y =>
    {
        //Action       
    });
Oculus answered 5/3, 2012 at 22:34 Comment(4)
Check out: #520255Crumpet
Thanks, it's looking much better now.Oculus
@Crumpet - you should submit that as an answer so he can mark it and close this question.Communicative
I tried but it keeps converting it to a comment... due to the small size.. Let me copy over the details from the other question :)Crumpet
C
5

See https://mcmap.net/q/262015/-custom-brace-formatting-with-resharper

You can customize ReSharper to do just that, you'll need to do the following (All in ReSharper -> Options -> C# -> Formatting Style):

  • In Braces Layout, set Array and object initializer to At Next line (BSD Style).
  • In Other, make sure that Continuous line indent multiplier is set to 1.
  • In Other, make sure that Indent array, object and collection initializer block is unchecked.

You should get the style you want.

Crumpet answered 6/3, 2012 at 21:17 Comment(1)
Very useful. I found out that also "Anonymous method declaration" is best set to BSD style.Fortna

© 2022 - 2024 — McMap. All rights reserved.