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