File tree Expand file tree Collapse file tree 5 files changed +15
-7
lines changed
session-loader/Development/IDE Expand file tree Collapse file tree 5 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,6 @@ import Database.SQLite.Simple
8585import HieDb.Create
8686import HieDb.Types
8787import HieDb.Utils
88- import Ide.Types (dynFlagsModifyGlobal )
8988
9089-- | Bump this version number when making changes to the format of the data stored in hiedb
9190hiedbDataVersion :: String
@@ -283,8 +282,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
283282 packageSetup (hieYaml, cfp, opts, libDir) = do
284283 -- Parse DynFlags for the newly discovered component
285284 hscEnv <- emptyHscEnv ideNc libDir
286- (df, targets) <- evalGhcEnv hscEnv $
287- first (dynFlagsModifyGlobal optModifyDynFlags) <$> setOptions opts (hsc_dflags hscEnv)
285+ (df, targets) <- evalGhcEnv hscEnv $ setOptions opts (hsc_dflags hscEnv)
288286 let deps = componentDependencies opts ++ maybeToList hieYaml
289287 dep_info <- getDependencyInfo deps
290288 -- Now lookup to see whether we are combining with an existing HscEnv
Original file line number Diff line number Diff line change @@ -292,7 +292,10 @@ getParsedModuleWithCommentsRule =
292292 liftIO $ fmap (fmap reset_ms) $ snd <$> getParsedModuleDefinition (hscEnv sess) opt file ms
293293
294294getModifyDynFlags :: (DynFlagsModifications -> a ) -> Action a
295- getModifyDynFlags f = f . optModifyDynFlags <$> getIdeOptions
295+ getModifyDynFlags f = do
296+ opts <- getIdeOptions
297+ cfg <- getClientConfigAction def
298+ pure $ f $ optModifyDynFlags opts cfg
296299
297300
298301getParsedModuleDefinition
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import qualified Language.LSP.Server as LSP
1010data Plugin c = Plugin
1111 { pluginRules :: Rules ()
1212 ,pluginHandlers :: LSP. Handlers (ServerM c )
13- ,pluginModifyDynflags :: DynFlagsModifications
13+ ,pluginModifyDynflags :: c -> DynFlagsModifications
1414 }
1515
1616instance Default (Plugin c ) where
Original file line number Diff line number Diff line change @@ -70,7 +70,14 @@ rulesPlugins rs = mempty { P.pluginRules = rules }
7070 rules = foldMap snd rs
7171
7272dynFlagsPlugins :: [(PluginId , DynFlagsModifications )] -> Plugin Config
73- dynFlagsPlugins rs = mempty { P. pluginModifyDynflags = foldMap snd rs }
73+ dynFlagsPlugins rs = mempty
74+ { P. pluginModifyDynflags =
75+ flip foldMap rs $ \ (plId, dflag_mods) cfg ->
76+ let plg_cfg = configForPlugin cfg plId
77+ in if plcGlobalOn plg_cfg
78+ then dflag_mods
79+ else mempty
80+ }
7481
7582-- ---------------------------------------------------------------------
7683
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ data IdeOptions = IdeOptions
7272 -- Otherwise, return the result of parsing without Opt_Haddock, so
7373 -- that the parsed module contains the result of Opt_KeepRawTokenStream,
7474 -- which might be necessary for hlint.
75- , optModifyDynFlags :: DynFlagsModifications
75+ , optModifyDynFlags :: Config -> DynFlagsModifications
7676 -- ^ Will be called right after setting up a new cradle,
7777 -- allowing to customize the Ghc options used
7878 , optShakeOptions :: ShakeOptions
You can’t perform that action at this time.
0 commit comments