1
- {-# LANGUAGE GADTs #-}
2
- {-# LANGUAGE PolyKinds #-}
3
- {-# LANGUAGE KindSignatures #-}
4
- {-# LANGUAGE DataKinds #-}
5
- {-# LANGUAGE GADTs #-}
1
+ {-# LANGUAGE DataKinds #-}
2
+ {-# LANGUAGE GADTs #-}
3
+ {-# LANGUAGE KindSignatures #-}
6
4
{-# LANGUAGE OverloadedStrings #-}
5
+ {-# LANGUAGE PolyKinds #-}
7
6
8
7
module Development.IDE.Plugin.HLS
9
8
(
@@ -12,6 +11,7 @@ module Development.IDE.Plugin.HLS
12
11
13
12
import Control.Exception (SomeException )
14
13
import Control.Monad
14
+ import Control.Monad.IO.Class
15
15
import qualified Data.Aeson as J
16
16
import Data.Bifunctor
17
17
import Data.Dependent.Map (DMap )
@@ -28,6 +28,7 @@ import Development.IDE.Core.Shake
28
28
import Development.IDE.Core.Tracing
29
29
import Development.IDE.LSP.Server
30
30
import Development.IDE.Plugin
31
+ import Development.IDE.Types.Logger
31
32
import Development.Shake (Rules )
32
33
import Ide.Plugin.Config
33
34
import Ide.PluginUtils (getClientConfig )
@@ -48,8 +49,8 @@ asGhcIdePlugin :: Config -> IdePlugins IdeState -> Plugin Config
48
49
asGhcIdePlugin defaultConfig mp =
49
50
mkPlugin rulesPlugins HLS. pluginRules <>
50
51
mkPlugin executeCommandPlugins HLS. pluginCommands <>
51
- mkPlugin (extensiblePlugins defaultConfig) HLS. pluginHandlers
52
- mkPlugin extensibleNotificationPlugins HLS. pluginNotificationHandlers
52
+ mkPlugin (extensiblePlugins defaultConfig) HLS. pluginHandlers <>
53
+ mkPlugin ( extensibleNotificationPlugins defaultConfig) HLS. pluginNotificationHandlers
53
54
where
54
55
ls = Map. toList (ipMap mp)
55
56
@@ -161,8 +162,8 @@ extensiblePlugins defaultConfig xs = Plugin mempty handlers
161
162
pure $ Right $ combineResponses m config caps params xs
162
163
-- ---------------------------------------------------------------------
163
164
164
- extensibleNotificationPlugins :: [(PluginId , PluginNotificationHandlers IdeState )] -> Plugin Config
165
- extensibleNotificationPlugins xs = Plugin mempty handlers
165
+ extensibleNotificationPlugins :: Config -> [(PluginId , PluginNotificationHandlers IdeState )] -> Plugin Config
166
+ extensibleNotificationPlugins defaultConfig xs = Plugin mempty handlers
166
167
where
167
168
IdeNotificationHandlers handlers' = foldMap bakePluginId xs
168
169
bakePluginId :: (PluginId , PluginNotificationHandlers IdeState ) -> IdeNotificationHandlers
@@ -173,7 +174,7 @@ extensibleNotificationPlugins xs = Plugin mempty handlers
173
174
(IdeNotification m :=> IdeNotificationHandler fs') <- DMap. assocs handlers'
174
175
pure $ notificationHandler m $ \ ide params -> do
175
176
liftIO $ logInfo (ideLogger ide) " extensibleNotificationPlugins handler entered"
176
- config <- getClientConfig
177
+ config <- fromMaybe defaultConfig <$> Ide.PluginUtils. getClientConfig
177
178
let fs = filter (\ (pid,_) -> pluginEnabledNotification m pid config) fs'
178
179
case nonEmpty fs of
179
180
Nothing -> do
0 commit comments