-
-
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
Newline inconsistency in object expression #2990
Comments
Hi there,
This is a topic for the style guide.
In |
You say that let helpers =
{ new IEncoderHelpers<JToken> with
member _.encodeUInt32 value = JValue(box value) }
let helpers2 =
{ new IEncoderHelpers<JToken> with
member _.encodeUInt32 value = JValue(box value)
} Result let helpers =
{ new IEncoderHelpers<JToken> with
member _.encodeUInt32 value = JValue (box value)
}
let helpers2 =
{ new IEncoderHelpers<JToken> with
member _.encodeUInt32 value = JValue (box value)
} In both cases the Options [*.{fs,fsx}]
max_line_length = 80
fsharp_space_before_uppercase_invocation = true
fsharp_alternative_long_member_definitions = true
fsharp_multi_line_lambda_closing_newline = true
fsharp_bar_before_discriminated_union_declaration = true
fsharp_multiline_bracket_style = stroustrup
fsharp_keep_max_number_of_blank_lines = 2 |
Oh, I see. Your original report did not mention Stroustrup cannot be applied in absolutely every situation. I was convinced that let x = { new System.IDisposable with
member _.Dispose () = ()
} was invalid code. (Producing an offset error). This does not seem the case. So, we could double-check whether is indeed possible for object expressions. |
Yeah that's sounds correct to me as far as what we did. However, wouldn't something like this be valid if we wanted to more strictly apply Stroustrup here? let x = {
new System.IDisposable with
member _.Dispose () = ()
} This would be how I would expect Stroustrup style to be applied here. |
If it always leads to valid code, I'd be ok with this. |
It is mentioned in the style guide. Guess this is possible. |
Ah yes sorry, I have a hard time finding which settings I have setup locally and not in the online tool. |
Issue created from fantomas-online
Code
Result
Problem description
I believe it would be better if there was a new line between each member, this would make the code more consistent. I think that if all the member are single line then not having a new line is fine.
Also, the placement of the trailing
}
is not always placed on a new line. I don't know what triggers that because in my project, I have a similar code as themember _.anyToString jsonValue =
method and the}
is placed on a new line and indented under the leading{
.Extra information
Options
Fantomas main branch at 1/1/1990
Did you know that you can ignore files when formatting by using a .fantomasignore file?
PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.
The text was updated successfully, but these errors were encountered: