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

Add comma in front of expression in tuple with if/then/else #1319

Closed
3 tasks
nojaf opened this issue Dec 22, 2020 · 1 comment · Fixed by #1321 or #1326
Closed
3 tasks

Add comma in front of expression in tuple with if/then/else #1319

nojaf opened this issue Dec 22, 2020 · 1 comment · Fixed by #1321 or #1326

Comments

@nojaf
Copy link
Contributor

nojaf commented Dec 22, 2020

Issue created from fantomas-online

Code

let y =
    if String.IsNullOrWhiteSpace(args) then
        ""
    elif args.StartsWith("(") then
        args
    elif v.CurriedParameterGroups.Count > 1
         && (not verboseMode) then
        " " + args
    else
        sprintf "(%s)" args
    , namesWithIndices

Result

let y =
    if String.IsNullOrWhiteSpace(args) then
        ""
    elif args.StartsWith("(") then
        args
    elif v.CurriedParameterGroups.Count > 1
         && (not verboseMode) then
        " " + args
    else
        sprintf "(%s)" args,
    namesWithIndices

Problem description

This is similar to #1269, SynExpr.IfThenElse needs to be taken into account as well.

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 12/22/2020 20:24:38 - 88235c3

Default Fantomas configuration

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

@nojaf
Copy link
Contributor Author

nojaf commented Dec 23, 2020

This didn't solve the problem, unfortunately.
image

Add the comma upfront only works when the else branch is in one line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant