@@ -53,8 +53,7 @@ import qualified Development.IDE.Core.Service as Service
5353import Development.IDE.Core.Shake (IdeState (shakeExtras ),
5454 ThreadQueue (tLoaderQueue ),
5555 shakeSessionInit ,
56- uses ,
57- withRestartWorker )
56+ uses )
5857import qualified Development.IDE.Core.Shake as Shake
5958import Development.IDE.Graph (action )
6059import Development.IDE.LSP.LanguageServer (runLanguageServer ,
@@ -379,7 +378,8 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
379378 Check argFiles -> do
380379 let dir = argsProjectRoot
381380 dbLoc <- getHieDbLoc dir
382- runWithWorkerThreads (cmapWithPrio LogSession recorder) dbLoc mempty $ \ hiedb threadQueue -> do
381+ ideMVar <- newEmptyMVar
382+ runWithWorkerThreads (cmapWithPrio LogSession recorder) dbLoc mempty ideMVar $ \ hiedb threadQueue -> do
383383 -- GHC produces messages with UTF8 in them, so make sure the terminal doesn't error
384384 hSetEncoding stdout utf8
385385 hSetEncoding stderr utf8
@@ -408,23 +408,23 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
408408 , optModifyDynFlags = optModifyDynFlags def_options <> pluginModifyDynflags plugins
409409 }
410410 ide <- initialise (cmapWithPrio LogService recorder) argsDefaultHlsConfig argsHlsPlugins rules Nothing debouncer ideOptions hiedb threadQueue mempty dir
411- withRestartWorker ide $ do
412- shakeSessionInit (cmapWithPrio LogShake recorder) ide
413- registerIdeConfiguration (shakeExtras ide) $ IdeConfiguration mempty (hashed Nothing )
414-
415- putStrLn " \n Step 4/4: Type checking the files"
416- setFilesOfInterest ide $ HashMap. fromList $ map ((,OnDisk ) . toNormalizedFilePath') absoluteFiles
417- results <- runAction " User TypeCheck" ide $ uses TypeCheck (map toNormalizedFilePath' absoluteFiles)
418- _results <- runAction " GetHie" ide $ uses GetHieAst (map toNormalizedFilePath' absoluteFiles)
419- _results <- runAction " GenerateCore" ide $ uses GenerateCore (map toNormalizedFilePath' absoluteFiles)
420- let (worked, failed) = partition fst $ zip (map isJust results) absoluteFiles
421- when (failed /= [] ) $
422- putStr $ unlines $ " Files that failed:" : map ((++) " * " . snd ) failed
423-
424- let nfiles xs = let n' = length xs in if n' == 1 then " 1 file" else show n' ++ " files"
425- putStrLn $ " \n Completed (" ++ nfiles worked ++ " worked, " ++ nfiles failed ++ " failed)"
426-
427- unless (null failed) (exitWith $ ExitFailure (length failed))
411+ putMVar ideMVar ide
412+ shakeSessionInit (cmapWithPrio LogShake recorder) ide
413+ registerIdeConfiguration (shakeExtras ide) $ IdeConfiguration mempty (hashed Nothing )
414+
415+ putStrLn " \n Step 4/4: Type checking the files"
416+ setFilesOfInterest ide $ HashMap. fromList $ map ((,OnDisk ) . toNormalizedFilePath') absoluteFiles
417+ results <- runAction " User TypeCheck" ide $ uses TypeCheck (map toNormalizedFilePath' absoluteFiles)
418+ _results <- runAction " GetHie" ide $ uses GetHieAst (map toNormalizedFilePath' absoluteFiles)
419+ _results <- runAction " GenerateCore" ide $ uses GenerateCore (map toNormalizedFilePath' absoluteFiles)
420+ let (worked, failed) = partition fst $ zip (map isJust results) absoluteFiles
421+ when (failed /= [] ) $
422+ putStr $ unlines $ " Files that failed:" : map ((++) " * " . snd ) failed
423+
424+ let nfiles xs = let n' = length xs in if n' == 1 then " 1 file" else show n' ++ " files"
425+ putStrLn $ " \n Completed (" ++ nfiles worked ++ " worked, " ++ nfiles failed ++ " failed)"
426+
427+ unless (null failed) (exitWith $ ExitFailure (length failed))
428428 Db opts cmd -> do
429429 let root = argsProjectRoot
430430 dbLoc <- getHieDbLoc root
@@ -438,7 +438,8 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
438438 Custom (IdeCommand c) -> do
439439 let root = argsProjectRoot
440440 dbLoc <- getHieDbLoc root
441- runWithWorkerThreads (cmapWithPrio LogSession recorder) dbLoc mempty $ \ hiedb threadQueue -> do
441+ ideMVar <- newEmptyMVar
442+ runWithWorkerThreads (cmapWithPrio LogSession recorder) dbLoc mempty ideMVar $ \ hiedb threadQueue -> do
442443 sessionLoader <- loadSessionWithOptions (cmapWithPrio LogSession recorder) argsSessionLoadingOptions " ." (tLoaderQueue threadQueue)
443444 let def_options = argsIdeOptions argsDefaultHlsConfig sessionLoader
444445 ideOptions = def_options
@@ -447,10 +448,10 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
447448 , optModifyDynFlags = optModifyDynFlags def_options <> pluginModifyDynflags plugins
448449 }
449450 ide <- initialise (cmapWithPrio LogService recorder) argsDefaultHlsConfig argsHlsPlugins rules Nothing debouncer ideOptions hiedb threadQueue mempty root
450- withRestartWorker ide $ do
451- shakeSessionInit (cmapWithPrio LogShake recorder) ide
452- registerIdeConfiguration (shakeExtras ide) $ IdeConfiguration mempty (hashed Nothing )
453- c ide
451+ putMVar ideMVar ide
452+ shakeSessionInit (cmapWithPrio LogShake recorder) ide
453+ registerIdeConfiguration (shakeExtras ide) $ IdeConfiguration mempty (hashed Nothing )
454+ c ide
454455
455456-- | List the haskell files given some paths
456457--
0 commit comments