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

Idempotency problem when Elmish Html #2195

Closed
1 of 2 tasks
dab-lmis opened this issue Apr 7, 2022 · 4 comments
Closed
1 of 2 tasks

Idempotency problem when Elmish Html #2195

dab-lmis opened this issue Apr 7, 2022 · 4 comments

Comments

@dab-lmis
Copy link

dab-lmis commented Apr 7, 2022

Issue created from fantomas-online

Formatted code

Html.div
  [ Html.div[prop.children[renderEditor
                             35
                             150
                             (EditorValue.DatumOderStatus x.MontageStartStatus2)
                             update]

    prop.style
      [ bestimmeWarnungsfarbe (
          x.Abweichungen
          |> Option.map (fun x -> x.MontageStart)
        ) ]]
    Editors.RenderPlaceHolder classes.placeholder 35 150 ]

Reformatted code

Html.div
  [ Html.div[prop.children
               [ renderEditor 35 150 (EditorValue.DatumOderStatus x.MontageStartStatus2) update ]

               prop.style
               [ bestimmeWarnungsfarbe (
                   x.Abweichungen
                   |> Option.map (fun x -> x.MontageStart)
                 ) ]]
    Editors.RenderPlaceHolder classes.placeholder 35 150 ]

Problem description

Fantomas was not able to produce the same code after reformatting the result.

Extra information

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

Options

Fantomas 4.7.3

    { config with
                IndentSize = 2
                MaxLineLength = 100
                MaxRecordNumberOfItems = 2
                RecordMultilineFormatter = number_of_items
                MaxArrayOrListWidth = 20
                MaxArrayOrListNumberOfItems = 2
                MaxValueBindingWidth = 60
                MaxFunctionBindingWidth = 60
                DisableElmishSyntax = true }

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

@nojaf
Copy link
Contributor

nojaf commented Apr 7, 2022

Hello, thank you for reporting this issue.
This problem looks related to #2158.
The idempotency problem doesn't appear when there is a space before [.
Sample

Please note that Html.div[prop.children... is considered indexer syntax now.
So, fixing the issue above might not lead to what you are after.
Is there any reason you went with DisableElmishSyntax = true and not SingleArgumentWebMode = true

@dab-lmis
Copy link
Author

dab-lmis commented Apr 8, 2022 via email

@nojaf
Copy link
Contributor

nojaf commented Apr 8, 2022

Hi Daniel,

Happy to help. If you have any more questions you can always find some help on our Discord server.
I'll leave this issue open as it is indeed a problem.

@nojaf
Copy link
Contributor

nojaf commented Aug 24, 2022

Fixed by #2446

@nojaf nojaf closed this as completed Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants