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

Formatting error with MultilineBlockBracketsOnSameColumn #1396

Closed
2 tasks
knocte opened this issue Jan 26, 2021 · 7 comments · Fixed by #1441
Closed
2 tasks

Formatting error with MultilineBlockBracketsOnSameColumn #1396

knocte opened this issue Jan 26, 2021 · 7 comments · Fixed by #1441

Comments

@knocte
Copy link
Contributor

knocte commented Jan 26, 2021

Issue created from fantomas-online

Code

namespace GeeTower.Tests.EndToEnd

module WatcherTests =

    let CanRevokeAnIllegalCommitmentTx () =
        let lndAddress = obj()

        let config = { 
            GeeTower.Backend.Configuration.GetTestingConfig (lndAddress.ToString())
            with 
                BitcoinRpcUser = "btc"
        }

        ()

Error

Fantomas was able to format the code but the result appears to be invalid F# code.
Please open an issue.

Formatted result:

namespace GeeTower.Tests.EndToEnd

module WatcherTests =

    let CanRevokeAnIllegalCommitmentTx () =
        let lndAddress = obj ()

        let config =
            { GeeTower.Backend.Configuration.GetTestingConfig(
                lndAddress.ToString()
            ) with
                BitcoinRpcUser = "btc"
            }

        ()

Extra information

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

Options

Fantomas Master at 01/23/2021 17:11:48 - 6d75fff

    { config with
                MaxLineLength = 80
                MultilineBlockBracketsOnSameColumn = true }

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

nojaf commented Jan 26, 2021

I believe this is also a bug when MultiLineLambdaClosingNewline = false.
I'm guessing

+> genExpr astContext e

Could use an atCurrentColumnIndent if the existing record expression is multiline (GeeTower.Backend.Configu...).

@knocte
Copy link
Contributor Author

knocte commented Jan 27, 2021

I believe this is also a bug when MultiLineLambdaClosingNewline = false.

Oh you're right, sorry!

@knocte knocte changed the title Using both MultilineBlockBracketsOnSameColumn and MultiLineLambdaClosingNewline causes formatting error Formatting error with MultilineBlockBracketsOnSameColumn Jan 27, 2021
@knocte
Copy link
Contributor Author

knocte commented Feb 2, 2021

@nojaf what should be the expected results here?

@nojaf
Copy link
Contributor

nojaf commented Feb 2, 2021

To make it valid I believe it would be:

let config =
    { GeeTower.Backend.Configuration.GetTestingConfig(
        lndAddress.ToString()
      ) with
        BitcoinRpcUser = "btc"
    }

@knocte
Copy link
Contributor Author

knocte commented Feb 2, 2021

To make it valid I believe it would be:

Are you sure? Remember this bug only happens with MultilineBlockBracketsOnSameColumn=true. Therefore, I was thinking that to respect this setting, the snippet could be something like this:

let config =
    {
        GeeTower.Backend.Configuration.GetTestingConfig(
            lndAddress.ToString()
        ) with
            BitcoinRpcUser = "btc"
    }

Does that make sense?

@nojaf
Copy link
Contributor

nojaf commented Feb 2, 2021

I don't think that would match the GR style anymore then. Could you raise it in the GR style repository as well?

@knocte
Copy link
Contributor Author

knocte commented Feb 3, 2021

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.

2 participants