Skip to content

Commit 06c7ebc

Browse files
authored
Merge branch 'master' into hole-benchmarks
2 parents b958048 + 78381b8 commit 06c7ebc

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ import Database.SQLite.Simple
8585
import HieDb.Create
8686
import HieDb.Types
8787
import 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
9190
hiedbDataVersion :: 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

ghcide/src/Development/IDE/Core/Rules.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,10 @@ getParsedModuleWithCommentsRule =
292292
liftIO $ fmap (fmap reset_ms) $ snd <$> getParsedModuleDefinition (hscEnv sess) opt file ms
293293

294294
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
296299

297300

298301
getParsedModuleDefinition

ghcide/src/Development/IDE/Plugin.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import qualified Language.LSP.Server as LSP
1010
data Plugin c = Plugin
1111
{pluginRules :: Rules ()
1212
,pluginHandlers :: LSP.Handlers (ServerM c)
13-
,pluginModifyDynflags :: DynFlagsModifications
13+
,pluginModifyDynflags :: c -> DynFlagsModifications
1414
}
1515

1616
instance Default (Plugin c) where

ghcide/src/Development/IDE/Plugin/HLS.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,14 @@ rulesPlugins rs = mempty { P.pluginRules = rules }
7070
rules = foldMap snd rs
7171

7272
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+
}
7481

7582
-- ---------------------------------------------------------------------
7683

ghcide/src/Development/IDE/Types/Options.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)