Skip to content

Commit

Permalink
FormatTokens: improve token lookup when rewritten
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Mar 16, 2024
1 parent 8c00f0e commit 385c662
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ class FormatTokens(leftTok2tok: Map[TokenOps.TokenHash, Int])(
if (idx >= arr.length) arr.last
else {
val ft = arr(idx)
if (isBefore) {
if (ft.left.start <= tok.start) ft else at(idx - 1)
if (ft.left eq tok) ft
else if (isBefore) {
if (ft.left.start < tok.start) ft else at(idx - 1)
} else {
if (ft.left.start >= tok.start) ft else at(idx + 1)
if (ft.left.start > tok.start) ft else at(idx + 1)
}
}
}
Expand Down

0 comments on commit 385c662

Please sign in to comment.