Skip to content

Commit 1754992

Browse files
committed
fix updatePositionMapping to use mapAccumWithKey
1 parent 77c7a8d commit 1754992

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ghcide/src/Development/IDE/Core/Shake.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,8 @@ updatePositionMapping IdeState{shakeExtras = ShakeExtras{positionMapping}} Versi
13571357
-- Very important to use mapAccum here so that the tails of
13581358
-- each mapping can be shared, otherwise quadratic space is
13591359
-- used which is evident in long running sessions.
1360-
EM.mapAccumRWithKey (\acc _k (delta, _) -> let new = addOldDelta delta acc in (new, (delta, acc)))
1360+
-- mapAccumWithKey is the one with smaller key accumulate in acc
1361+
EM.mapAccumWithKey (\acc _k (delta, _) -> let new = addOldDelta delta acc in (new, (delta, acc)))
13611362
zeroMapping
13621363
(EM.insert _version (shared_change, zeroMapping) mappingForUri)
13631364
shared_change = mkDelta changes

0 commit comments

Comments
 (0)