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

FormatWriter: rename location to floc, consistency #3914

Merged
merged 1 commit into from
Apr 9, 2024
Merged
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 @@ -1165,13 +1165,13 @@ class FormatWriter(formatOps: FormatOps) {
}
}

implicit val location = processLine
val isBlankLine = location.state.split.modExt.mod.newlines > 1
implicit val floc: FormatLocation = processLine
val isBlankLine = floc.state.split.modExt.mod.newlines > 1
if (alignContainer ne null) {
val candidates = columnCandidates.result()
val block = getOrCreateBlock(alignContainer)
def appendToBlock(matches: Int = 0): Unit = {
val eolColumn = location.state.prev.column + columnShift
val eolColumn = floc.state.prev.column + columnShift
val alignLine = new AlignLine(candidates, eolColumn)
if (!block.isEmpty) {
if (block.tryAppendToBlock(alignLine, matches)) return
Expand All @@ -1185,7 +1185,7 @@ class FormatWriter(formatOps: FormatOps) {
wasSameContainer(alignContainer),
block.refStops,
candidates,
location.formatToken,
floc.formatToken,
)
if (matches > 0) appendToBlock(matches)
if (isBlankLine || matches == 0 && shouldFlush(alignContainer)) {
Expand All @@ -1198,7 +1198,7 @@ class FormatWriter(formatOps: FormatOps) {
prevBlock = block
}
if (isBlankLine || alignContainer.eq(null)) getBlockToFlush(
getAlignContainer(location.formatToken.meta.rightOwner),
getAlignContainer(floc.formatToken.meta.rightOwner),
isBlankLine,
).foreach(flushAlignBlock)
}
Expand Down
Loading