@@ -425,6 +425,7 @@ loadSessionWithOptions :: Recorder (WithPriority Log) -> SessionLoadingOptions -
425
425
loadSessionWithOptions recorder SessionLoadingOptions {.. } rootDir que = do
426
426
let toAbsolutePath = toAbsolute rootDir -- see Note [Root Directory]
427
427
cradle_files <- newIORef (Set. fromList [] )
428
+ -- error_loading_files <- newIORef (Set.fromList [])
428
429
-- Mapping from hie.yaml file to HscEnv, one per hie.yaml file
429
430
hscEnvs <- newVar Map. empty :: IO (Var HieMap )
430
431
-- Mapping from a Filepath to HscEnv
@@ -606,6 +607,15 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
606
607
607
608
return $ (second Map. keys this_options, Set. fromList $ fromNormalizedFilePath <$> newLoaded)
608
609
610
+ let makeError hieYaml cradle err cfp = do
611
+ dep_info <- getDependencyInfo (maybeToList hieYaml)
612
+ let ncfp = toNormalizedFilePath' cfp
613
+ let res = (map (\ err' -> renderCradleError err' cradle ncfp) err, Nothing )
614
+ void $ modifyVar' fileToFlags $
615
+ Map. insertWith HM. union hieYaml (HM. singleton ncfp (res, dep_info))
616
+ void $ modifyVar' filesMap $ HM. insert ncfp hieYaml
617
+ return (fst res)
618
+
609
619
let consultCradle :: Maybe FilePath -> FilePath -> IO (IdeResult HscEnvEq , [FilePath ])
610
620
consultCradle hieYaml cfp = do
611
621
let lfpLog = makeRelative rootDir cfp
@@ -648,13 +658,8 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
648
658
| otherwise -> return (([renderPackageSetupException cfp GhcVersionMismatch {.. }], Nothing ),[] )
649
659
-- Failure case, either a cradle error or the none cradle
650
660
Left err -> do
651
- dep_info <- getDependencyInfo (maybeToList hieYaml)
652
- let ncfp = toNormalizedFilePath' cfp
653
- let res = (map (\ err' -> renderCradleError err' cradle ncfp) err, Nothing )
654
- void $ modifyVar' fileToFlags $
655
- Map. insertWith HM. union hieYaml (HM. singleton ncfp (res, dep_info))
656
- void $ modifyVar' filesMap $ HM. insert ncfp hieYaml
657
- return (res, maybe [] pure hieYaml ++ concatMap cradleErrorDependencies err)
661
+ errors <- mapM (makeError hieYaml cradle err) $ Set. toList pendingFiles
662
+ return ((concat errors, Nothing ), maybe [] pure hieYaml ++ concatMap cradleErrorDependencies err)
658
663
659
664
let
660
665
-- | We allow users to specify a loading strategy.
0 commit comments