File tree 5 files changed +15
-7
lines changed
session-loader/Development/IDE
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
85
85
import HieDb.Create
86
86
import HieDb.Types
87
87
import HieDb.Utils
88
- import Ide.Types (dynFlagsModifyGlobal )
89
88
90
89
-- | Bump this version number when making changes to the format of the data stored in hiedb
91
90
hiedbDataVersion :: String
@@ -283,8 +282,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
283
282
packageSetup (hieYaml, cfp, opts, libDir) = do
284
283
-- Parse DynFlags for the newly discovered component
285
284
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)
288
286
let deps = componentDependencies opts ++ maybeToList hieYaml
289
287
dep_info <- getDependencyInfo deps
290
288
-- 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 =
292
292
liftIO $ fmap (fmap reset_ms) $ snd <$> getParsedModuleDefinition (hscEnv sess) opt file ms
293
293
294
294
getModifyDynFlags :: (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
296
299
297
300
298
301
getParsedModuleDefinition
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import qualified Language.LSP.Server as LSP
10
10
data Plugin c = Plugin
11
11
{ pluginRules :: Rules ()
12
12
,pluginHandlers :: LSP. Handlers (ServerM c )
13
- ,pluginModifyDynflags :: DynFlagsModifications
13
+ ,pluginModifyDynflags :: c -> DynFlagsModifications
14
14
}
15
15
16
16
instance Default (Plugin c ) where
Original file line number Diff line number Diff line change @@ -70,7 +70,14 @@ rulesPlugins rs = mempty { P.pluginRules = rules }
70
70
rules = foldMap snd rs
71
71
72
72
dynFlagsPlugins :: [(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
+ }
74
81
75
82
-- ---------------------------------------------------------------------
76
83
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ data IdeOptions = IdeOptions
72
72
-- Otherwise, return the result of parsing without Opt_Haddock, so
73
73
-- that the parsed module contains the result of Opt_KeepRawTokenStream,
74
74
-- which might be necessary for hlint.
75
- , optModifyDynFlags :: DynFlagsModifications
75
+ , optModifyDynFlags :: Config -> DynFlagsModifications
76
76
-- ^ Will be called right after setting up a new cradle,
77
77
-- allowing to customize the Ghc options used
78
78
, optShakeOptions :: ShakeOptions
You can’t perform that action at this time.
0 commit comments