fantomas icon indicating copy to clipboard operation
fantomas copied to clipboard

Regression since 6.3.5: Shorthand lambda pushes args far out right with name-sensitive alignment; discrepancy with normal lambda

Open cmeeren opened this issue 7 months ago • 1 comments

Issue created from fantomas-online

Code and expected output

workstations
|> Seq.sumBy
    _.GetWeeklyValueWithoutAccessCheck(
        year,
        week,
        CapacityAggregateValueType.CostPrice,
        category
    )

Result

workstations
|> Seq.sumBy
    _.GetWeeklyValueWithoutAccessCheck(year,
                                       week,
                                       CapacityAggregateValueType.CostPrice,
                                       category)

Problem description

This regression appeared in 6.3.5. (Fantomas 6.3.4 correctly formats it as the code at the top.)

Note that this does not happen with a normal (non-shorthand) lambda. Fantomas correctly formats this:

workstations
|> Seq.sumBy (fun x ->
    x.GetWeeklyValueWithoutAccessCheck(
        year,
        week,
        CapacityAggregateValueType.CostPrice,
        category
    ))

Extra information

  • [ ] The formatted result breaks my code.
  • [ ] The formatted result gives compiler warnings.
  • [ ] I or my company would be willing to help fix this.
  • [x] I would like a release if this problem is solved.

Options

Fantomas main branch at 1/1/1990

    { config with
                MaxLineLength = 50 }

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.

cmeeren avatar Jun 27 '24 13:06 cmeeren