diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/ModExt.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/ModExt.scala index a5a1d2eaf..c321dc024 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/ModExt.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/ModExt.scala @@ -22,7 +22,7 @@ case class ModExt( @inline def res(suffix: String) = { val ind = if (indents.isEmpty) "" else indents.mkString("[", ", ", "]") - s"$prefix$mod($indentPrefix$ind)$suffix" + s"$prefix$mod$indentPrefix$ind$suffix" } altOpt match { diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/util/LoggerOps.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/util/LoggerOps.scala index 80ed125b6..89d145452 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/util/LoggerOps.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/util/LoggerOps.scala @@ -86,7 +86,10 @@ object LoggerOps { def tokWithoutPos(token: T): String = { val desc = token.structure val posidx = desc.lastIndexOf('[') - if (posidx > 0) desc.substring(0, posidx - 1) else desc + val len = if (posidx > 0) posidx - 1 else desc.length + val txtidx = desc.indexOf('(') + if (txtidx < 0 || len <= txtidx + 52) desc.substring(0, len) + else desc.substring(0, txtidx + 50) + "...)" } def log(range: InputRange): String = s"[${range.start}..${range.end})"