-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
[Feature request] fsharp_max_if_then_short_width #2299
Comments
This needs some discussion per @nojaf's comments above |
Yes, to some extent. At least we can detect when in the first part of a sequential, which is by far the most common case. This would then mean let someFunction() =
if expr then expr else expr
1+1 could always suppress single-line if-then-else and format as: let someFunction() =
if expr then
expr
else
expr
1+1 It would not apply in this case: let someFunction() =
if expr then expr else expr but that will be relatively rare for short if-then-else. (We would also have the option of considering this to be imperative/control-flow in all cases) However either way would be an imperfect implementation of "Use multi-line formatting for imperative code" (assuming that is what we add to the style guide). |
Oh boy 🙈, this is easier said than done. |
How about just defaulting fsharp_max_if_then_else_short_width to 0 (and also in the style guide). A pragmatic solution that would require much less work and not cause much harm (IMO any single-line if/if-else block is unreadable). |
@dsyme looking at fsharp/fslang-design#646 (comment).
Where would this current guidance fall into: Do both settings have no effect on this? And we format this compactly if each line |
I propose we add
fsharp_max_if_then_short_width
. Style guide update TBDSlack conversation with @nojaf:
Pros and Cons
The advantages of making this adjustment to Fantomas are more explicit formatting of some imperative code
The disadvantages of making this adjustment to Fantomas are not all cases of imperative code are covered
Examples
Please provide multiple examples (before and after scenarios) and explain what rules did apply to achieve the outcome.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: (put links to related suggestions here)
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
The text was updated successfully, but these errors were encountered: