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

SelectLike: use nameFt if possible, vs nameToken #4529

Merged
merged 1 commit into from
Nov 10, 2024
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 @@ -1387,7 +1387,7 @@ class FormatOps(
ok &&
(thisTree match {
case _: Term.Match => // like select and apply in one
!tokenAfter(thisSelectLike.nameToken).right.is[T.LeftBrace] ||
!tokenAfter(thisSelectLike.nameFt).right.is[T.LeftBrace] ||
style.includeCurlyBraceInSelectChains &&
nextSelect.isDefined && !nextSelect.contains(lastApply)
case _ => checkParent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,7 @@ class Router(formatOps: FormatOps) {
}
val nextDotIfSig = nextSelect.flatMap { ns =>
val ok = checkFewerBraces(ns.qual)
if (ok) Some(tokenBefore(ns.nameToken)) else None
if (ok) Some(tokenBefore(ns.nameFt)) else None
}
def forcedBreakOnNextDotPolicy = nextSelect.map { selectLike =>
val tree = selectLike.tree
Expand Down Expand Up @@ -1959,8 +1959,9 @@ class Router(formatOps: FormatOps) {
if (nextDotIfSig.isEmpty)
if (nlOnly) Seq(nlSplitBase(0))
else {
val end = nextSelect
.fold(expire)(x => getLastNonTrivialToken(x.qual))
val end = nextSelect.fold(expire) { x =>
prevNonCommentBefore(tokenBefore(x.nameFt)).left
}
val exclude = insideBracesBlock(ft, end, parensToo = true)
.excludeCloseDelim
val bracesToParens = ftAfterRight.right.is[T.OpenDelim] &&
Expand Down
Loading