Skip to content

Commit 24269f6

Browse files
committed
revert
1 parent 80d0160 commit 24269f6

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

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

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -500,23 +500,6 @@ completeFileProcessing state hieYaml ncfp file flags = do
500500
insertFileMapping state hieYaml ncfp
501501
removeFromPending state file
502502

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-
520503
-- | Insert multiple file mappings at once
521504
insertAllFileMappings :: SessionState -> [(Maybe FilePath, NormalizedFilePath)] -> STM ()
522505
insertAllFileMappings state mappings =
@@ -728,7 +711,11 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
728711
Nothing
729712

730713
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+
732719
-- Typecheck all files in the project on startup
733720
checkProject <- getCheckProject
734721
-- The VFS doesn't change on cradle edits, re-use the old one.
@@ -782,7 +769,14 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
782769
[] -> error $ "GHC version could not be parsed: " <> version
783770
((runTime, _):_)
784771
| 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
786780
restart
787781
| otherwise -> do
788782
-- Use the common pattern here: updateFileState

0 commit comments

Comments
 (0)