Skip to content

Commit 272ad8d

Browse files
committed
run the handlers in parallel
1 parent 96af25d commit 272ad8d

File tree

1 file changed

+5
-3
lines changed
  • ghcide/src/Development/IDE/Plugin

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ import Language.LSP.Types
3838
import qualified Language.LSP.Types as J
3939
import Text.Regex.TDFA.Text ()
4040
import UnliftIO (MonadUnliftIO)
41-
import UnliftIO.Async (forConcurrently)
41+
import UnliftIO.Async (forConcurrently,
42+
mapConcurrently_)
4243
import UnliftIO.Exception (catchAny)
4344

4445
-- ---------------------------------------------------------------------
@@ -185,7 +186,8 @@ extensibleNotificationPlugins defaultConfig xs = Plugin mempty handlers
185186
-- Just fs -> void $ runConcurrentlyNotification (show m) fs ide params
186187
Just fs -> do
187188
liftIO $ logInfo (ideLogger ide) $ "extensibleNotificationPlugins number of plugins:" <> T.pack (show (length fs))
188-
mapM_ (\(_pid,f) -> f ide params) fs
189+
-- run notification handlers in parallel
190+
mapConcurrently_ (\(_pid,f) -> f ide params) fs
189191

190192
-- ---------------------------------------------------------------------
191193

@@ -211,7 +213,7 @@ newtype IdeHandler (m :: J.Method FromClient Request)
211213

212214
-- | Combine the 'PluginHandler' for all plugins
213215
newtype IdeNotificationHandler (m :: J.Method FromClient Notification)
214-
= IdeNotificationHandler [(PluginId,(IdeState -> MessageParams m -> LSP.LspM Config (NonEmpty ())))]
216+
= IdeNotificationHandler [(PluginId, IdeState -> MessageParams m -> LSP.LspM Config (NonEmpty ()))]
215217
-- type NotificationHandler (m :: Method FromClient Notification) = MessageParams m -> IO ()`
216218

217219
-- | Combine the 'PluginHandlers' for all plugins

0 commit comments

Comments
 (0)