how to let scalafmt move multiple line string to new line

340 Views Asked by At

When there's multiple-line-string in a function call as parameter, my scalafmt will always put the start of it in the same line of previous codes, and the following string lines will have a long indent based on start position of string start. for example:

      val ret = sql(s"""
                       |SELECT a, b, c, d
                       |    FROM table_a
                       |WHERE xxx='1'
      """.stripMargin)

It will easily cause "code line too long" format problem, and I also think it's very ugly. I hope the multiple-line-string will start from a new line, and have a short indent, which would be like this:

      val ret = sql(
        s"""
           |SELECT a, b, c, d
           |    FROM table_a
           |WHERE xxx='1'
        """.stripMargin)

Is there any configuration in .scalafmt.conf could achieve it?

0

There are 0 best solutions below