Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed Oct 27, 2024
1 parent df21318 commit 826b3f7
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 826b3f7

Please sign in to comment.