-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
List of functions misaligned and breaks (Elmish) #2158
Comments
Hey Colin, another wonderful find from the 4.7 release 😅. |
We've got some fancily formatted code so we're good at finding some edge cases! It's also why I like Fantomas so much, so our code becomes and stays more uniform. :-) This one took a while to narrow down but the good news is that it's the last class of issues for us, and after other fixes, we now format cleanly with 4.7.3 |
Hey, after taking another look I have some more insights. This is a bug in terms that the fantomas/src/Fantomas/CodePrinter.fs Lines 1762 to 1766 in 3e8086f
The helper function That being said, the expression is correctly identified as an index (without dot) expression. This is not what you want when you are using Elmish inspired code. So use spaces to get there. Are you interested in submitting a PR for this one? |
I can give that go. I've already actioned the workaround in our codebase but it would nice if code in these styles could be reformatted safely. |
Issue created from fantomas-online
Code
Result
Problem description
This is an extraction of some involved Elmish code.
Fantomas.FormatConfig+FormatException: Formatted content is not valid F# code
The online tool clarifies the issue:
It seems as if the top level bind is being prioritised over the list constructions.
The issue seems to have started somewhere between 4.6.0 and 4.7.x
Extra information
Options
Fantomas master branch at 2022-03-15T07:45:16Z - f10e239
Default Fantomas configuration
Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?
The text was updated successfully, but these errors were encountered: