Glendon Klassen
Glendon Klassen

Reputation: 11

C# Linq statement block-style alignment

I'm working with Rider/ReSharper and formatting C# code in block style to improve readability. I can't find (in the settings or on the internet) a way to format LINQ statements as follows:

static Game<Unit> stickOrTwist =>
        when(isGameActive,
             from player in Player.current
             from _      in Display.askStickOrTwist(player) >>
                            Player.showCards
             from key    in Console.readKey
             from __     in key.Key switch
                            {
                                ConsoleKey.S => Player.stick,
                                ConsoleKey.T => twist,
                                _            => stickOrTwistBerate
                            }
             select unit)
           .As();

(The reference is from language-ext so I know it's possible to do.)

Could someone point me in the right direction of a tool that would allow me to format my LINQ queries in that manner?

I tried searching Google for how to format LINQ in this way but only found the (small) set of options Rider has for formatting LINQ in the C# formatting section.

Upvotes: 1

Views: 67

Answers (2)

Glendon Klassen
Glendon Klassen

Reputation: 11

As per this discussion, the formatting in language-ext is partially using JetBrains alignment tools and partially manual. The author has opened a ticket with JetBrains to get automated support.

Upvotes: 0

Andy
Andy

Reputation: 97

Try going to:

Resharper -> Options -> Code Editing -> C# -> Formatting Style -> Tabs, Indents, Alignment

Upvotes: 0

Related Questions