dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.21k stars 5.86k forks source link

Lazy multiline parenthesis expression #24977

Open nojaf opened 3 years ago

nojaf commented 3 years ago

Hello, I'm wondering what the recommended way is to write a multiline lazy expression.

let v =
    lazy (
        // some code
        // other code
        myFunctionCall x y z
    )

Should it follow the function application rule and be something like

lazy
    (multlilineExpression)

or does it follow the Formatting constructors, static members, and member invocations rule?

lazy (
    multilineExpression
)

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

cartermp commented 3 years ago

I think it should follow the latter one even though it's not a member. The reason is that this is the easiest one to reproduce without an automatic formatter and not run into the parser being unhappy.