fsprojects / fantomas

FSharp source code formatter
https://fsprojects.github.io/fantomas
Other
758 stars 189 forks source link

Equals sign should only be on same line if last tuple is multiline #3040

Closed nojaf closed 5 months ago

nojaf commented 5 months ago

Issue created from fantomas-online

Code

    let processSnippetLine
        (checkResults: FSharpCheckFileResults)
        (semanticRanges: SemanticClassificationItem array)
        (lines: string array)
        (line: int, lineTokens: SnippetLine)
        =
        let lineStr = lines.[line]
        ()

Result

let processSnippetLine
    (checkResults: FSharpCheckFileResults)
    (semanticRanges: SemanticClassificationItem array)
    (lines: string array)
    (line: int, lineTokens: SnippetLine) =
    let lineStr = lines.[line]
    ()

Problem description

Related to the changes of https://github.com/fsprojects/fantomas/pull/3038. The = jump to the same line as the style guide suggests this for multiline tuples:

let a
    (
        b: c,
        d: e
    ) =
    f

If the last tuple isn't multiline we probably shouldn't go for this. Thoughts @josh-degraw @dawedawe?

Extra information

Options

Fantomas main branch at 1/1/1990

Default Fantomas configuration

Did you know that you can ignore files when formatting by using a .fantomasignore file? PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.

josh-degraw commented 5 months ago

Yeah I feel like definitely should only apply for multiline ones.

dawedawe commented 5 months ago

What Josh said.