@@ -500,23 +500,6 @@ completeFileProcessing state hieYaml ncfp file flags = do
500
500
insertFileMapping state hieYaml ncfp
501
501
removeFromPending state file
502
502
503
- -- | Handle successful loading by updating session state with the new file maps
504
- updateSessionOnSuccess :: Recorder (WithPriority Log ) -> SessionState -> Maybe FilePath -> HashMap NormalizedFilePath (IdeResult HscEnvEq , DependencyInfo ) -> [TargetDetails ] -> IO ()
505
- updateSessionOnSuccess recorder state hieYaml this_flags_map all_targets = do
506
- let newLoaded = Set. fromList $ fromNormalizedFilePath <$> HM. keys this_flags_map
507
- atomically $ do
508
- STM. insert this_flags_map hieYaml (fileToFlags state)
509
- insertAllFileMappings state $ map ((hieYaml,) . fst ) $ concatMap toFlagsMap all_targets
510
- forM_ newLoaded $ flip S. delete (pendingFileSet state)
511
- pendingFiles <- getPendingFiles state
512
- let newLoaded = pendingFiles `Set.intersection` newLoaded
513
- -- log new loaded files
514
- logWith recorder Info $ LogSessionNewLoadedFiles $ Set. toList newLoaded
515
- -- remove all new loaded file from error loading files
516
- mapM_ (removeErrorLoadingFile state) (Set. toList newLoaded)
517
- addCradleFiles state newLoaded
518
- return ()
519
-
520
503
-- | Insert multiple file mappings at once
521
504
insertAllFileMappings :: SessionState -> [(Maybe FilePath , NormalizedFilePath )] -> STM ()
522
505
insertAllFileMappings state mappings =
@@ -728,7 +711,11 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
728
711
Nothing
729
712
730
713
let newLoaded = Set. fromList $ fromNormalizedFilePath <$> HM. keys this_flags_map
731
- updateSessionOnSuccess recorder sessionState hieYaml this_flags_map all_targets
714
+ atomically $ do
715
+ STM. insert this_flags_map hieYaml (fileToFlags sessionState)
716
+ insertAllFileMappings sessionState $ map ((hieYaml,) . fst ) $ concatMap toFlagsMap all_targets
717
+ forM_ newLoaded $ flip S. delete (pendingFileSet sessionState)
718
+
732
719
-- Typecheck all files in the project on startup
733
720
checkProject <- getCheckProject
734
721
-- The VFS doesn't change on cradle edits, re-use the old one.
@@ -782,7 +769,14 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
782
769
[] -> error $ " GHC version could not be parsed: " <> version
783
770
((runTime, _): _)
784
771
| compileTime == runTime -> do
785
- (_results, _allNewLoaded, restart) <- session (hieYaml, ncfp, opts, libDir)
772
+ (_results, allNewLoaded, restart) <- session (hieYaml, ncfp, opts, libDir)
773
+ pendingFiles <- getPendingFiles sessionState
774
+ let newLoaded = pendingFiles `Set.intersection` allNewLoaded
775
+ -- log new loaded files
776
+ logWith recorder Info $ LogSessionNewLoadedFiles $ Set. toList newLoaded
777
+ -- remove all new loaded file from error loading files
778
+ mapM_ (removeErrorLoadingFile sessionState) (Set. toList allNewLoaded)
779
+ addCradleFiles sessionState newLoaded
786
780
restart
787
781
| otherwise -> do
788
782
-- Use the common pattern here: updateFileState
0 commit comments