Skip to content

Commit f570d5f

Browse files
committed
Add updateHscEnvEq helper function
1 parent b9a8454 commit f570d5f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ghcide/src/Development/IDE/Core/Rules.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ ghcSessionDepsDefinition fullModSummary GhcSessionDepsConfig{..} env file = do
799799
#endif
800800
session' <- liftIO $ mergeEnvs hsc moduleNode inLoadOrder depSessions
801801

802-
Just <$> liftIO (newHscEnvEqWithImportPaths (envImportPaths env) session' [])
802+
Just <$> liftIO (updateHscEnvEq env session')
803803

804804
-- | Load a iface from disk, or generate it if there isn't one or it is out of date
805805
-- This rule also ensures that the `.hie` and `.o` (if needed) files are written out.

ghcide/src/Development/IDE/Types/HscEnvEq.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module Development.IDE.Types.HscEnvEq
44
hscEnvWithImportPaths,
55
newHscEnvEqPreserveImportPaths,
66
newHscEnvEqWithImportPaths,
7+
updateHscEnvEq,
78
envImportPaths,
89
envPackageExports,
910
envVisibleModuleNames,
@@ -51,6 +52,11 @@ data HscEnvEq = HscEnvEq
5152
-- If Nothing, 'listVisibleModuleNames' panic
5253
}
5354

55+
updateHscEnvEq :: HscEnvEq -> HscEnv -> IO HscEnvEq
56+
updateHscEnvEq oldHscEnvEq newHscEnv = do
57+
let update newUnique = oldHscEnvEq { envUnique = newUnique, hscEnv = newHscEnv }
58+
update <$> Unique.newUnique
59+
5460
-- | Wrap an 'HscEnv' into an 'HscEnvEq'.
5561
newHscEnvEq :: FilePath -> HscEnv -> [(UnitId, DynFlags)] -> IO HscEnvEq
5662
newHscEnvEq cradlePath hscEnv0 deps = do

0 commit comments

Comments
 (0)