fsharp / fslang-design

RFCs and docs related to the F# language design process, see https://github.com/fsharp/fslang-suggestions to submit ideas
518 stars 144 forks source link

[style-guide] Guidance for code quotations #661

Closed dawedawe closed 2 years ago

dawedawe commented 2 years ago

Currently the F# style guide lacks guidance for code quotations. This causes issues for Fantomas. See 2211 for more background, especially nojaf's example.

So let's change that. We suggest to put the delimiter symbols (<@ , @>, <@@, @@>) on separate lines if the quoted expression is a multi-line expression like:

<@
    let f x = x + 10
    f 20
@>

and to keep everything in one line for single-line expressions like:

<@ 1 + 1 @>

(Assuming the expression fits in one line.) The language reference is using this style for the most part, too. I'd be happy to create the needed pull requests after we have come to a conclusion on this issue.

dsyme commented 2 years ago

I agree with this