Skip to content

Commit 96af25d

Browse files
committed
Fix handling of config
1 parent 2881919 commit 96af25d

File tree

1 file changed

+11
-10
lines changed
  • ghcide/src/Development/IDE/Plugin

1 file changed

+11
-10
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
{-# LANGUAGE GADTs #-}
2-
{-# LANGUAGE PolyKinds #-}
3-
{-# LANGUAGE KindSignatures #-}
4-
{-# LANGUAGE DataKinds #-}
5-
{-# LANGUAGE GADTs #-}
1+
{-# LANGUAGE DataKinds #-}
2+
{-# LANGUAGE GADTs #-}
3+
{-# LANGUAGE KindSignatures #-}
64
{-# LANGUAGE OverloadedStrings #-}
5+
{-# LANGUAGE PolyKinds #-}
76

87
module Development.IDE.Plugin.HLS
98
(
@@ -12,6 +11,7 @@ module Development.IDE.Plugin.HLS
1211

1312
import Control.Exception (SomeException)
1413
import Control.Monad
14+
import Control.Monad.IO.Class
1515
import qualified Data.Aeson as J
1616
import Data.Bifunctor
1717
import Data.Dependent.Map (DMap)
@@ -28,6 +28,7 @@ import Development.IDE.Core.Shake
2828
import Development.IDE.Core.Tracing
2929
import Development.IDE.LSP.Server
3030
import Development.IDE.Plugin
31+
import Development.IDE.Types.Logger
3132
import Development.Shake (Rules)
3233
import Ide.Plugin.Config
3334
import Ide.PluginUtils (getClientConfig)
@@ -48,8 +49,8 @@ asGhcIdePlugin :: Config -> IdePlugins IdeState -> Plugin Config
4849
asGhcIdePlugin defaultConfig mp =
4950
mkPlugin rulesPlugins HLS.pluginRules <>
5051
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
5354
where
5455
ls = Map.toList (ipMap mp)
5556

@@ -161,8 +162,8 @@ extensiblePlugins defaultConfig xs = Plugin mempty handlers
161162
pure $ Right $ combineResponses m config caps params xs
162163
-- ---------------------------------------------------------------------
163164

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
166167
where
167168
IdeNotificationHandlers handlers' = foldMap bakePluginId xs
168169
bakePluginId :: (PluginId, PluginNotificationHandlers IdeState) -> IdeNotificationHandlers
@@ -173,7 +174,7 @@ extensibleNotificationPlugins xs = Plugin mempty handlers
173174
(IdeNotification m :=> IdeNotificationHandler fs') <- DMap.assocs handlers'
174175
pure $ notificationHandler m $ \ide params -> do
175176
liftIO $ logInfo (ideLogger ide) "extensibleNotificationPlugins handler entered"
176-
config <- getClientConfig
177+
config <- fromMaybe defaultConfig <$> Ide.PluginUtils.getClientConfig
177178
let fs = filter (\(pid,_) -> pluginEnabledNotification m pid config) fs'
178179
case nonEmpty fs of
179180
Nothing -> do

0 commit comments

Comments
 (0)