Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State: relativeToLhsLastLine on same-line comment #3359

Merged
merged 2 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ final case class State(
val tok = tokens(depth)
val right = tok.right
if (allowed.isEmpty) None
else if (right.is[Token.Comment]) Some(right.end)
else if (!isNL && right.is[Token.Comment]) Some(right.end)
else
indentEnd(tok, isNL) {
val earlierState = prev.prevNonCommentSameLine
Expand Down
27 changes: 27 additions & 0 deletions scalafmt-tests/src/test/resources/test/IndentOperator.stat
Original file line number Diff line number Diff line change
Expand Up @@ -4005,3 +4005,30 @@ object A {
}
}
}
<<< #3327 with comment on separate line
maxColumn = 100
indent.relativeToLhsLastLine = [match]
===
object A {
protected def test(): IO[Test] =
test(test, test, None)
.flatMap {
case Some(test) => test(test).map(_.filter(_.test > test))
case None => test(dataSetId)
}
.map(_.test())

/* Some comment */
}
>>>
object A {
protected def test(): IO[Test] =
test(test, test, None)
.flatMap {
case Some(test) => test(test).map(_.filter(_.test > test))
case None => test(dataSetId)
}
.map(_.test())

/* Some comment */
}