-
Notifications
You must be signed in to change notification settings - Fork 143
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
[style-guide] Question about match block having vanity indentation #646
Comments
So, this happens because we added the exception of infix expressions in The main reason to have this was that a lot of tests were impacted for if directoryRouter.GetIdentity()
|> self.ServerDescriptors.TryFind then
CircuitNodeDetail.FastCreate
else
self.ConvertToCircuitNodeDetail serverDescriptor then also as a vanity alignment? I'm asking because I want to be a bit cautious that we don't go too far here as this will have a lot of impact on a lot of end-user code. I've raised dotnet/docs#26507 to get some clarification. |
I would prefer that match
directoryRouter.GetIdentity()
|> self.ServerDescriptors.TryFind
with
| None -> CircuitNodeDetail.FastCreate
| Some serverDescriptor -> self.ConvertToCircuitNodeDetail serverDescriptor Then the formatting would be inline with the formatting of The following formatting of if directoryRouter.GetIdentity()
|> self.ServerDescriptors.TryFind then
CircuitNodeDetail.FastCreate
else
self.ConvertToCircuitNodeDetail serverDescriptor |
Hey @hvester those are very good points! Do you mind creating PRs in the style-guide to address those? I'm thinking 1 PR for the match thing and another one for the if thing. |
And they would reference to address this issue: dotnet/docs#26507 (or rather, discuss in the issue before proposing PR). |
Arghhh, unfortunately that snippet doesn't compile @hvester. So the 4 spaces before the |
I've added a comment on the style-guide question here: dotnet/docs#26507 (comment) |
In short I propose we make the following the default in the style guide
match
directoryRouter.GetIdentity ()
|> self.ServerDescriptors.TryFind
with
| None ->
CircuitNodeDetail.FastCreate
| Some serverDescriptor ->
self.ConvertToCircuitNodeDetail serverDescriptor
if
long-thing &&
another-long-thing &&
another-long-thing &&
another-long-thing
then
|
I do wonder if the default |
It seems reasonable to increase |
Relegating the boolean operators to the end of the line doesn't make it clearer to me. I have same feeling about trailing commas rather than leading, and I think it is minority of people who get acquainted with puttingin leading position. Still, since F# likes to put operator such as if
long-thing &&
another-long-thing &&
another-long-thing &&
another-long-thing
then is actually better than (especially with long things): if
long-thing
&& another-long-thing
&& another-long-thing
&& another-long-thing
then |
Please open a new issue for this. |
Issue created from fantomas-online
Code
Result
Expected Result
Extra information
Options
Fantomas 4.6 branch at 10/12/2021 15:28:15 - d7b4f109e13c86475ec3bb03ea7eeea7029d2e0c
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: