Skip to content

Commit c68df67

Browse files
committed
add log
1 parent a70b01f commit c68df67

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ data Log
148148
| LogDLLLoadError !String
149149
| LogCradlePath !FilePath
150150
| LogCradlePaths ![FilePath]
151+
| LogCradleOpts !(ComponentOptions, FilePath, String)
151152
| LogCradleNotFound !FilePath
152153
| LogSessionLoadingResult !(Either [CradleError] (ComponentOptions, FilePath, String))
153154
| LogCradle !(Cradle Void)
@@ -234,6 +235,8 @@ instance Pretty Log where
234235
"Session Loading config changed, reloading the full session."
235236
LogNoneCradleFounds files ->
236237
"None cradle found for files:" <+> pretty files <> ", ignoring the files"
238+
LogCradleOpts (opts, root, prefix) ->
239+
"Cradle options:" <+> pretty (componentOptions opts) <+> ", root:" <+> pretty root <+> ", prefix:" <+> pretty prefix
237240

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

0 commit comments

Comments
 (0)