Skip to content
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

List expression can get combined to a single line with different semantics #931

Closed
johlrich opened this issue Jun 24, 2020 · 0 comments · Fixed by #981
Closed

List expression can get combined to a single line with different semantics #931

johlrich opened this issue Jun 24, 2020 · 0 comments · Fixed by #981

Comments

@johlrich
Copy link
Contributor

Issue created from fantomas-online

Please describe here fantomas problem you encountered

When typing a list expression that can be combined to a single line, it will do so after the formatting, changing the semantics of the expression.

If you then format that same file again, it will expand back into different lines explicitly showing the nested evaluation

Code

let original_input = [
  if true then yield "value1"
  if false then yield "value2"
  if true then yield "value3"
]

let after_first_save = [ if true then yield "value1"; if false then yield "value2"; if true then yield "value3" ]

let final_stable =
    [ if true then
        yield "value1"
        if false then
            yield "value2"
            if true then yield "value3" ]

printfn "%A" original_input
printfn "%A" after_first_save
printfn "%A" final_stable

Result

let original_input = [ if true then yield "value1"; if false then yield "value2"; if true then yield "value3" ]

let after_first_save =
    [ if true then
        yield "value1"
        if false then
            yield "value2"
            if true then yield "value3" ]

let final_stable =
    [ if true then
        yield "value1"
        if false then
            yield "value2"
            if true then yield "value3" ]

printfn "%A" original_input
printfn "%A" after_first_save
printfn "%A" final_stable

Options

Fantomas Master at 06/24/2020 06:54:29 - d962694

Name Value
IndentSpaceNum 4
PageWidth 120
SemicolonAtEndOfLine false
SpaceBeforeParameter true
SpaceBeforeLowercaseInvocation true
SpaceBeforeUppercaseInvocation false
SpaceBeforeClassConstructor false
SpaceBeforeMember false
SpaceBeforeColon false
SpaceAfterComma true
SpaceBeforeSemicolon false
SpaceAfterSemicolon true
IndentOnTryWith false
SpaceAroundDelimiter true
MaxIfThenElseShortWidth 120
MaxInfixOperatorExpression 120
MaxRecordWidth 120
MaxArrayOrListWidth 120
MaxValueBindingWidth 120
MaxFunctionBindingWidth 120
MultilineBlockBracketsOnSameColumn false
NewlineBetweenTypeDefinitionAndMembers false
KeepIfThenInSameLine false
MaxElmishWidth 120
StrictMode false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant