-
-
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
Revisit Elmish code #2180
Comments
The removal of these settings unfortunately seems to make it not possible to have nicely formatted Feliz code like it was possible in V4 with single_argument_web_mode. With single_argument_web_mode=true it was nicely formatted with default settings: Fantomas Tools That doesn't seem to be possible now in the newest preview, with the defaults and Stroustroup enabled: Fantomas Tools Is this actually supported and I am missing something? |
Hello, you need to enable |
Ah, thanks! Good to see that it still works, was worried for a second there :) |
Introduction
We currently have multiple settings to control a subset of function applications with array/lists as arguments.
The rationale behind this is described in Formatting Elmish style guide and has a certain overlap with #1408. #1275 is always related in a way and it would be nice if we can consolidate everything in a general fashion.
Proposal
As part of #1408, I propose to move and expand the current Elmish settings. To generalize and apply an alternative style for function applications that end with a list/array.
Scope
Every (nested) SynExp.App that ends with one or two SynExpr.ArrayOrListComputed (or SynExpr.ArrayOrList).
Examples:
Arguments before the final list arguments can be of any SynExpr.
Rules
First of, try and fit the expression on one line:
If the expression is longer than a threshold (be it max_line_length or fsharp_max_elmish_width)
It should put the elements of the list on the next line indented:
Assuming the function name and additional arguments (
fn a
) fit on the same line, otherwise the default formatting rules should apply.When there are two lists at the end, there would be slight variation where the same rules are applied.
Notice that the
] [
is on a separate line to visually indicate the difference of the elements of both list.In Elmish code, the first list typically has properties, where the second list will contains children.
Real world samples
These formatted according to the rules above.
Open questions
Stroustrup bracket style
? I personally believe so, but I'm open to ideas.The text was updated successfully, but these errors were encountered: