Skip to content

Commit

Permalink
ensure atomicity when global imports are added
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin committed Sep 27, 2024
1 parent c2afbcc commit 5f262d8
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ final class PresentationCompilerTypeInferrer private (
replace.pos.end
)
val result = pc.insertInferredType(params).get()
// TODO we need to actually insert after each change
val allPatches: List[Patch] = result.asScala.toList
result.asScala.toList
.map { edit =>
val start = edit.getRange().getStart()
val last = ctx.tokens.tokens.takeWhile { token =>
Expand All @@ -72,9 +71,8 @@ final class PresentationCompilerTypeInferrer private (
}.last
Patch.addRight(last, edit.getNewText())
}
allPatches.reduce[Patch] { case (p1, p2) =>
p1 + p2
}
.asPatch
.atomic
}
}

Expand Down

0 comments on commit 5f262d8

Please sign in to comment.