Issue created from fantomas-online
Code
let helpers =
{ new IDecoderHelpers<JToken> with
member _.isString jsonValue =
not (isNull jsonValue) && jsonValue.Type = JTokenType.String
member _.asFloat jsonValue = jsonValue.Value<float>()
member _.asInt jsonValue = jsonValue.Value<int>()
member _.getObjectKeys jsonValue =
jsonValue.Value<JObject>().Properties()
|> Seq.map (fun prop -> prop.Name)
member _.getField(fieldName: string, jsonValue: JToken) = jsonValue[fieldName]
}
let helpers2 =
{ new IDecoderHelpers<JToken> with
member _.anyToString jsonValue =
if isNull jsonValue then
"null"
else
use stream = new StringWriter(NewLine = "\n")
stream.ToString()
}
Result
let helpers =
{ new IDecoderHelpers<JToken> with
member _.isString jsonValue =
not (isNull jsonValue) && jsonValue.Type = JTokenType.String
member _.asFloat jsonValue = jsonValue.Value<float>()
member _.asInt jsonValue = jsonValue.Value<int>()
member _.getObjectKeys jsonValue =
jsonValue.Value<JObject>().Properties() |> Seq.map (fun prop -> prop.Name)
member _.getField(fieldName: string, jsonValue: JToken) = jsonValue[fieldName]
}
let helpers2 =
{ new IDecoderHelpers<JToken> with
member _.anyToString jsonValue =
if isNull jsonValue then
"null"
else
use stream = new StringWriter(NewLine = "\n")
stream.ToString() }
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 the member _.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
{ config with
AlternativeLongMemberDefinitions = true
MultiLineLambdaClosingNewline = true }
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.
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.