@@ -266,7 +266,7 @@ data ShakeExtras = ShakeExtras
266266 -- ^ Map from a text document version to a PositionMapping that describes how to map
267267 -- positions in a version of that document to positions in the latest version
268268 -- First mapping is delta from previous version and second one is an
269- -- accumulation of all previous mappings .
269+ -- accumulation to the current version .
270270 ,progress :: ProgressReporting
271271 ,ideTesting :: IdeTesting
272272 -- ^ Whether to enable additional lsp messages used by the test suite for checking invariants
@@ -443,7 +443,7 @@ lastValueIO s@ShakeExtras{positionMapping,persistentKeys,state} k file = do
443443 `catch` (\ (_ :: IOException ) -> pure Nothing )
444444 atomicallyNamed " lastValueIO 2" $ do
445445 STM. focus (Focus. alter (alterValue $ Stale (Just del) actual_version (toDyn v))) (toKey k file) state
446- Just . (v,) . addDelta del <$> mappingForVersion positionMapping file actual_version
446+ Just . (v,) . addOldDelta del <$> mappingForVersion positionMapping file actual_version
447447
448448 -- We got a new stale value from the persistent rule, insert it in the map without affecting diagnostics
449449 alterValue new Nothing = Just (ValueWithDiagnostics new mempty ) -- If it wasn't in the map, give it empty diagnostics
@@ -459,7 +459,7 @@ lastValueIO s@ShakeExtras{positionMapping,persistentKeys,state} k file = do
459459 Succeeded ver (fromDynamic -> Just v) ->
460460 atomicallyNamed " lastValueIO 5" $ Just . (v,) <$> mappingForVersion positionMapping file ver
461461 Stale del ver (fromDynamic -> Just v) ->
462- atomicallyNamed " lastValueIO 6" $ Just . (v,) . maybe id addDelta del <$> mappingForVersion positionMapping file ver
462+ atomicallyNamed " lastValueIO 6" $ Just . (v,) . maybe id addOldDelta del <$> mappingForVersion positionMapping file ver
463463 Failed p | not p -> readPersistent
464464 _ -> pure Nothing
465465
@@ -1357,7 +1357,7 @@ 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 = addDelta delta acc in (new, (delta, acc)))
1360+ EM. mapAccumRWithKey (\ acc _k (delta, _) -> let new = addOldDelta delta acc in (new, (delta, acc)))
13611361 zeroMapping
13621362 (EM. insert _version (shared_change, zeroMapping) mappingForUri)
13631363 shared_change = mkDelta changes
0 commit comments