@@ -26,6 +26,7 @@ import Development.IDE.Core.Shake
26
26
import Development.IDE.Core.Tracing
27
27
import Development.IDE.LSP.Server
28
28
import Development.IDE.Plugin
29
+ import qualified Development.IDE.Plugin as P
29
30
import Development.IDE.Types.Logger
30
31
import Development.IDE.Graph (Rules )
31
32
import Ide.Plugin.Config
@@ -38,6 +39,7 @@ import Text.Regex.TDFA.Text ()
38
39
import UnliftIO (MonadUnliftIO )
39
40
import UnliftIO.Async (forConcurrently )
40
41
import UnliftIO.Exception (catchAny )
42
+ import Development.IDE.GHC.Compat (DynFlags )
41
43
42
44
-- ---------------------------------------------------------------------
43
45
--
@@ -48,7 +50,8 @@ asGhcIdePlugin (IdePlugins ls) =
48
50
mkPlugin rulesPlugins HLS. pluginRules <>
49
51
mkPlugin executeCommandPlugins HLS. pluginCommands <>
50
52
mkPlugin extensiblePlugins HLS. pluginHandlers <>
51
- mkPlugin extensibleNotificationPlugins HLS. pluginNotificationHandlers
53
+ mkPlugin extensibleNotificationPlugins HLS. pluginNotificationHandlers <>
54
+ mkPlugin dynFlagsPlugins HLS. pluginModifyDynflags
52
55
where
53
56
54
57
mkPlugin :: ([(PluginId , b )] -> Plugin Config ) -> (PluginDescriptor IdeState -> b ) -> Plugin Config
@@ -63,14 +66,17 @@ asGhcIdePlugin (IdePlugins ls) =
63
66
-- ---------------------------------------------------------------------
64
67
65
68
rulesPlugins :: [(PluginId , Rules () )] -> Plugin Config
66
- rulesPlugins rs = Plugin rules mempty
69
+ rulesPlugins rs = mempty { P. pluginRules = rules }
67
70
where
68
71
rules = foldMap snd rs
69
72
73
+ dynFlagsPlugins :: [(PluginId , DynFlagsModifications )] -> Plugin Config
74
+ dynFlagsPlugins rs = mempty { P. pluginModifyDynflags = foldMap snd rs }
75
+
70
76
-- ---------------------------------------------------------------------
71
77
72
78
executeCommandPlugins :: [(PluginId , [PluginCommand IdeState ])] -> Plugin Config
73
- executeCommandPlugins ecs = Plugin mempty ( executeCommandHandlers ecs)
79
+ executeCommandPlugins ecs = mempty { P. pluginHandlers = executeCommandHandlers ecs }
74
80
75
81
executeCommandHandlers :: [(PluginId , [PluginCommand IdeState ])] -> LSP. Handlers (ServerM Config )
76
82
executeCommandHandlers ecs = requestHandler SWorkspaceExecuteCommand execCmd
@@ -132,7 +138,7 @@ executeCommandHandlers ecs = requestHandler SWorkspaceExecuteCommand execCmd
132
138
-- ---------------------------------------------------------------------
133
139
134
140
extensiblePlugins :: [(PluginId , PluginHandlers IdeState )] -> Plugin Config
135
- extensiblePlugins xs = Plugin mempty handlers
141
+ extensiblePlugins xs = mempty { P. pluginHandlers = handlers }
136
142
where
137
143
IdeHandlers handlers' = foldMap bakePluginId xs
138
144
bakePluginId :: (PluginId , PluginHandlers IdeState ) -> IdeHandlers
@@ -160,7 +166,7 @@ extensiblePlugins xs = Plugin mempty handlers
160
166
-- ---------------------------------------------------------------------
161
167
162
168
extensibleNotificationPlugins :: [(PluginId , PluginNotificationHandlers IdeState )] -> Plugin Config
163
- extensibleNotificationPlugins xs = Plugin mempty handlers
169
+ extensibleNotificationPlugins xs = mempty { P. pluginHandlers = handlers }
164
170
where
165
171
IdeNotificationHandlers handlers' = foldMap bakePluginId xs
166
172
bakePluginId :: (PluginId , PluginNotificationHandlers IdeState ) -> IdeNotificationHandlers
0 commit comments