Skip to content

Commit

Permalink
run session build in mask_
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed May 22, 2024
1 parent 6355b71 commit 8c1e41a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,8 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir = do
IdeOptions{ optCheckProject = getCheckProject} <- getIdeOptions
returnWithVersion $ \file -> do
-- only one cradle consult at a time
async <- UnliftIO.async $ UnliftIO.withMVar cradleLock $ const $ do

UnliftIO.mask_ $ UnliftIO.withMVar cradleLock $ const $ do
-- we need to find a way to get rid of the (files, keys)
_opts@(a, b, _files, _keys) <- use_ HieYaml file
files <- liftIO $ atomically $ swapTVar targetFiles []
Expand All @@ -808,9 +809,12 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir = do
liftIO $ when (notNull files || notNull keys) $ do
checkProject <- getCheckProject
-- think of not to restart a second time
restartShakeSession VFSUnmodified "new component" (if checkProject then return (typecheckAll files) else mempty) $ pure keys
async <- UnliftIO.async $ restartShakeSession VFSUnmodified "new component" (if checkProject then return (typecheckAll files) else mempty) $ pure keys
UnliftIO.wait async
pure $ (fmap . fmap) toAbsolutePath (a, b)

Check warning on line 814 in ghcide/session-loader/Development/IDE/Session.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Warning in loadSessionWithOptions in module Development.IDE.Session: Using fmap on tuple ▫︎ Found: "(fmap . fmap) toAbsolutePath (a, b)" ▫︎ Perhaps: "(a, fmap toAbsolutePath b)"
UnliftIO.wait async)

-- UnliftIO.wait async
)


-- | Run the specific cradle on a specific FilePath via hie-bios.
Expand Down

0 comments on commit 8c1e41a

Please sign in to comment.