scalameta / scalafmt

Code formatter for Scala
http://scalameta.org/scalafmt
Apache License 2.0
1.42k stars 276 forks source link

[question] Pattern matching constructor indentation #4112

Closed YanDoroshenko closed 1 month ago

YanDoroshenko commented 1 month ago

Hi. I'm trying to align constructor parameters in pattern matching. Seems like they are being indented by 4 by default and I can't find which configuration parameter is responsible for this behavior. I've tried all of them from the indent group that made sense and nothing seems to affect it.

Configuration (required)

Please paste the smallest possible set of .scalafmt.conf configuration parameters that reproduces the problem:

version = 3.8.2
runner.dialect = scala213
preset = Intellij

maxColumn = 20
...

Command-line parameters (required)

When I run scalafmt via CLI like this: scalafmt

Steps

Given code like this:

object Test {

  val x: Tuple2[
    Int,
    Int
  ]

  x match {
    case Tuple2(
          a,
          b
        ) =>
      ???
  }
}

Problem

Scalafmt formats code like this:

object Test {

  val x: Tuple2[
    Int,
    Int
  ]

  x match {
    case Tuple2(
          a,
          b
        ) =>
      ???
  }
}

Expectation

I would like the formatted output to look like this:

object Test {

  val x: Tuple2[
    Int,
    Int
  ]

  x match {
    case Tuple2(
      a,
      b
        ) =>
      ???
  }
}
kitbellew commented 1 month ago

you are correct, there are no parameters to accomplish this.

kitbellew commented 1 month ago

@YanDoroshenko going forward, if you have a question rather than a bug report, please use the discord channel to ask it, please.