diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala index f1a1da7902..30d6298c9b 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala @@ -373,6 +373,7 @@ class Router(formatOps: FormatOps) { } => val modification: Modification = leftOwner match { case _: Mod => Space + case _: Init => Space case t: Term.Name if style.spaces.afterTripleEquals && t.tokens.map(_.syntax) == Seq("===") => diff --git a/scalafmt-tests/src/test/resources/newlines/alwaysBeforeTopLevelStatements.stat b/scalafmt-tests/src/test/resources/newlines/alwaysBeforeTopLevelStatements.stat index fc3ce5c427..f09a078f8a 100644 --- a/scalafmt-tests/src/test/resources/newlines/alwaysBeforeTopLevelStatements.stat +++ b/scalafmt-tests/src/test/resources/newlines/alwaysBeforeTopLevelStatements.stat @@ -144,7 +144,7 @@ object A { @Annotation class B @Singleton - class B @Inject()(val x: Int) + class B @Inject() (val x: Int) @js.native class C() { def c = 5 @@ -157,7 +157,7 @@ object A { class B @Singleton - class B @Inject()(val x: Int) + class B @Inject() (val x: Int) @js.native class C() { @@ -294,7 +294,7 @@ object a { } /** Implements the ..... /status/about, etc */ - class Status @Inject()(ws: WSClient) { + class Status @Inject() (ws: WSClient) { ??? } diff --git a/scalafmt-tests/src/test/resources/spaces/Hacking.stat b/scalafmt-tests/src/test/resources/spaces/Hacking.stat index 3261c3b858..60594ee9e3 100644 --- a/scalafmt-tests/src/test/resources/spaces/Hacking.stat +++ b/scalafmt-tests/src/test/resources/spaces/Hacking.stat @@ -3,3 +3,7 @@ maxColumn = 40 function(a, b, c) >>> function( a, b, c ) +<<< Space between annotation and ctor argument list +class A @Inject()(b: C) +>>> +class A @Inject() (b: C)