Skip to content

Commit

Permalink
Correct completion token placement
Browse files Browse the repository at this point in the history
  • Loading branch information
nlander committed Jul 15, 2023
1 parent 16e58b8 commit ce378a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions ghcide/src/Development/IDE/Core/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ lookupMod HieDbWriter{indexQueue} hieFile moduleName uid _boot = MaybeT $ do
moduleSource <- hie_hs_src <$> loadHieFile (mkUpdater nc) hieFile
BS.writeFile writeOutPath moduleSource
liftIO $ atomically $
unGetTQueue indexQueue $ \withHieDb -> withHieDb $ \db -> do
HieDb.addSrcFile db hieFile writeOutPath False
unGetTQueue indexQueue $ \withHieDb -> do
withHieDb $ \db ->
HieDb.addSrcFile db hieFile writeOutPath False
putMVar completionToken ()
pure $ moduleUri

Check warning on line 79 in ghcide/src/Development/IDE/Core/Actions.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Suggestion in lookupMod in module Development.IDE.Core.Actions: Redundant $ ▫︎ Found: "pure $ moduleUri" ▫︎ Perhaps: "pure moduleUri"
where
Expand Down
9 changes: 5 additions & 4 deletions ghcide/src/Development/IDE/Types/HscEnvEq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Development.IDE.Types.HscEnvEq
import Control.Concurrent.Async (Async, async, waitCatch)
import Control.Concurrent.MVar (newEmptyMVar, putMVar, readMVar)
import Control.Concurrent.STM (atomically)
import Control.Concurrent.STM.TQueue (unGetTQueue)
import Control.Concurrent.STM.TQueue (writeTQueue)
import Control.Concurrent.Strict (modifyVar, newVar)
import Control.DeepSeq (force)
import Control.Exception (evaluate, mask, throwIO)
Expand Down Expand Up @@ -133,9 +133,10 @@ newHscEnvEqWithImportPaths envImportPaths recorder se hscEnv deps = do
deleteMissingDependencySources :: IO ()
deleteMissingDependencySources = do
completionToken <- newEmptyMVar
atomically $ unGetTQueue (indexQueue $ hiedbWriter se) $
\withHieDb -> withHieDb $ \db -> do
removeDependencySrcFiles db
atomically $ writeTQueue (indexQueue $ hiedbWriter se) $
\withHieDb -> do
withHieDb $ \db ->
removeDependencySrcFiles db
putMVar completionToken ()
readMVar completionToken
indexPackageHieFiles :: Package -> [Module] -> IO ()
Expand Down

0 comments on commit ce378a9

Please sign in to comment.