-
-
Notifications
You must be signed in to change notification settings - Fork 368
Support Multiple keywords for Plugins #3261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ange its keywords
This comment has been minimized.
This comment has been minimized.
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
📝 WalkthroughWalkthroughThe pull request refines the management of action keywords across multiple modules. In the core Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (7)
💤 Files with no reviewable changes (2)
🚧 Files skipped from review as they are similar to previous changes (4)
🔇 Additional comments (4)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
Flow.Launcher/ActionKeywords.xaml.cs (1)
39-41
: Consider adding validation for individual keywords and a maximum limit.To prevent potential issues:
- Add validation for individual keyword format (e.g., no special characters).
- Add a maximum limit on the number of keywords to prevent performance issues.
var newActionKeywords = tbAction.Text.Split(Query.ActionKeywordSeparator).ToList(); newActionKeywords.RemoveAll(string.IsNullOrEmpty); newActionKeywords = newActionKeywords.Distinct().ToList(); +const int MaxKeywords = 5; +newActionKeywords = newActionKeywords.Where(k => IsValidKeyword(k)).Take(MaxKeywords).ToList(); + +bool IsValidKeyword(string keyword) +{ + return !string.IsNullOrWhiteSpace(keyword) && + keyword.All(c => char.IsLetterOrDigit(c) || c == '_'); +}Plugins/Flow.Launcher.Plugin.Explorer/plugin.json (1)
3-6
: Clarify the ActionKeywords change.
The ActionKeywords array now contains only two entries:"*"
and"doc:"
. This indicates that redundant*
keywords have been removed, which aligns with the PR objective to eliminate superfluous keywords. Please verify that retaining the single"*"
entry is intentional (e.g., for backward compatibility or a default behavior) and that its usage is well documented in the plugin documentation if needed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
Flow.Launcher.Core/Plugin/PluginManager.cs
(3 hunks)Flow.Launcher.Plugin/PluginMetadata.cs
(1 hunks)Flow.Launcher.Plugin/Query.cs
(1 hunks)Flow.Launcher/ActionKeywords.xaml.cs
(2 hunks)Flow.Launcher/Languages/en.xaml
(1 hunks)Flow.Launcher/ViewModel/MainViewModel.cs
(0 hunks)Flow.Launcher/ViewModel/PluginViewModel.cs
(3 hunks)Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
(1 hunks)Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs
(2 hunks)Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs
(1 hunks)Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json
(1 hunks)
💤 Files with no reviewable changes (1)
- Flow.Launcher/ViewModel/MainViewModel.cs
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: gitStream.cm
- GitHub Check: gitStream.cm
🔇 Additional comments (12)
Flow.Launcher.Plugin/PluginMetadata.cs (1)
37-37
: LGTM! Good addition of theAllowModifyActionKeywords
property.The property aligns with the PR objectives by providing a way to restrict keyword modifications for certain plugins, with a sensible default value of
true
.Flow.Launcher/ActionKeywords.xaml.cs (1)
37-44
: LGTM! Good implementation of multiple action keywords support.The changes correctly handle multiple action keywords by:
- Splitting input by whitespace
- Removing empty entries
- Removing duplicates
- Adding wildcard sign if no valid keywords remain
Flow.Launcher.Plugin/Query.cs (1)
42-44
: LGTM! Good update to use whitespace as separator.The changes:
- Align with PR objectives by changing separator from
;
to space.- Maintain consistency by reusing
TermSeparator
.- Include clear documentation.
Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs (1)
43-43
: LGTM! Good update to use API context.The change correctly uses
_context.API.RemoveActionKeyword
instead ofPluginManager.RemoveActionKeyword
, maintaining consistency with the broader changes in action keyword management.Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs (1)
82-87
: LGTM! The changes improve the API usage.The switch from
PluginManager.ActionKeywordRegistered
to_context.API.ActionKeywordAssigned
is a good architectural improvement that:
- Maintains proper separation of concerns
- Follows the principle of using the API context for plugin operations
Also applies to: 101-106
Flow.Launcher/ViewModel/PluginViewModel.cs (2)
104-104
: LGTM! The visibility logic aligns with the PR objectives.The change to use
AllowModifyActionKeywords
properly implements the requirement to restrict keyword modifications for certain plugins.
113-117
: LGTM! The method signature change supports multiple keywords.The update to accept
IReadOnlyList<string>
parameters properly implements the requirement to support multiple keywords while maintaining immutability through read-only collections.Flow.Launcher.Core/Plugin/PluginManager.cs (3)
343-353
: LGTM! The method properly validates multiple keywords.The implementation correctly:
- Iterates through new keywords
- Checks each against old keywords
- Returns early on first conflict
411-437
: LGTM! The method safely handles keyword replacements.The implementation:
- Checks if keywords actually changed
- Safely handles collection modifications
- Updates metadata correctly
- Maintains proper error handling
439-444
: LGTM! The helper method properly detects changes.The implementation efficiently detects changes by:
- Comparing counts first
- Using LINQ to compare elements
Flow.Launcher/Languages/en.xaml (1)
338-338
: LGTM! The instructions clearly explain the new keyword format.The updated text properly informs users about:
- Using multiple keywords
- Using whitespace as the separator
- Using
*
for global triggersPlugins/Flow.Launcher.Plugin.WebSearch/plugin.json (1)
26-26
: Enforce Action Keyword Modification Restrictions.
The addition of the"AllowModifyActionKeywords": false
property clearly prevents users from modifying the action keywords for the WebSearch plugin. This change aligns with the PR objective to preserve the integrity of the plugin's functionality. Ensure that the consuming code correctly reads and respects this flag when processing action keyword changes.
… keywords of Explorer
This comment has been minimized.
This comment has been minimized.
Does this mean the explorer plugin (and the web search plugin) will demonstrate the actionkeyword assign panel? They should not display the control for user to change the actionkeyword. |
Yes, if one plugin can change its action keyword in its settings panel, it can add |
Yeah ok in this case let's keep how you have done it @Jack251970. |
Also what's the reason for disallowing the WebSearch and Explorer action keywords been changed from settings panel? |
Well, we can do this UI improvement in the future. |
This comment has been minimized.
This comment has been minimized.
Yeah, we can do that and I want to do that in another PR. (I need onesounds's help with UI desgin) |
Ok sounds good. |
I don't think Also maybe call it |
Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj
Outdated
Show resolved
Hide resolved
It works fine for me. I guess you have not changed |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. If the flagged items are 🤯 false positivesIf items relate to a ...
|
@jjw24 Hi, is this working as expected? |
Support multiple keywords for plugins
Support user to set multiple keywords for plugins
I change the action keyword separator from
because
is the character we used to split terms so we should not let user include that character in one action keyword so we can use it as separator which can help us to fix one possible issue that action keyword with
cannot work (I find FL does not notify users about this).
;
toSupport plugin to not allow user change its action keyword
I find
WebSearch
andExplorer
plugin need this because these plugins let user change its keywords from settings panel.Fix issue that plugin cannot update ActionKeyword after changing its keywords
Check d9ba38b
Test
2025-02-21.14-03-47.online-video-cutter.com.mp4