@@ -219,7 +219,7 @@ data ShakeExtras = ShakeExtras
219
219
,clientCapabilities :: ClientCapabilities
220
220
, hiedb :: HieDb -- ^ Use only to read.
221
221
, hiedbWriter :: HieDbWriter -- ^ use to write
222
- , persistentKeys :: Var (HMap. HashMap Key GetStalePersistent )
222
+ , persistentKeys :: IORef (HMap. HashMap Key GetStalePersistent )
223
223
-- ^ Registery for functions that compute/get "stale" results for the rule
224
224
-- (possibly from disk)
225
225
, vfs :: VFSHandle
@@ -259,7 +259,7 @@ getPluginConfig plugin = do
259
259
addPersistentRule :: IdeRule k v => k -> (NormalizedFilePath -> IdeAction (Maybe (v ,PositionDelta ,TextDocumentVersion ))) -> Rules ()
260
260
addPersistentRule k getVal = do
261
261
ShakeExtras {persistentKeys} <- getShakeExtrasRules
262
- void $ liftIO $ modifyVar' persistentKeys $ HMap. insert (Key k) (fmap (fmap (first3 toDyn)) . getVal)
262
+ void $ liftIO $ atomicModifyIORef'_ persistentKeys $ HMap. insert (Key k) (fmap (fmap (first3 toDyn)) . getVal)
263
263
264
264
class Typeable a => IsIdeGlobal a where
265
265
@@ -334,7 +334,7 @@ lastValueIO s@ShakeExtras{positionMapping,persistentKeys,state} k file = do
334
334
| IdeTesting testing <- ideTesting s -- Don't read stale persistent values in tests
335
335
, testing = pure Nothing
336
336
| otherwise = do
337
- pmap <- readVar persistentKeys
337
+ pmap <- readIORef persistentKeys
338
338
mv <- runMaybeT $ do
339
339
liftIO $ Logger. logDebug (logger s) $ T. pack $ " LOOKUP UP PERSISTENT FOR: " ++ show k
340
340
f <- MaybeT $ pure $ HMap. lookup (Key k) pmap
@@ -517,7 +517,7 @@ shakeOpen lspEnv defaultConfig logger debouncer
517
517
positionMapping <- STM. newIO
518
518
knownTargetsVar <- newIORef $ hashed HMap. empty
519
519
let restartShakeSession = shakeRestart ideState
520
- persistentKeys <- newVar HMap. empty
520
+ persistentKeys <- newIORef HMap. empty
521
521
indexPending <- newTVarIO HMap. empty
522
522
indexCompleted <- newTVarIO 0
523
523
indexProgressToken <- newVar Nothing
0 commit comments