Skip to content

Commit

Permalink
FormatWriter: fix indentation detection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Dec 28, 2021
1 parent bfb89fb commit e31971a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class FormatWriter(formatOps: FormatOps) {
protected final val breakBefore = curr.hasBreakBefore
protected final val indent =
if (breakBefore) prevState.indentation
else prevState.prev.indentation
else math.max(prevState.indentation, prevState.prev.indentation)
// extra 1 is for "*" (in "/*" or " *") or "/" (in "//")
protected final val maxLength = maxColumn - indent - extraIndent - 1

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 @@ -665,7 +665,7 @@ object a {
>>>
object a {
def foo( /* First 2 will not be taken into
* account */
* account */
foo1: Int, foo2: String, /* Next 2 will not
* be taken into account since
* 'filterDoNotSellBy' is not set */
Expand Down

0 comments on commit e31971a

Please sign in to comment.