-
-
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
Unwanted space before DU cases when pattern matching #2369
Comments
Hello, thank you for raising this issue. It might be me, and I haven't finished my first coffee on a Monday morning, but where does the guide mention this explicitly of the space? It makes sense to change this but this can be a bit of an impactful change for many users, so I really would like to have crystal clear guidance to be able to justify this change. A code sample in the F# style guide without any explicit text isn't really reliable. Currently, the setting |
Hmm on reading I can't find anything explicit actually, but all the examples are without the space. I also think of it as exactly the same the construction of something – ie
Yea I think that makes sense. It should always follow the same spacing rule as the construction of a DU – which is very similar to an uppercase invocation. @nojaf Is there anyone at Microsoft/F# committee we can confer with? Philip Carter? |
Please raise this over at https://github.com/fsharp/fslang-design#style-guide. |
The adding of space is very inconsistent to how expressions are handled. I'd expect Fantomas to use |
Created an issue: fsharp/fslang-design#712. |
This is available in the 5.1 series. |
Issue created from fantomas-online
Code
Result
Problem description
Fantomas adds a space before the parenthesis for the Discriminated Union cases when pattern matching. According to the F# style guide, there should not be such a space: https://docs.microsoft.com/en-us/dotnet/fsharp/style-guide/formatting#formatting-pattern-matching
It also makes sense to not have it since you contruct your object like
let myShape = Rect(4.0, 6.0)
, so the destructuring should look similarmatch myShape with Rect(w, h) -> .....
Also worth noting here is that the output from Fantomas does not match the example given in the README because of this behavior (see example above).
Extra information
Options
Fantomas master branch at 2022-07-15T14:30:45Z - 87cd212
Default Fantomas configuration
The text was updated successfully, but these errors were encountered: