fantomas icon indicating copy to clipboard operation
fantomas copied to clipboard

Function call with parenthesis around function name

Open nojaf opened this issue 3 years ago • 0 comments

Since F# 6, I believe we can align the formatting of multiline function applications where the function name has parentheses.

(ignore) ("Tuuuuuuuuuuuuurn Tuuuuuuuuuuuuurn Tuuuuuuuuuuuuurn Tuuuuuuuuuuuuurn tooooooooooooooooooooooo stooooooooooooooooooooooooone", 42)

is now formatted as

(ignore)
    (
        "Tuuuuuuuuuuuuurn Tuuuuuuuuuuuuurn Tuuuuuuuuuuuuurn Tuuuuuuuuuuuuurn tooooooooooooooooooooooo stooooooooooooooooooooooooone",
        42
    )

due to the previous offset rules.

We used the function genAlternativeAppWithParenthesis for this and should remove it all together. In genExpr we can also get rid of

        // (*) (60. * 1.1515 * 1.609344)
        // function is wrapped in parenthesis
        | AppParenArg (Choice1Of2 (Paren _, _, _, _, _, _) as app)
        | AppParenArg (Choice2Of2 (Paren _, _, _, _, _) as app) ->
            let short = genAppWithParenthesis app astContext

            let long = genAlternativeAppWithParenthesis app astContext

            expressionFitsOnRestOfLine short long

and let things play out using the normal flow. The result would be

(ignore) (
    "Tuuuuuuuuuuuuurn Tuuuuuuuuuuuuurn Tuuuuuuuuuuuuurn Tuuuuuuuuuuuuurn tooooooooooooooooooooooo stooooooooooooooooooooooooone",
    42
)

genClause also uses this function, I believe it can remove for let long there as well.

As 5.0 is in beta we can no longer take this stylistic change. This would need to be solved in 5.1.

nojaf avatar Jul 25 '22 12:07 nojaf