diff --git a/ghcide/session-loader/Development/IDE/Session.hs b/ghcide/session-loader/Development/IDE/Session.hs index df14e2d1b9..463e0ceb7e 100644 --- a/ghcide/session-loader/Development/IDE/Session.hs +++ b/ghcide/session-loader/Development/IDE/Session.hs @@ -103,7 +103,6 @@ import Data.HashSet (HashSet) import qualified Data.HashSet as Set import qualified Data.Set as OS import Database.SQLite.Simple -import Development.IDE.Core.Tracing (withTrace) import Development.IDE.Core.WorkerThread (awaitRunInThread, withWorkerQueue) import qualified Development.IDE.GHC.Compat.Util as Compat @@ -120,19 +119,13 @@ import qualified System.Random as Random import System.Random (RandomGen) import Text.ParserCombinators.ReadP (readP_to_S) -import Control.Exception.Extra (errorIO) -import qualified Data.HashMap.Strict as HashMap -import qualified Data.Tuple as Tuple -import Development.IDE.Core.OfInterest (OfInterestVar (OfInterestVar), - getFilesOfInterest, - getFilesOfInterestUntracked) import GHC.Data.Bag import GHC.Driver.Env (hsc_all_home_unit_ids) import GHC.Driver.Errors.Types import GHC.Types.Error (errMsgDiagnostic, singleMessage) import GHC.Unit.State -import qualified HIE.Bios.Cradle as HieBios + data Log = LogSettingInitialDynFlags @@ -733,26 +726,19 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do -- to get some more options then we wait for the currently running action to finish -- before attempting to do so. let getOptionsBatch :: FilePath -> IO (IdeResult HscEnvEq, [FilePath]) - getOptionsBatch file' = do + getOptionsBatch file = do pendingFiles <- atomically $ flushTQueue pendingFilesTQueue - let file = toAbsolutePath file' hieYaml <- cradleLoc file logWith recorder Debug LogSettingInitialDynFlags - results <- getOptionsList (Set.toList $ Set.fromList $ toAbsolutePath file : map fromNormalizedFilePath pendingFiles) + results <- getOptionsList (Set.toList $ Set.fromList $ file : pendingFiles) return (results Map.! file) `Safe.catch` \e -> return (([renderPackageSetupException file e], Nothing), maybe [] pure hieYaml) returnWithVersion $ \file -> do -- see Note [Serializing runs in separate thread] - atomically $ writeTQueue pendingFilesTQueue file + atomically $ writeTQueue pendingFilesTQueue $ toAbsolutePath file awaitRunInThread que $ getOptionsBatch file --- cradleToType :: Cradle Void -> IO () --- cradleToType c = do --- case c of --- Cradle { cradleOptsProg = Just (GHC.GhcVersion _), cradleOptsProg = Just (GHC.GhcVersion _) } -> return () --- _ -> --- return () -- how we do batch loading of cradles depends on the the type of cradle we are using cradleToOptsAndLibDirs :: Recorder (WithPriority Log) -> SessionLoadingPreferenceConfig -> [(Cradle Void, (Maybe FilePath, FilePath))] -> [FilePath]