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 e5abdf58cf..6825a4cb21 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 @@ -1100,7 +1100,8 @@ class Router(formatOps: FormatOps) { else None val mustDangle = onlyConfigStyle || - style.newlines.sourceIgnored && style.danglingParentheses.defnSite + style.danglingParentheses.defnSite && + (style.newlines.sourceIgnored || !style.optIn.configStyleArguments) def noSplitPolicy: Policy = if (mustDangle || style.newlines.source.eq(Newlines.unfold)) slbPolicy @@ -1245,7 +1246,7 @@ class Router(formatOps: FormatOps) { } else if ( mustDangleForTrailingCommas || style.danglingParentheses.tupleOrCallSite(isTuple(leftOwner)) && - style.newlines.sourceIgnored + (style.newlines.sourceIgnored || !style.optIn.configStyleArguments) ) newlineBeforeClose & binPackOnelinePolicy else binPackOnelinePolicy diff --git a/scalafmt-tests/src/test/resources/newlines/source_classic.stat b/scalafmt-tests/src/test/resources/newlines/source_classic.stat index b5595a9323..b8d7b570fd 100644 --- a/scalafmt-tests/src/test/resources/newlines/source_classic.stat +++ b/scalafmt-tests/src/test/resources/newlines/source_classic.stat @@ -2553,7 +2553,8 @@ object a { object a { val foo = bar.map(x => x.copy( - baz = Option.when(false)(x.qux)) + baz = Option.when(false)(x.qux) + ) ) } <<< binPack with named parameter values, !danglingParentheses @@ -2679,9 +2680,10 @@ object a { } >>> object a { - protected def foo[U](bar: String, - baz: Seq[String] = Seq.empty)( - f: HttpResponse => U): U = qux + protected def foo[U]( + bar: String, + baz: Seq[String] = Seq.empty + )(f: HttpResponse => U): U = qux } <<< #1973 1 maxColumn = 25 diff --git a/scalafmt-tests/src/test/resources/newlines/source_keep.stat b/scalafmt-tests/src/test/resources/newlines/source_keep.stat index 02286788ac..61a163a5c1 100644 --- a/scalafmt-tests/src/test/resources/newlines/source_keep.stat +++ b/scalafmt-tests/src/test/resources/newlines/source_keep.stat @@ -2641,7 +2641,8 @@ object a { bar.baz(Seq( Qux( "", 1, "par1", "2018-01-01", "2018-12-31", "2018-01-01", "2018-02-01", None, None, 1000, - Some(0), Some(1), foo = Some("bar")) + Some(0), Some(1), foo = Some("bar") + ) )) ) } @@ -2666,7 +2667,8 @@ object a { >>> object a { private val audience3 = apiAudience( - 3, "b_name", Sams, Inid, "2", "created-by-user2", "updated-by-user2").copy( + 3, "b_name", Sams, Inid, "2", "created-by-user2", "updated-by-user2" + ).copy( updatedAt = nowDate.minusDays(15), audienceSizeOnsite = Some(3333), audienceSizeOffsite = Some(1) @@ -2683,9 +2685,12 @@ object a { } >>> object a { - protected def foo[U](bar: String, - baz: Seq[String] = Seq.empty)( - f: HttpResponse => U): U = qux + protected def foo[U]( + bar: String, + baz: Seq[String] = Seq.empty + )( + f: HttpResponse => U + ): U = qux } <<< #1973 1 maxColumn = 25