From 9c3037b545da988460aa529d99e0846619e2d07d Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Tue, 4 Aug 2020 13:29:42 +0100 Subject: [PATCH] Fix rename capability being declared When there are no plugins provided that provider a pluginRenameProvider This also applies to the other capabilities --- src/Ide/Plugin.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Ide/Plugin.hs b/src/Ide/Plugin.hs index a9745345a3..ed3610522d 100644 --- a/src/Ide/Plugin.hs +++ b/src/Ide/Plugin.hs @@ -72,8 +72,13 @@ asGhcIdePlugin mp = ls = Map.toList (ipMap mp) mkPlugin :: ([(PluginId, b)] -> Plugin Config) -> (PluginDescriptor -> Maybe b) -> Plugin Config - mkPlugin maker selector - = maker $ concatMap (\(pid, p) -> justs (pid, selector p)) ls + mkPlugin maker selector = + case concatMap (\(pid, p) -> justs (pid, selector p)) ls of + -- If there are no plugins that provide a descriptor, use mempty to + -- create the plugin – otherwise we we end up declaring handlers for + -- capabilities that there are no plugins for + [] -> mempty + xs -> maker xs pluginDescToIdePlugins :: [PluginDescriptor] -> IdePlugins