Skip to content

Commit

Permalink
add log
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed Oct 25, 2024
1 parent a70b01f commit c68df67
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ data Log
| LogDLLLoadError !String
| LogCradlePath !FilePath
| LogCradlePaths ![FilePath]
| LogCradleOpts !(ComponentOptions, FilePath, String)
| LogCradleNotFound !FilePath
| LogSessionLoadingResult !(Either [CradleError] (ComponentOptions, FilePath, String))
| LogCradle !(Cradle Void)
Expand Down Expand Up @@ -234,6 +235,8 @@ instance Pretty Log where
"Session Loading config changed, reloading the full session."
LogNoneCradleFounds files ->
"None cradle found for files:" <+> pretty files <> ", ignoring the files"
LogCradleOpts (opts, root, prefix) ->
"Cradle options:" <+> pretty (componentOptions opts) <+> ", root:" <+> pretty root <+> ", prefix:" <+> pretty prefix

-- | Bump this version number when making changes to the format of the data stored in hiedb
hiedbDataVersion :: String
Expand Down Expand Up @@ -595,8 +598,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
-- For GHC's supporting multi component sessions, we create a shared
-- HscEnv but set the active component accordingly
hscEnv <- emptyHscEnv ideNc _libDir
let new_cache = newComponentCache recorder optExtensions cfps hscEnv
all_target_details <- new_cache old_deps new_deps
all_target_details <- newComponentCache recorder optExtensions cfps hscEnv old_deps new_deps
let all_targets' = concat all_target_details
flags_map' = HM.fromList (concatMap toFlagsMap all_targets')
this_dep_info <- getDependencyInfo $ maybeToList hieYaml
Expand Down Expand Up @@ -638,6 +640,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
-- The cradle gave us some options so get to work turning them
-- into and HscEnv.
Right (opts, libDir, version) -> do
logWith recorder Info $ LogCradleOpts (opts, libDir, version)
let compileTime = fullCompilerVersion
case reverse $ readP_to_S parseVersion version of
[] -> error $ "GHC version could not be parsed: " <> version
Expand Down Expand Up @@ -767,8 +770,6 @@ cradleToOptsAndLibDirs recorder loadConfig [] old_fps = error "cradleToOptsAndLi
cradleToOptsAndLibDirs recorder loadConfig cradleFiles@(cr:crs) old_fps = do
-- let result :: [([FilePath], CradleLoadResult ComponentOptions)]
results <- HieBios.getCompilerOptionsInBatch (LoadWithContext old_fps) (second snd cr :| map (second snd) crs)
let resultMap :: Map.Map FilePath (CradleLoadResult ComponentOptions)
resultMap = Map.fromList $ [ (fp, r) | (fps, r) <- results, fp <- fps ]
mapM (\(fps, crr) -> collectBiosResult'' recorder (getFirstCradle fps cradleFiles) fps crr) results
where
getFirstCradle :: [FilePath] -> [(Cradle Void, (Maybe FilePath, FilePath))] -> (Cradle Void, Maybe FilePath)
Expand Down

0 comments on commit c68df67

Please sign in to comment.