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
Inconsistent styling when using Stroustrup, MaxRecordWidth and MultilineBlockBracketsOnSameColumn with or without member attach to record creation #2652
Comments
Hey Maxime, thanks for raising this issue. |
So initially this was an intentional exception due to AST limitations at the time, and we haven't yet reached a consensus on the best way to approach this style. I actually mentioned in the style guide discussion that I was personally in favor of using the Stroustrup style here with the |
Hello Maxime, the style guide does not recommend having the with keyword in the first place, which is why when a record type has members, it resolves to the Allman style to avoid having offset errors. This reasoning could be considered consistent and I could close this issue here and now. Stroustrup is not part of the style guide so any new issue could always be closed on sight. I encourage you to engage in fsharp/fslang-design#706 to change this. Overall I would be ok with having the |
Just wanted to mention that Stroustrup is now part of the style guide (see Multiline bracket formatting styles). Moreover, an exception to the rule discouraging the // ✔️ OK
type PostalAddress = {
Address: string
City: string
Zip: string
} with
member x.ZipAndCity = $"{x.Zip} {x.City}" |
@corsinpfister Thank you for the reminder, I actually added those updates to the style guide myself, in part due to this issue, but I had actually forgotten to add the changes to bring the style in line in fantomas itself here. We'll try and get this included in the next major release 👍🏻 |
Available in v6. |
Issue created from fantomas-online
Code
Result
Problem description
Please describe here the Fantomas problem you encountered.
Check out our Contribution Guidelines.
If user enable Stroustrup I think it should be applied everywhere and in the case of the
member
it should written with the additionalwith
keyword to make the code valid.This is just to show the code, the placement of the
with
need to be reflected uponExtra information
Options
Fantomas main branch at 2022-12-03T22:59:05Z - 47c6ac6
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: