File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed
ghcide/src/Development/IDE/Core Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -1151,9 +1151,9 @@ getModSummaryFromImports env fp modTime contents = do
11511151 then mkHomeModLocation dflags (pathToModuleName fp) fp
11521152 else mkHomeModLocation dflags mod fp
11531153
1154- let modl = mkHomeModule (hscHomeUnit (hscSetFlags dflags env) ) mod
1154+ let modl = mkHomeModule (hscHomeUnit env) mod
11551155 sourceType = if " -boot" `isSuffixOf` takeExtension fp then HsBootFile else HsSrcFile
1156- msrModSummary =
1156+ msrModSummary2 =
11571157 ModSummary
11581158 { ms_mod = modl
11591159 , ms_hie_date = Nothing
@@ -1178,7 +1178,8 @@ getModSummaryFromImports env fp modTime contents = do
11781178 , ms_textual_imps = textualImports
11791179 }
11801180
1181- msrFingerprint <- liftIO $ computeFingerprint opts msrModSummary
1181+ msrFingerprint <- liftIO $ computeFingerprint opts msrModSummary2
1182+ (msrModSummary, msrHscEnv) <- liftIO $ initPlugins env msrModSummary2
11821183 return ModSummaryResult {.. }
11831184 where
11841185 -- Compute a fingerprint from the contents of `ModSummary`,
Original file line number Diff line number Diff line change @@ -357,6 +357,12 @@ data ModSummaryResult = ModSummaryResult
357357 { msrModSummary :: ! ModSummary
358358 , msrImports :: [LImportDecl GhcPs ]
359359 , msrFingerprint :: ! Fingerprint
360+ , msrHscEnv :: ! HscEnv
361+ -- ^ HscEnv for this particular ModSummary.
362+ -- Contains initialised plugins, parsed options, etc...
363+ --
364+ -- Implicit assumption: DynFlags in 'msrModSummary' are the same as
365+ -- the DynFlags in 'msrHscEnv'.
360366 }
361367
362368instance Show ModSummaryResult where
Original file line number Diff line number Diff line change @@ -253,9 +253,7 @@ getParsedModuleRule :: Recorder (WithPriority Log) -> Rules ()
253253getParsedModuleRule recorder =
254254 -- this rule does not have early cutoff since all its dependencies already have it
255255 define (cmapWithPrio LogShake recorder) $ \ GetParsedModule file -> do
256- ModSummaryResult {msrModSummary = ms'} <- use_ GetModSummary file
257- sess <- use_ GhcSession file
258- (ms', hsc) <- liftIO $ initPlugins (hscEnv sess) ms'
256+ ModSummaryResult {msrModSummary = ms', msrHscEnv = hsc} <- use_ GetModSummary file
259257 opt <- getIdeOptions
260258 modify_dflags <- getModifyDynFlags dynFlagsModifyParser
261259 let ms = ms' { ms_hspp_opts = modify_dflags $ ms_hspp_opts ms' }
@@ -327,9 +325,7 @@ getParsedModuleWithCommentsRule recorder =
327325 -- The parse diagnostics are owned by the GetParsedModule rule
328326 -- For this reason, this rule does not produce any diagnostics
329327 defineNoDiagnostics (cmapWithPrio LogShake recorder) $ \ GetParsedModuleWithComments file -> do
330- ModSummaryResult {msrModSummary = ms} <- use_ GetModSummary file
331- sess <- use_ GhcSession file
332- (ms, hsc) <- liftIO $ initPlugins (hscEnv sess) ms
328+ ModSummaryResult {msrModSummary = ms, msrHscEnv = hsc} <- use_ GetModSummary file
333329 opt <- getIdeOptions
334330
335331 let ms' = withoutOption Opt_Haddock $ withOption Opt_KeepRawTokenStream ms
You can’t perform that action at this time.
0 commit comments