From ef34a63f7a4416e1499e98fa32055262079f6f6d Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 4 Aug 2019 21:47:05 +1000 Subject: [PATCH] Update Initialisation of plugin method Handle when plugin has a mix of global and non-global action keywords --- Wox.Core/Plugin/PluginManager.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index 97b260114e..6ca826fd9b 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -106,16 +106,12 @@ namespace Wox.Core.Plugin foreach (var plugin in AllPlugins) { if (IsGlobalPlugin(plugin.Metadata)) - { GlobalPlugins.Add(plugin); - } - else - { - foreach (string actionKeyword in plugin.Metadata.ActionKeywords) - { - NonGlobalPlugins[actionKeyword] = plugin; - } - } + + // Plugins may have multiple ActionKeywords, eg. WebSearch + plugin.Metadata.ActionKeywords.Where(x => x != Query.GlobalPluginWildcardSign) + .ToList() + .ForEach(x => NonGlobalPlugins[x] = plugin); } }