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

When folding tuples the trailing comma is not removed #3663

Closed
pieter-bos opened this issue Oct 18, 2023 · 1 comment · Fixed by #3665
Closed

When folding tuples the trailing comma is not removed #3663

pieter-bos opened this issue Oct 18, 2023 · 1 comment · Fixed by #3665

Comments

@pieter-bos
Copy link

pieter-bos commented Oct 18, 2023

Configuration

version = 3.7.14
runner.dialect = scala213
newlines.source = fold

Command-line parameters

$ scalafmt --version
scalafmt 3.7.14

$ scalafmt src

$ scalafmt src
/(...)/src/Main.scala:2: error: [dialect scala213] illegal start of simple expression
  val x = ("a", "b", )
                     ^

Steps

Given code like this:

object Main {
  val x = (
    "a", 
    "b",
  )

  val y = Seq(
    "a",
    "b",
  )
}

Problem

Scalafmt formats code like this:

object Main {
  val x = ("a", "b", )

  val y = Seq("a", "b")
}

Expectation

I would like the formatted output to look like this:

object Main {
  val x = ("a", "b")

  val y = Seq("a", "b")
}

Notes

I also tried with rewrite.trailingCommas.allowFolding = false and this does not help.

@kitbellew
Copy link
Collaborator

fyi, #3743 reported additional bugs.

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