Skip to content

Conversation

Jack251970
Copy link
Member

@Jack251970 Jack251970 commented Sep 6, 2025

Some plugins do not need any action keywords. And we should support that so that Flow will not add this plugin into action keyword dictionary.

Currently, "ActionKeyword": "" is supported, but "ActionKeywords": [] is not. This PR enables support for that.

Related:
Flow-Launcher/Flow.Launcher.Plugin.QuickLook#10
Flow-Launcher/Flow.Launcher.Plugin.QuickLook#13

It does not seem to be supported in Flow

Copilot

This comment was marked as outdated.

Copy link

gitstream-cm bot commented Sep 6, 2025

🥷 Code experts: no user but you matched threshold 10

Jack251970 has most 👩‍💻 activity in the files.
Jack251970 has most 🧠 knowledge in the files.

See details

Flow.Launcher.Core/Plugin/PluginConfig.cs

Activity based on git-commit:

Jack251970
SEP
AUG
JUL
JUN
MAY
APR 17 additions & 11 deletions

Knowledge based on git-blame:
Jack251970: 14%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

Copy link

gitstream-cm bot commented Sep 6, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copy link
Contributor

coderabbitai bot commented Sep 6, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adjusts GetPluginMetadata in PluginConfig to derive ActionKeyword from metadata.ActionKeywords?.FirstOrDefault() ?? string.Empty, ensuring a non-null ActionKeyword when ActionKeywords exists but is empty. No other logic or public APIs changed.

Changes

Cohort / File(s) Summary
Plugin metadata keyword derivation
Flow.Launcher.Core/Plugin/PluginConfig.cs
Use metadata.ActionKeywords?.FirstOrDefault() ?? string.Empty to assign ActionKeyword, preventing exceptions when ActionKeywords is present but empty. Existing ActionKeywords initialization (metadata.ActionKeywords ??= new List<string> { metadata.ActionKeyword }) remains unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant PC as PluginConfig
  participant GM as GetPluginMetadata()
  participant AK as ActionKeywords (IList)
  participant MD as Metadata

  PC->>GM: Build metadata
  GM->>AK: Evaluate metadata.ActionKeywords
  alt ActionKeywords != null and has elements
    GM->>MD: ActionKeyword = ActionKeywords.FirstOrDefault()
  else ActionKeywords != null but empty
    GM->>MD: ActionKeyword = string.Empty
  else ActionKeywords == null
    GM->>MD: (unchanged initialization logic applies)
  end
  GM-->>PC: Return metadata
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • jjw24

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f019a1 and 2eeaf38.

📒 Files selected for processing (1)
  • Flow.Launcher.Core/Plugin/PluginConfig.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher.Core/Plugin/PluginConfig.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch support_non_action_keyword

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for plugins that do not need any action keywords by modifying how the ActionKeyword property is assigned when ActionKeywords list is empty.

  • Modified the ActionKeyword assignment logic to handle empty ActionKeywords collections
  • Ensures plugins without action keywords are not added to Flow's action keyword dictionary

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coderabbitai coderabbitai bot added the enhancement New feature or request label Sep 6, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
Flow.Launcher.Core/Plugin/PluginConfig.cs (1)

122-122: Redundant null-conditionals

ActionKeywords can’t be null after Line 120, so ?.Count and ?[0] are unnecessary and slightly obscure intent.

🧹 Nitpick comments (3)
Flow.Launcher.Core/Plugin/PluginConfig.cs (3)

120-123: Normalize keywords and avoid nullable first-element; also simplify null handling

After Line 120, ActionKeywords is guaranteed non-null. Use direct Count/indexer and normalize away null/whitespace entries so ActionKeyword never ends up null. This also cleanly represents “no action keyword” as string.Empty.

Apply:

-                // for plugins which doesn't has ActionKeywords key
-                metadata.ActionKeywords ??= new List<string> { metadata.ActionKeyword };
-                // for plugin still use old ActionKeyword
-                metadata.ActionKeyword = metadata.ActionKeywords?.Count == 0 ? string.Empty : metadata.ActionKeywords?[0];
+                // For plugins that don't define ActionKeywords, seed from legacy ActionKeyword, then normalize
+                metadata.ActionKeywords = (metadata.ActionKeywords ?? new List<string> { metadata.ActionKeyword })
+                    .Where(k => !string.IsNullOrWhiteSpace(k))
+                    .ToList();
+                // Back-compat: expose first keyword, or empty string if none
+                metadata.ActionKeyword = metadata.ActionKeywords.Count == 0 ? string.Empty : metadata.ActionKeywords[0];

138-139: Fix typos and missing bracket in log message

Current message has “conifg” and a missing closing ‘>’.

Apply:

-                API.LogError(ClassName, $"Execute file path didn't exist <{metadata.ExecuteFilePath}> for conifg <{configPath}");
+                API.LogError(ClassName, $"Execute file path doesn't exist <{metadata.ExecuteFilePath}> for config <{configPath}>");

30-31: Polish TODO comment (spelling/grammar)

Minor readability cleanup.

Apply:

-            // todo use linq when diable plugin is implmented since parallel.foreach + list is not thread saft
+            // TODO: Use LINQ when disable-plugin is implemented, since Parallel.ForEach + List<T> is not thread-safe
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b898c46 and 1f019a1.

📒 Files selected for processing (1)
  • Flow.Launcher.Core/Plugin/PluginConfig.cs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build

Co-authored-by: Copilot <[email protected]>
@Jack251970 Jack251970 closed this Sep 6, 2025
auto-merge was automatically disabled September 6, 2025 16:03

Pull request was closed

@jjw24 jjw24 removed the 1 min review label Sep 6, 2025
@jjw24 jjw24 deleted the support_non_action_keyword branch September 13, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants