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

Error formatting if have single open bracket #2033

Closed
tr4r3x opened this issue Jun 18, 2020 · 0 comments · Fixed by #2034
Closed

Error formatting if have single open bracket #2033

tr4r3x opened this issue Jun 18, 2020 · 0 comments · Fixed by #2034

Comments

@tr4r3x
Copy link

tr4r3x commented Jun 18, 2020

This template is a guideline, not a strict requirement.

  • Version: 2.6.0
  • Integration: sbt scalafmtAll via terminal
  • Configuration:
version = 2.6.0
align = more
maxColumn = 120
docstrings = ScalaDoc
align.openParenCallSite = true
align.openParenDefnSite = true
align.tokens = [
  {code = "=>", owner = "Case"},
  {code = "%", owner = "Term.ApplyInfix"},
  {code = "%%", owner = "Term.ApplyInfix"}
]
newlines.alwaysBeforeTopLevelStatements = true
rewrite.rules = [PreferCurlyFors, SortImports]
optIn.breakChainOnFirstMethodDot = false

Steps

Given code like this:

class Test {

  val testCases = List(
    ("Old state", "Campaign data", "Expected state"),
    (
      1,
      2,
      3
    )
  )
}

When I run scalafmt like this:

sbt scalafmtAll

Problem

Error is thrown:

[error] .../Test.scala:7: error: Unable to format file due to bug in scalafmt
[error]     (
[error]     ^: ...Test.scala

Expectation

I would like the code to be formatted

Workaround

I've found that by not letting single bracket to be on the line, the formatter will work. e.g.:

class Test {

  val testCases = List(
    ("Old state", "Campaign data", "Expected state"),
    (1, 2, 3)
  )
}

Notes

Used org.scalameta:sbt-scalafmt_2.12:2.4.0 plugin version. Original code, on which scalafmt fails, is valid and compiles. With 2.5.3 it works fine

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