-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
fsharp_experimental_stroustrup_style=true breaks on types with nested anonymous records #2413
Comments
Hello, A couple of things here. Using Enabling both will lead to valid code: type MangaDexAtHomeResponse = {
baseUrl: string
chapter: {| hash: string //
data: string[] |}
} However, and this might be the point you are trying to make, the anonymous type does not appear in the Are you interested in submitting a PR for this? |
Just to add onto this, I'm seeing this with both stroustrup and multiline block brackets same column. let foo = {| Data = {| Name = "Isaac"; Age = 43; Day = "Monday"; Colour = "Blue" |} |} goes to let foo =
{| Data =
{| Name = "Isaac"
Age = 43
Day = "Monday"
Colour = "Blue" |} |} rather than what I would like to see: let foo = {|
Data = {|
Name = "Isaac"
Age = 43
Day = "Monday"
Colour = "Blue"
|}
|} This is important for us on Farmer because we create very deeply nested anonymous records which represent Azure ARM JSON. Without this setting, the files go wide very quickly (although the Stroustrup setting does help otherwise e.g. lists etc.). Once you get to 120 characters width, Fantomas starts to (understandable) wrap text very quickly, leading to files that are very long yet lines that are 95% white space and just a few symbols at the very end. |
Confusingly, whilst inside an anonymous record, even lists seem to stop obeying the Stroustrup style. Apologies - the link here doesn't seem to include settings (or the one in the post immediately above). Both are set in the Fantomas web app to 5.x, Multiline Block Brackets on Same Column = true and Experimental Stroustrup Style = true. Nothing else changed. |
@josh-degraw thanks for fixing this :-) @nojaf Apologies... Farmer suffers from this enough that I'm happy to contribute to an issue and give minimal repros. But I simply don't have the time to contribute more to this project, as much as I would love to :-( |
Is this change cascaded into editorconfig or are the old two settings still valid? |
I made sure in #2658 to keep backwards compatibility, so the old settings should still work, but there is a new editorconfig setting that should hopefully be less confusing :) |
I'm still on 5.1.x anyway. I've now found the release notes and that explains all the changes. Thanks! |
Issue created from fantomas-online
Code
Result
Problem description
I often use types with nested anonymous records when modeling JSON responses from external APIs. The new
fsharp_experimental_stroustrup_style
setting seems to break on such type declarations.Extra information
Options
Fantomas master branch at 2022-08-06T07:12:17Z - c1d5250
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: