Skip to content

Aesthetics of long members in a type declaration #1362

Closed
@Smaug123

Description

Issue created from fantomas-online

Code

type IFoo =
    abstract Blah : foo : string -> bar : string -> baz : string -> int

Result

type IFoo =
    abstract Blah: foo:string
     -> bar:string -> baz:string -> int

Problem description

I set the line length very short so as to trigger this.

This is purely stylistic, but I would prefer to follow a different rule: if a member declaration has to be split over multiple lines, then all the arguments should be split onto their own line.

type IFoo =
    abstract Blah :
        foo : string ->
        bar : string ->
        baz : string ->
        int

I recognise that this change should be accompanied by a change to the G-Research style guidelines, which are currently silent on the matter. If you think this is a reasonable choice, I'll raise an appropriate PR to https://github.com/G-Research/fsharp-formatting-conventions/ .

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 01/09/2021 08:58:25 - ca42f0d

    { config with
                MaxLineLength = 60 }

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions