Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Elmish syntax #1198

Closed
4 of 5 tasks
nojaf opened this issue Oct 18, 2020 · 0 comments
Closed
4 of 5 tasks

Disable Elmish syntax #1198

nojaf opened this issue Oct 18, 2020 · 0 comments

Comments

@nojaf
Copy link
Contributor

nojaf commented Oct 18, 2020

I propose we add a setting to disable the Elmish syntax improvement.
This came up in #1189 and I hear other people mentioning this as well.

The existing way of Fantomas deals with this problem is an all or nothing situation when the Syntax tree matches the Elmish patterns.

Initially, I'd go for a disable Elmish setting, after extensive feedback and for the next major version we might even flip this around that you need to enable Elmish formatting.

Pros and Cons

The advantages of making this adjustment to Fantomas are more consistent code when not doing anything Fable/Elmish related.
The setting could be enabled/disabled for specific files or folder using a .editorconfig.

The disadvantages of making this adjustment to Fantomas are more code to maintain and users need to be aware that of this setting. This could be a bit confusing.
Another contra I see here is that the fsharp_max_elmish_width should have no effect when fsharp_disable_elmish=true.
This again might be just a tad confusing for end-users.

Examples

let v =
    someFunctionHere [parameters] [yetMoreParameters]
    :?> _

currently formatted

let v =
    someFunctionHere [ parameters ] [
        yetMoreParameters
    ] :?> _

with setting should be

let v =
    someFunctionHere [ parameters ] [ yetMoreParameters ] :?> _
InstanceObject.make [a; b; c]

currently format with fsharp_max_elmish_width=10

InstanceObject.make [ a
                      b
                      c ]

with setting should be

InstanceObject.make [ a; b; c ]
let  f x =
    Case.fromCaseTimeline [ { mockClaim with x = 5 }
                              |> Event.claim "42"
                              |> Commit.caseCommit System.DateTime.Now ]

currently formatted

let f x =
    Case.fromCaseTimeline [ { mockClaim with x = 5 }
                            |> Event.claim "42"
                            |> Commit.caseCommit System.DateTime.Now ]

with setting should be

let f x =
    Case.fromCaseTimeline
        [ { mockClaim with x = 5 }
          |> Event.claim "42"
          |> Commit.caseCommit System.DateTime.Now ]

Extra information

Estimated cost (XS, S, M, L, XL, XXL): S or M

Related suggestions:

Affidavit (please submit!)

Please tick this by placing a cross in the box:

Please tick all that apply:

  • This is not a breaking change to Fantomas
  • I or my company would be willing to help implement and/or test this
  • This suggestion is part of the Microsoft style guide (please add a link to section if so)
  • This suggestion is part of the G-Research style guide: not directly related to the guide but GR does not use anything Elmish internally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant