Skip to content

Commit

Permalink
Router: make sure to indent comments after lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Jun 10, 2023
1 parent 7963e93 commit 67c6476
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,17 @@ class Router(formatOps: FormatOps) {
) None
else Some(false)
val indents =
Nil
if (nlOnly.contains(false)) {
val beforeClose = tokens.prevNonCommentBefore(closeFT).right
if (beforeClose eq close) Nil
else {
val indent = style.indent.main
List(
Indent(indent, close, Before),
Indent(-indent, beforeClose, Before)
)
}
} else Nil
(expire, arrow.map(_.left), indents, nlOnly)
case Some(t: Case) if t.cond.isEmpty && (leftOwner match {
case Term.PartialFunction(`t` :: Nil) => true
Expand Down
2 changes: 1 addition & 1 deletion scalafmt-tests/src/test/resources/unit/Comment.stat
Original file line number Diff line number Diff line change
Expand Up @@ -1080,5 +1080,5 @@ foo.foreach { x =>
>>>
foo.foreach { x =>
x + 1
// c1
// c1
}

0 comments on commit 67c6476

Please sign in to comment.