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
1151
1151
then mkHomeModLocation dflags (pathToModuleName fp) fp
1152
1152
else mkHomeModLocation dflags mod fp
1153
1153
1154
- let modl = mkHomeModule (hscHomeUnit (hscSetFlags dflags env) ) mod
1154
+ let modl = mkHomeModule (hscHomeUnit env) mod
1155
1155
sourceType = if " -boot" `isSuffixOf` takeExtension fp then HsBootFile else HsSrcFile
1156
- msrModSummary =
1156
+ msrModSummary2 =
1157
1157
ModSummary
1158
1158
{ ms_mod = modl
1159
1159
, ms_hie_date = Nothing
@@ -1178,7 +1178,8 @@ getModSummaryFromImports env fp modTime contents = do
1178
1178
, ms_textual_imps = textualImports
1179
1179
}
1180
1180
1181
- msrFingerprint <- liftIO $ computeFingerprint opts msrModSummary
1181
+ msrFingerprint <- liftIO $ computeFingerprint opts msrModSummary2
1182
+ (msrModSummary, msrHscEnv) <- liftIO $ initPlugins env msrModSummary2
1182
1183
return ModSummaryResult {.. }
1183
1184
where
1184
1185
-- 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
357
357
{ msrModSummary :: ! ModSummary
358
358
, msrImports :: [LImportDecl GhcPs ]
359
359
, 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'.
360
366
}
361
367
362
368
instance Show ModSummaryResult where
Original file line number Diff line number Diff line change @@ -253,9 +253,7 @@ getParsedModuleRule :: Recorder (WithPriority Log) -> Rules ()
253
253
getParsedModuleRule recorder =
254
254
-- this rule does not have early cutoff since all its dependencies already have it
255
255
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
259
257
opt <- getIdeOptions
260
258
modify_dflags <- getModifyDynFlags dynFlagsModifyParser
261
259
let ms = ms' { ms_hspp_opts = modify_dflags $ ms_hspp_opts ms' }
@@ -327,9 +325,7 @@ getParsedModuleWithCommentsRule recorder =
327
325
-- The parse diagnostics are owned by the GetParsedModule rule
328
326
-- For this reason, this rule does not produce any diagnostics
329
327
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
333
329
opt <- getIdeOptions
334
330
335
331
let ms' = withoutOption Opt_Haddock $ withOption Opt_KeepRawTokenStream ms
You can’t perform that action at this time.
0 commit comments