From c68df67202d60cf9585b4057f8c3499cfd278f4c Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 25 Oct 2024 20:27:41 +0800 Subject: [PATCH] add log --- ghcide/session-loader/Development/IDE/Session.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ghcide/session-loader/Development/IDE/Session.hs b/ghcide/session-loader/Development/IDE/Session.hs index df1662055b..68a4c9f353 100644 --- a/ghcide/session-loader/Development/IDE/Session.hs +++ b/ghcide/session-loader/Development/IDE/Session.hs @@ -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) @@ -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 @@ -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 @@ -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 @@ -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)