@@ -28,6 +28,10 @@ import qualified GHC.LanguageExtensions.Type as GHC
28import Development.IDE.Types.Options
28import Development.IDE.Types.Options
29import Development.IDE.Types.Location
29import Development.IDE.Types.Location
31+#if MIN_GHC_API_VERSION(8,6,0)
32+import DynamicLoading (initializePlugins)
31import GHC hiding (parseModule, typecheckModule)
35import GHC hiding (parseModule, typecheckModule)
32import qualified Parser
36import qualified Parser
33import Lexer
37import Lexer
@@ -95,11 +99,23 @@ typecheckModule (IdeDefer defer) packageState deps pm =
95 runGhcEnv packageState $
99 runGhcEnv packageState $
96 catchSrcErrors "typecheck" $ do
100 catchSrcErrors "typecheck" $ do
97 setupEnv deps
101 setupEnv deps
102+ let modSummary = pm_mod_summary pm
103+ modSummary' <- initPlugins modSummary
98 (warnings, tcm) <- withWarnings "typecheck" $ \tweak ->
104 (warnings, tcm) <- withWarnings "typecheck" $ \tweak ->
99− GHC.typecheckModule $ demoteIfDefer pm{pm_mod_summary = tweak $ pm_mod_summary pm}
105+ GHC.typecheckModule $ demoteIfDefer pm{pm_mod_summary = tweak modSummary'}
100 tcm2 <- mkTcModuleResult tcm
106 tcm2 <- mkTcModuleResult tcm
101 return (map unDefer warnings, tcm2)
107 return (map unDefer warnings, tcm2)
109+initPlugins :: GhcMonad m => ModSummary -> m ModSummary
110+initPlugins modSummary = do
111+#if MIN_GHC_API_VERSION(8,6,0)
112+ session <- getSession
113+ dflags <- liftIO $ initializePlugins session (ms_hspp_opts modSummary)
114+ return modSummary{ms_hspp_opts = dflags}
103-- | Compile a single type-checked module to a 'CoreModule' value, or
119-- | Compile a single type-checked module to a 'CoreModule' value, or
104-- provide errors.
120-- provide errors.
105compileModule
121compileModule