Description
I propose we...
Add the ability to use Stroustrup bracket styling.
The existing way of Fantomas deals with this problem is ...
Use the existing bracket formatting styles, which are not commonly used in most mainstream programming languages.
Pros and Cons
The advantages of making this adjustment to Fantomas are ...
Allowing people to have more control over how they want to format their code, and having a more widely-used (esp. outside of F#) formatting style as an option.
The disadvantages of making this adjustment to Fantomas are ...
Adding another configuration option,technical complexity, and potential conflicts with existing formatting rules.
Examples
The officially recommended way to declare the following record type is as follows:
type PostalAddress =
{ Address: string
City: string
Zip: string }
For many, this style feels strange. My team and I prefer to use Stroustrup style e.g.
type PostalAddress = {
Address: string
City: string
Zip: string
}
We like this because, among other reasons, it reduces the used horizontal space a little, makes it easier to reorder members, and just feels less messy. I am wanting to integrate fantomas to keep our code more consistent, and wanted to see if we could utilize that style for formatting at least record types.
I have used the fsharp_multiline_block_brackets_on_same_column=true
that feels a little better:
type PostalAddress =
{
Address : string
City : string
Zip : string
}
But it would be awesome to be able to format our code how we actually want it.
Extra information
Estimated cost (XS, S, M, L, XL, XXL):
L
Related suggestions: (put links to related suggestions here)
Affidavit (please submit!)
Please tick this by placing a cross in the box:
- I have read the Contribution Guidelines.
- I have searched both open and closed suggestions on this site and believe this is not a duplicate
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 (please add a link to section if so)
For readers:
Please leave:
- 👍if you use Fantomas today and would enable this setting
- 🎉if you do not use Fantomas today and would start using it after this feature
- 👎if you use Fantomas today and would not enable this setting.
Remaining work
- Document the boundaries of the setting
- Rename the current setting (We can't keep the name Ragnarok)
-
Investigate if(superceded by Update config to accept a single option for multiline_bracket_style #2658) .fsharp_multiline_block_brackets_on_same_column
should be implied astrue
automatically - Discuss/Implement Stroustrup: Type alias for anonymous record type #2179
- Revisit Elmish settings, Revisit Elmish code #2180