Skip to content
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

Improve Plugin Metadata & Path Management #3272

Open
wants to merge 27 commits into
base: dev
Choose a base branch
from

Conversation

Jack251970
Copy link
Contributor

@Jack251970 Jack251970 commented Feb 24, 2025

Improve Plugin Metadata & Path Management

1. Add three properties in plugin metadata

(1)AssemblyName

For .Net plugins, we do not need to use reflection to get its assembly name.

(2)PluginSettingsDirectoryPath & (3)PluginCacheDirectoryPath

For csharp & JsonRPC v2 plugins, FL can provide them with these directories so that they can store their temporary and permeant data in that place.

  • PluginSettingsDirectoryPath is the path to the plugin settings directory which is used to store plugin settings files and data files. When plugin is deleted, FL will ask users whether to keep its settings. If users do not want to keep, this directory will be deleted.
  • PluginCacheDirectoryPath is the path to the plugin cache directory which is used to store cache files. When plugin is deleted, this directory will be deleted as well.

2. Improve path management

Add many fields in DataLocation.cs so that we do not need to use Path.Combine to construct the paths.

3. Improve Flow.Launcher.Plugin documents

Add docuements in Flow.Launcher.Plugin project

4. Fix Settings & Cache Directory Removing Issue

Dispose plugin when we need to delete plugin Settings or Cache Directory.

Test

  • Loaded plugin metadata is correct.
  • Delete dotnet & non-dotnet plugins will clean their cache directory and if selected to remove their settings, settings directories will be removed.
  • After updating to new version, Program can move old cache files to its PluginCacheDirectoryPath.
  • For those plugins which locks files until disposing them, settings & cache directories can be deleted.

@Jack251970 Jack251970 marked this pull request as ready for review February 24, 2025 08:00

This comment has been minimized.

Copy link

gitstream-cm bot commented Feb 24, 2025

🥷 Code experts: no user but you matched threshold 10

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

See details

Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV 6 additions & 6 deletions
OCT
SEP

Knowledge based on git-blame:
jjw24: 55%

Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 1%

Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs

Activity based on git-commit:

Jack251970
FEB 12 additions & 2 deletions
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:

Flow.Launcher.Core/Plugin/PluginConfig.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 2%

Flow.Launcher.Core/Plugin/PluginManager.cs

Activity based on git-commit:

Jack251970
FEB 95 additions & 39 deletions
JAN
DEC
NOV 1 additions & 1 deletions
OCT
SEP

Knowledge based on git-blame:
jjw24: 4%

Flow.Launcher.Core/Plugin/PluginsLoader.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV 4 additions & 4 deletions
OCT
SEP

Knowledge based on git-blame:
jjw24: 16%

Flow.Launcher.Infrastructure/Constant.cs

Activity based on git-commit:

Jack251970
FEB
JAN 3 additions & 1 deletions
DEC 2 additions & 1 deletions
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 40%

Flow.Launcher.Infrastructure/Logger/Log.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 1%

Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 4%

Flow.Launcher.Infrastructure/Storage/JsonStorage.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 12%

Flow.Launcher.Infrastructure/Storage/PluginJsonStorage.cs

Activity based on git-commit:

Jack251970
FEB 14 additions & 4 deletions
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 11%

Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 89%

Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 17%

Flow.Launcher.Plugin/ActionContext.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:

Flow.Launcher.Plugin/Interfaces/IResultUpdated.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:

Flow.Launcher.Plugin/Interfaces/ISettingProvider.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 11%

Flow.Launcher.Plugin/PluginInitContext.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:

Flow.Launcher.Plugin/PluginMetadata.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 2%

Flow.Launcher.Plugin/PluginPair.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 3%

Flow.Launcher.Plugin/Query.cs

Activity based on git-commit:

Jack251970
FEB
JAN 1 additions & 13 deletions
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 1%

Flow.Launcher.Plugin/Result.cs

Activity based on git-commit:

Jack251970
FEB 2 additions & 1 deletions
JAN 17 additions & 0 deletions
DEC 10 additions & 0 deletions
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 11%

Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 52%

Flow.Launcher.Plugin/SharedCommands/ShellCommand.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC 21 additions & 11 deletions
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 56%

Flow.Launcher.Plugin/SharedModels/MatchResult.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 3%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Jack251970
FEB 2 additions & 4 deletions
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 8%

Flow.Launcher/PublicAPIInstance.cs

Activity based on git-commit:

Jack251970
FEB 17 additions & 0 deletions
JAN 23 additions & 24 deletions
DEC 25 additions & 32 deletions
NOV 16 additions & 0 deletions
OCT
SEP

Knowledge based on git-blame:
jjw24: 9%

Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV 2 additions & 3 deletions
OCT
SEP

Knowledge based on git-blame:

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV 2 additions & 2 deletions
OCT
SEP

Knowledge based on git-blame:

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Activity based on git-commit:

Jack251970
FEB 32 additions & 5 deletions
JAN 60 additions & 8 deletions
DEC
NOV 23 additions & 12 deletions
OCT
SEP

Knowledge based on git-blame:
jjw24: 10%

Plugins/Flow.Launcher.Plugin.Sys/Main.cs

Activity based on git-commit:

Jack251970
FEB 92 additions & 48 deletions
JAN
DEC 12 additions & 38 deletions
NOV 12 additions & 14 deletions
OCT
SEP

Knowledge based on git-blame:
jjw24: 14%

Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs

Activity based on git-commit:

Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 15%

To learn more about /:\ gitStream - Visit our Docs

Copy link

gitstream-cm bot commented Feb 24, 2025

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

@Jack251970 Jack251970 added the enhancement New feature or request label Feb 24, 2025
Copy link
Contributor

coderabbitai bot commented Feb 24, 2025

📝 Walkthrough

Walkthrough

This pull request introduces several changes across the codebase. Directory and settings path constructions have been streamlined by replacing concatenated paths with new properties from a centralized data location class. Several methods have been refactored to remove unused dependencies and simplify error handling. Additionally, new XML documentation comments have been added for clarity, and a new event with accompanying delegate and event arguments has been introduced to improve result update notifications. Minor modifications to plugin initialization logic and a new file relocation method for cache files are also included.

Changes

File(s) Change Summary
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs,
Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs,
Flow.Launcher.Core/Plugin/PluginManager.cs,
Flow.Launcher.Infrastructure/Storage/PluginJsonStorage.cs,
Flow.Launcher/PublicAPIInstance.cs,
Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs,
Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs,
Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs,
Plugins/Flow.Launcher.Plugin.Program/Main.cs,
Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs
Update settings and cache directory path constructions by using new DataLocation properties; remove methods responsible for direct deletion of directories; add a file-moving method to relocate cache files; update references to use centralized directory paths.
Flow.Launcher.Plugin/PluginMetadata.cs,
Flow.Launcher.Plugin/PluginPair.cs,
Flow.Launcher.Plugin/PluginInitContext.cs,
Flow.Launcher.Plugin/Interfaces/IResultUpdated.cs,
Flow.Launcher.Plugin/Interfaces/ISettingProvider.cs,
Flow.Launcher.Plugin/ActionContext.cs,
Flow.Launcher.Plugin/SharedCommands/ShellCommand.cs,
Flow.Launcher.Plugin/SharedModels/MatchResult.cs
Add extensive XML documentation to classes, properties, and methods; introduce a new event (ResultsUpdated) along with its delegate and event arguments to improve result update handling; update the Equals method using pattern matching; enhance MatchResult initialization and enum member definitions.
Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs,
Flow.Launcher.Core/Plugin/PluginConfig.cs
In the plugin initialization process, conditionally set the AssemblyName property during plugin pair creation and simplify the ActionKeywords assignment by using the null-coalescing assignment operator.
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs,
Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs,
Flow.Launcher.Core/Plugin/PluginsLoader.cs,
Flow.Launcher.Plugin/Result.cs,
Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs
Remove unused using directives and redundant variable declarations; simplify exception handling and object instantiation syntax.
Flow.Launcher.Infrastructure/Constant.cs,
Flow.Launcher.Infrastructure/Logger/Log.cs,
Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs,
Flow.Launcher.Infrastructure/Storage/JsonStorage.cs
Introduce a new cache constant; update logging directory initialization to leverage a centralized constant; modify BinaryStorage to support an optional directory path and update the deserialization method access modifier.
Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs Streamline plugin settings update by replacing a ContainsKey check with TryGetValue to reduce redundant dictionary accesses.
Flow.Launcher/Languages/en.xaml,
Plugins/Flow.Launcher.Plugin.Sys/Main.cs
Add new string resources for cache removal failure notifications and update command methods to use the new DataLocation property methods for obtaining log and data directory paths.

Sequence Diagram(s)

sequenceDiagram
    participant Plugin
    participant IResultUpdated
    participant Consumer
    Plugin->>IResultUpdated: Produce updated results
    IResultUpdated-->>Consumer: Trigger ResultsUpdated event with event args
    Consumer->>IResultUpdated: Process updated results
Loading

Suggested reviewers

  • jjw24
  • taooceros

Poem

I'm a bunny of code, with paws that tap,
Hopping through directories on a swift map.
I nibble on changes, both big and small,
With paths now streamlined, I answer the call.
In a world of logs and settings so bright,
I hop with joy in the soft moonlight.
🐇💻✨


📜 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 c690e59 and b0b1a26.

📒 Files selected for processing (1)
  • Plugins/Flow.Launcher.Plugin.Sys/Main.cs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Plugins/Flow.Launcher.Plugin.Sys/Main.cs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: gitStream.cm

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 4

🔭 Outside diff range comments (3)
Flow.Launcher/PublicAPIInstance.cs (2)

192-204: ⚠️ Potential issue

❓ Verification inconclusive

Breaking change: Return type changed from object to void.

The method's return type has been changed from object to void, which could break existing plugins that rely on the returned value. Please ensure that this change is documented in the release notes and that all dependent plugins are updated accordingly.

Run the following script to find any potential usages of the return value:


🏁 Script executed:

#!/bin/bash
# Description: Search for usages of RemovePluginSettings that might be affected by the return type change.

# Test: Search for method calls that assign the result to a variable or use it in an expression
rg -A 5 'RemovePluginSettings\(' | rg -A 5 '(var|object|=|return)'

Length of output: 376


Action required: Confirm External Plugin Compatibility Due to API Change

The RemovePluginSettings method in Flow.Launcher/PublicAPIInstance.cs now returns void instead of object. While our codebase search found no internal usages capturing a return value, please note that this change remains breaking for any external plugins that might rely on the previously returned object. It is essential to document this change in the release notes and ensure that all dependent plugins are updated accordingly.

  • Location: Flow.Launcher/PublicAPIInstance.cs (Lines: 192-204)
  • Action: Update documentation and notify plugin developers to verify compatibility with this API change.

192-204: ⚠️ Potential issue

Breaking change: Method return type changed from object to void.

The change in return type of RemovePluginSettings from object to void is a breaking change that could affect consumers of the public API. Consider:

  1. Maintaining backward compatibility by keeping the return type as object.
  2. Creating a new method with a different name that returns void.
  3. Incrementing the major version number to indicate a breaking change.
Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs (1)

54-66: 🛠️ Refactor suggestion

Improve exception handling in DeserializeAsync

The current exception handling silently swallows errors. Consider:

  1. Logging the exception details
  2. Adding specific exception types instead of catching all exceptions
-    catch (System.Exception)
+    catch (MemoryPackSerializationException ex)
     {
-        // Log.Exception($"|BinaryStorage.Deserialize|Deserialize error for file <{FilePath}>", e);
+        Log.Error($"|BinaryStorage.Deserialize|Failed to deserialize data: {ex.Message}");
         return defaultData;
     }
🧹 Nitpick comments (7)
Flow.Launcher.Core/Plugin/PluginManager.cs (1)

35-35: Use target-typed new expression.

The initialization can be simplified using C# 9.0's target-typed new expression.

-private static List<string> _modifiedPlugins = new();
+private static readonly List<string> _modifiedPlugins = [];
Flow.Launcher.Plugin/PluginPair.cs (1)

45-45: Fix typo in documentation.

There's a typo in the XML documentation.

-        /// Get hash coode
+        /// Get hash code
Flow.Launcher.Plugin/SharedModels/MatchResult.cs (2)

46-62: Consider making RawScore and Score more consistent

The relationship between RawScore and Score is well-implemented, but consider making Score more explicit by renaming it to FilteredScore to better reflect its nature as a filtered version of RawScore.

-public int Score { get; private set; }
+public int FilteredScore { get; private set; }

 public int RawScore
 {
     get { return _rawScore; }
     set
     {
         _rawScore = value;
-        Score = ScoreAfterSearchPrecisionFilter(_rawScore);
+        FilteredScore = ScoreAfterSearchPrecisionFilter(_rawScore);
     }
 }

97-113: Consider more descriptive enum names

The SearchPrecisionScore enum values could be more descriptive to better reflect their precision levels.

 public enum SearchPrecisionScore
 {
-    Regular = 50,
+    High = 50,

     Low = 20,

-    None = 0
+    Disabled = 0
 }
Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs (1)

9-15: Fix typo in XML documentation

There's a typo in the XML documentation.

-    /// Stroage object using binary data
+    /// Storage object using binary data
Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs (1)

32-32: Fix typo in property name

There's a typo in the property name.

-public static readonly string SettingsDirectorty = Path.Combine(DataDirectory(), Constant.Settings);
+public static readonly string SettingsDirectory = Path.Combine(DataDirectory(), Constant.Settings);
Plugins/Flow.Launcher.Plugin.Program/Main.cs (1)

196-216: LGTM! Consider enhancing error handling.

The MoveFile method effectively handles file relocation with proper validation. Consider these improvements:

  1. Add try-catch block to handle IO exceptions.
  2. Log errors and file operations for debugging.
  3. Consider using File.Move overload with overwrite parameter for atomic operations.
 static bool MoveFile(string sourcePath, string destinationPath)
 {
-    if (!File.Exists(sourcePath))
-    {
-        return false;
-    }
-
-    if (File.Exists(destinationPath))
-    {
-        File.Delete(sourcePath);
-        return false;
-    }
-
-    var destinationDirectory = Path.GetDirectoryName(destinationPath);
-    if (!Directory.Exists(destinationDirectory) && (!string.IsNullOrEmpty(destinationDirectory)))
-    {
-        Directory.CreateDirectory(destinationDirectory);
-    }
-    File.Move(sourcePath, destinationPath);
-    return true;
+    try
+    {
+        if (!File.Exists(sourcePath))
+        {
+            Log.Debug("|Flow.Launcher.Plugin.Program.Main|Source file not found", sourcePath);
+            return false;
+        }
+
+        var destinationDirectory = Path.GetDirectoryName(destinationPath);
+        if (!string.IsNullOrEmpty(destinationDirectory))
+        {
+            Directory.CreateDirectory(destinationDirectory);
+        }
+
+        File.Move(sourcePath, destinationPath, overwrite: true);
+        Log.Debug("|Flow.Launcher.Plugin.Program.Main|File moved successfully", $"{sourcePath} -> {destinationPath}");
+        return true;
+    }
+    catch (Exception ex)
+    {
+        Log.Exception("|Flow.Launcher.Plugin.Program.Main|Failed to move file", ex);
+        return false;
+    }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3573580 and 65ae342.

📒 Files selected for processing (31)
  • Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs (2 hunks)
  • Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs (1 hunks)
  • Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs (1 hunks)
  • Flow.Launcher.Core/Plugin/PluginConfig.cs (3 hunks)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (4 hunks)
  • Flow.Launcher.Core/Plugin/PluginsLoader.cs (4 hunks)
  • Flow.Launcher.Infrastructure/Constant.cs (1 hunks)
  • Flow.Launcher.Infrastructure/Logger/Log.cs (1 hunks)
  • Flow.Launcher.Infrastructure/Storage/BinaryStorage.cs (3 hunks)
  • Flow.Launcher.Infrastructure/Storage/JsonStorage.cs (1 hunks)
  • Flow.Launcher.Infrastructure/Storage/PluginJsonStorage.cs (1 hunks)
  • Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs (1 hunks)
  • Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs (1 hunks)
  • Flow.Launcher.Plugin/ActionContext.cs (1 hunks)
  • Flow.Launcher.Plugin/Interfaces/IResultUpdated.cs (1 hunks)
  • Flow.Launcher.Plugin/Interfaces/ISettingProvider.cs (1 hunks)
  • Flow.Launcher.Plugin/PluginInitContext.cs (1 hunks)
  • Flow.Launcher.Plugin/PluginMetadata.cs (2 hunks)
  • Flow.Launcher.Plugin/PluginPair.cs (2 hunks)
  • Flow.Launcher.Plugin/Query.cs (2 hunks)
  • Flow.Launcher.Plugin/Result.cs (0 hunks)
  • Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs (2 hunks)
  • Flow.Launcher.Plugin/SharedCommands/ShellCommand.cs (2 hunks)
  • Flow.Launcher.Plugin/SharedModels/MatchResult.cs (5 hunks)
  • Flow.Launcher/Languages/en.xaml (1 hunks)
  • Flow.Launcher/PublicAPIInstance.cs (1 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs (2 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Main.cs (2 hunks)
  • Plugins/Flow.Launcher.Plugin.Sys/Main.cs (2 hunks)
  • Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs (1 hunks)
💤 Files with no reviewable changes (1)
  • Flow.Launcher.Plugin/Result.cs
✅ Files skipped from review due to trivial changes (6)
  • Flow.Launcher.Plugin/ActionContext.cs
  • Flow.Launcher.Plugin/Interfaces/ISettingProvider.cs
  • Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs
  • Flow.Launcher.Plugin/SharedCommands/ShellCommand.cs
  • Flow.Launcher.Infrastructure/Constant.cs
  • Flow.Launcher.Plugin/PluginInitContext.cs
👮 Files not reviewed due to content moderation or server errors (4)
  • Flow.Launcher/PublicAPIInstance.cs
  • Flow.Launcher.Infrastructure/Logger/Log.cs
  • Plugins/Flow.Launcher.Plugin.Program/Main.cs
  • Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
🔇 Additional comments (40)
Flow.Launcher.Infrastructure/Storage/PluginJsonStorage.cs (1)

16-16: LGTM! Improved path management using centralized settings directory.

The change enhances path management by using DataLocation.PluginSettingsDirectory instead of manual path concatenation, aligning with the PR's goal of better plugin metadata management.

Flow.Launcher.Infrastructure/Storage/JsonStorage.cs (1)

19-19: LGTM! Improved configuration management using centralized constants.

The change reduces magic strings by using Constant.Settings instead of a hardcoded string value.

Plugins/Flow.Launcher.Plugin.Sys/Main.cs (1)

407-408: LGTM! Improved path references using centralized properties.

The changes enhance maintainability by:

  • Removing unnecessary local variables
  • Using direct references to centralized path properties from DataLocation

Also applies to: 411-411, 433-434, 437-437

Flow.Launcher/Languages/en.xaml (1)

134-135: LGTM! Added clear error messages for plugin cache management.

The new string resources provide user-friendly error messages for plugin cache removal failures, supporting the improved plugin cache directory management feature.

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs (1)

423-423: LGTM! Improved path management.

The change correctly uses the centralized ThemesDirectory property instead of manual path concatenation, which aligns with the PR's goal of improving path management.

Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs (1)

117-120: LGTM! Proper metadata handling for non-.NET plugins.

Setting AssemblyName to empty string for non-.NET plugins is correct as they don't have assemblies. This change aligns with the PR's goal of improving plugin metadata management.

Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs (1)

80-80: LGTM! Improved path management using centralized properties.

The changes correctly use centralized properties from DataLocation for managing paths to settings and logs, which aligns with the PR's goal of improving path management.

Also applies to: 86-86, 118-118

Flow.Launcher.Plugin/Query.cs (2)

5-7: LGTM! Added clear class documentation.

The added XML documentation clearly describes the purpose of the Query class.


65-65: LGTM! Added JsonIgnore attribute to computed property.

The addition of [JsonIgnore] attribute to FirstSearch property is correct as it's a computed property that doesn't need to be serialized.

Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs (1)

185-186: LGTM! Good use of the new PluginSettingsDirectoryPath property.

The change effectively utilizes the new PluginSettingsDirectoryPath property for managing custom icons, which aligns well with the PR's objective of improving plugin path management.

Flow.Launcher.Core/Plugin/PluginConfig.cs (1)

114-114: LGTM! Good use of modern C# syntax.

The change to use the null-coalescing assignment operator (??=) improves code readability while maintaining the same functionality.

Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs (1)

35-35: LGTM! Performance improvement in dictionary access.

The change from ContainsKey to TryGetValue pattern eliminates redundant dictionary lookups by combining the existence check and value retrieval into a single operation.

Flow.Launcher.Core/Plugin/PluginsLoader.cs (2)

77-78: LGTM! Consistent AssemblyName handling across plugin types.

The code properly sets the AssemblyName property for both .NET and non-.NET plugins, which aligns with the PR's objective of improving plugin metadata management.

Also applies to: 147-147, 165-165


139-150: LGTM! Improved code readability.

The refactored plugin pair creation using block initialization improves code readability and maintainability.

Also applies to: 157-168

Flow.Launcher.Infrastructure/Logger/Log.cs (3)

15-15: LGTM! Improved path management.

The changes effectively centralize path management by using constants and properties from DataLocation, which aligns with the PR objectives. This reduces the need for manual path construction and improves maintainability.

Also applies to: 21-21


15-15: LGTM! Path management improvements.

The changes improve path management by:

  1. Using centralized constants for directory names.
  2. Using dedicated properties for directory paths.
  3. Reducing path concatenation operations.

Also applies to: 21-21


15-15: LGTM! Path management improvements.

The changes improve path management by:

  1. Using a centralized constant for the log directory name.
  2. Using a dedicated property for the version-specific log directory path.

Also applies to: 21-21

Plugins/Flow.Launcher.Plugin.Program/Main.cs (5)

194-194: LGTM! Improved cache file management.

The changes effectively handle the migration of cache files to the new location and initialize storage with the correct paths. The validation of the plugin cache directory before moving files is a good practice.

Also applies to: 219-229


194-229: LGTM! Cache directory management improvements.

The changes improve cache management by:

  1. Validating cache directory before use.
  2. Moving old cache files to new location.
  3. Using dedicated cache directory path from plugin metadata.

194-194: LGTM! Directory validation.

The validation ensures that the plugin cache directory exists before moving files.


218-224: LGTM! Cache file migration.

The code correctly handles the migration of cache files from the old location to the new one.


226-229: LGTM! Storage initialization.

The storage initialization correctly uses the new plugin cache directory path.

Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs (3)

33-33: LGTM! Simplified settings path construction.

The change effectively uses the new PluginSettingsDirectoryPath property to simplify path construction, which aligns with the PR objectives to improve path management.


33-33: LGTM! Path management improvements.

The change improves path management by using the dedicated PluginSettingsDirectoryPath property, reducing path concatenation complexity.


33-33: LGTM! Path management improvements.

The change improves path management by using the dedicated plugin settings directory path property.

Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs (1)

30-30: LGTM! Improved path management.

The change simplifies path management by using the new PluginSettingsDirectoryPath property from PluginMetadata, which aligns with the PR objectives.

Flow.Launcher.Core/Plugin/PluginManager.cs (4)

158-173: LGTM! Well-structured path management.

The new method effectively manages plugin paths by:

  1. Using AssemblyName for .NET plugins and Name for others.
  2. Consistently organizing settings and cache directories.

565-570: LGTM! Improved .NET plugin settings cleanup.

The code correctly handles .NET plugin settings removal by:

  1. Using reflection to invoke RemovePluginSettings.
  2. Using AssemblyName for accurate identification.

572-583: LGTM! Robust error handling for settings removal.

The code properly handles settings directory removal with:

  1. Clear error logging.
  2. User-friendly error messages.

588-599: LGTM! Robust error handling for cache removal.

The code properly handles cache directory removal with:

  1. Clear error logging.
  2. User-friendly error messages.
Flow.Launcher.Plugin/PluginMetadata.cs (4)

7-9: LGTM! Comprehensive XML documentation.

The documentation is clear, concise, and follows XML documentation best practices.

Also applies to: 14-17, 19-22, 24-27, 29-32, 34-38, 40-43, 45-48, 50-53, 55-58, 60-63, 65-70


77-77: LGTM! Modern C# syntax.

Using expression-bodied member for the getter improves code readability.


125-141: LGTM! Well-documented path properties.

The new properties:

  1. PluginSettingsDirectoryPath: Clear explanation of settings directory management.
  2. PluginCacheDirectoryPath: Clear explanation of cache directory management.

142-149: LGTM! Simple and effective ToString implementation.

The ToString method is well-documented and returns a meaningful representation.

Flow.Launcher.Plugin/PluginPair.cs (2)

3-6: LGTM! Comprehensive XML documentation.

The documentation is clear, concise, and follows XML documentation best practices.

Also applies to: 8-11, 13-16, 18-22, 27-32, 44-48


34-34: LGTM! Modern C# pattern matching.

Using pattern matching with is improves code readability and safety.

Flow.Launcher.Plugin/Interfaces/IResultUpdated.cs (2)

7-16: Well-designed interface for manual result updates!

The interface is well-structured with clear XML documentation and follows C# event pattern best practices.


28-44: Great implementation of event arguments with cancellation support!

The ResultUpdatedEventArgs class is well-designed with:

  • Clear separation of concerns for results, query, and cancellation
  • Proper use of CancellationToken for async operation cancellation
  • Comprehensive XML documentation
Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs (1)

28-38: Well-organized directory structure!

The directory structure is well-organized with:

  • Clear separation of concerns (logs, cache, settings, themes)
  • Consistent use of constants
  • Logical grouping of related paths
Flow.Launcher/PublicAPIInstance.cs (1)

192-204: ⚠️ Potential issue

✅ Verification successful

Breaking change: Method return type changed from object to void.

The return type change of RemovePluginSettings from object to void is a breaking change that could affect dependent code. Please ensure that all callers are updated to handle the new return type.

Run the following script to verify the impact:


🏁 Script executed:

#!/bin/bash
# Description: Find all usages of RemovePluginSettings to ensure they handle the new return type.

# Test: Search for method calls. Expect: No usages that depend on the return value.
rg -A 5 'RemovePluginSettings'

Length of output: 2409


Verification Confirmed: No Impact from Return Type Change in RemovePluginSettings

After verifying the codebase, the change of the RemovePluginSettings method's return type from object to void is safe for internal usage. In particular:

  • The only invocation (in Flow.Launcher.Core/Plugin/PluginManager.cs) uses reflection (method?.Invoke(API, new object[] { plugin.AssemblyName });) without capturing any return value.
  • No internal caller depends on the returned value, so the breaking change does not affect the current logic.

Please confirm there are no external dependencies or documentation that expect the previous return type. If not, this change can be considered safe.

@Jack251970 Jack251970 added the Documentation Update required to documentation label Feb 24, 2025

This comment has been minimized.

This comment has been minimized.

{
File.Delete(sourcePath);
}
catch (Exception)
Copy link
Member

Choose a reason for hiding this comment

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

when will this happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the old cache files are not cleaned. next time it wil retry it again

Copy link
Member

Choose a reason for hiding this comment

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

no I mean why the delete will fail. If it fail shouldn't next time it will also failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no I mean why the delete will fail.

it will fail if user happens to open this file.

If it fail shouldn't next time it will also failed?

not exactly. if last time user happens to open this file, it will success next time if user closes this file. no matter how many times it has failed before, if it succeeds once, the file will be deleted permanently since we will never create file in the old path.

/// When plugin is deleted, FL will ask users whether to keep its settings.
/// If users do not want to keep, this directory will be deleted.
/// </summary>
[JsonIgnore]
Copy link
Member

Choose a reason for hiding this comment

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

I think we can not ignore these, as that would help jsonrpc plugin (V2) to retrive these information.

However, I am not sure whether we save it to somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, I do not think so. from my view, this data should be runtime only, and need to be initialized every time we start FL. perhaps in the future, we will change the plugin settings path to other place and we should not use the original paths

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I know your meaning. I find that JsonRPC plugins cannot get metadata instance which means they cannot get these paths.

Could we pass this parameter to the plugins in function like InitAsync (Dotnet plugins has this but JsonRPC not, why?)

Additionally, I have changed the codes to make sure metadata of these JsonRPC plugins is correct before creating JsonRPCPlugin instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar to

public IReadOnlyDictionary<string, object> Inner => Settings;
protected ConcurrentDictionary<string, object> Settings { get; set; }

I believe we should also expose PluginMetadata to JsonRPC plugins.

I guess we can add here:

await RPC.InvokeAsync("initialize", context);

However, I’m not very familiar with this part of the codes and might not be able to contribute directly at the moment. 😢

Copy link
Member

Choose a reason for hiding this comment

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

That's what I do to v2. For v1, it's kindly not in the protocol so I don't think we can do that.

Copy link
Contributor Author

@Jack251970 Jack251970 Mar 16, 2025

Choose a reason for hiding this comment

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

So provide this feature only to JsonRPC v2 plugins?

This comment has been minimized.

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: 0

🧹 Nitpick comments (1)
Plugins/Flow.Launcher.Plugin.Program/Main.cs (1)

196-236: Enhance error handling in the file move operation.

While the current implementation with silent error handling is designed to retry on next plugin start, it would be beneficial to:

  1. Log specific error types for better debugging.
  2. Handle specific error cases differently (e.g., file in use vs. permission denied).

Apply this diff to improve error handling:

 static void MoveFile(string sourcePath, string destinationPath)
 {
     if (!File.Exists(sourcePath))
     {
         return;
     }

     if (File.Exists(destinationPath))
     {
         try
         {
             File.Delete(sourcePath);
         }
-        catch (Exception)
+        catch (UnauthorizedAccessException e)
         {
-            // Ignore, we will handle next time we start the plugin
+            Log.Error($"|Flow.Launcher.Plugin.Program.Main|Access denied while deleting source file: {e.Message}");
+        }
+        catch (IOException e) when ((e.HResult & 0x0000FFFF) == 32)
+        {
+            Log.Error("|Flow.Launcher.Plugin.Program.Main|Source file is in use");
+        }
+        catch (Exception e)
+        {
+            Log.Error($"|Flow.Launcher.Plugin.Program.Main|Failed to delete source file: {e.Message}");
         }
         return;
     }

     var destinationDirectory = Path.GetDirectoryName(destinationPath);
     if (!Directory.Exists(destinationDirectory) && (!string.IsNullOrEmpty(destinationDirectory)))
     {
         try
         {
             Directory.CreateDirectory(destinationDirectory);
         }
-        catch (Exception)
+        catch (UnauthorizedAccessException e)
         {
-            // Ignore, we will handle next time we start the plugin
+            Log.Error($"|Flow.Launcher.Plugin.Program.Main|Access denied while creating directory: {e.Message}");
+            return;
+        }
+        catch (Exception e)
+        {
+            Log.Error($"|Flow.Launcher.Plugin.Program.Main|Failed to create directory: {e.Message}");
+            return;
         }
     }
     try
     {
         File.Move(sourcePath, destinationPath);
     }
-    catch (Exception)
+    catch (UnauthorizedAccessException e)
     {
-        // Ignore, we will handle next time we start the plugin
+        Log.Error($"|Flow.Launcher.Plugin.Program.Main|Access denied while moving file: {e.Message}");
+    }
+    catch (IOException e) when ((e.HResult & 0x0000FFFF) == 32)
+    {
+        Log.Error("|Flow.Launcher.Plugin.Program.Main|File is in use");
+    }
+    catch (Exception e)
+    {
+        Log.Error($"|Flow.Launcher.Plugin.Program.Main|Failed to move file: {e.Message}");
     }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6622815 and f8d0981.

📒 Files selected for processing (3)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (4 hunks)
  • Flow.Launcher.Plugin/PluginMetadata.cs (2 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Main.cs (2 hunks)
🔇 Additional comments (7)
Plugins/Flow.Launcher.Plugin.Program/Main.cs (2)

194-194: LGTM!

Good practice to validate the directory before performing file operations.


238-248: LGTM!

The implementation correctly:

  1. Moves cache files from old to new locations.
  2. Initializes storage with the new plugin cache directory paths.
Flow.Launcher.Core/Plugin/PluginManager.cs (2)

154-183: LGTM!

The implementation correctly:

  1. Separates .NET and non-.NET plugins.
  2. Uses consistent path patterns.
  3. Updates paths at appropriate times during plugin loading.

573-610: LGTM!

The implementation correctly:

  1. Handles .NET plugin settings removal.
  2. Provides appropriate error handling with user notifications.
  3. Uses the new plugin metadata properties for path management.
Flow.Launcher.Plugin/PluginMetadata.cs (3)

7-62: LGTM!

The XML documentation is clear, descriptive, and follows standard conventions.


63-84: LGTM!

The implementation correctly:

  1. Adds AssemblyName property for .NET plugins.
  2. Updates related paths in PluginDirectory setter.

125-141: LGTM!

The implementation correctly:

  1. Adds properties for settings and cache directories.
  2. Provides clear documentation about their purpose and behavior.
  3. Marks properties as JsonIgnore since they are runtime-only.

This comment has been minimized.

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: 0

🧹 Nitpick comments (1)
Flow.Launcher.Core/Plugin/PluginManager.cs (1)

259-259: Improved dictionary access safety with TryGetValue.

Using TryGetValue instead of direct indexing eliminates potential KeyNotFoundException when the action keyword doesn't exist.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f8d0981 and 7975ab5.

📒 Files selected for processing (8)
  • Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs (2 hunks)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (4 hunks)
  • Flow.Launcher.Core/Plugin/PluginsLoader.cs (4 hunks)
  • Flow.Launcher.Infrastructure/Storage/JsonStorage.cs (1 hunks)
  • Flow.Launcher/Languages/en.xaml (1 hunks)
  • Flow.Launcher/PublicAPIInstance.cs (1 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs (2 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs
  • Flow.Launcher.Infrastructure/Storage/JsonStorage.cs
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs
  • Flow.Launcher/PublicAPIInstance.cs
  • Flow.Launcher/Languages/en.xaml
  • Flow.Launcher.Core/Plugin/PluginsLoader.cs
  • Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: gitStream.cm
🔇 Additional comments (6)
Flow.Launcher.Core/Plugin/PluginManager.cs (6)

38-38: Modernized syntax using C# target-typed new expression.

This is a minor readability improvement using C#'s target-typed new expression.


157-162: Good separation of plugin directory updates based on plugin type.

Excellent approach to update paths at the right time - JSON RPC plugin directories before loading plugins, and .NET plugin directories after loading (when assembly name is available).


164-186: Clean implementation of plugin directory management.

The code clearly distinguishes between .NET and non-.NET plugins, setting appropriate paths based on either assembly name or plugin name. This implementation supports the PR objective of providing dedicated locations for plugins to store their settings and cache files.


577-582: Eliminated reflection in favor of direct property access.

Using the AssemblyName property directly rather than obtaining it through reflection is a good improvement that aligns with the PR objectives.


584-595: Enhanced error handling for plugin settings directory deletion.

Using the new PluginSettingsDirectoryPath property simplifies the code while the added try-catch block with proper error logging and user notification improves robustness.


600-611: Added proper cleanup of plugin cache directory.

This new block correctly handles the deletion of plugin cache files when a plugin is removed, with appropriate error handling and user notification.

This comment has been minimized.

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: 0

🧹 Nitpick comments (1)
Flow.Launcher.Core/Plugin/PluginManager.cs (1)

573-573: Consider using Task return type instead of async void.

Using async void is generally discouraged except for event handlers as it can lead to unhandled exceptions and difficult debugging.

- internal static async void UninstallPlugin(PluginMetadata plugin, bool removePluginFromSettings, bool removePluginSettings, bool checkModified)
+ internal static async Task UninstallPlugin(PluginMetadata plugin, bool removePluginFromSettings, bool removePluginSettings, bool checkModified)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7975ab5 and ce3a3e9.

📒 Files selected for processing (1)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: gitStream.cm
🔇 Additional comments (9)
Flow.Launcher.Core/Plugin/PluginManager.cs (9)

38-38: Modern syntax improvement.

Using target-typed new expression (C# 9.0+) for list initialization.


75-89: Good refactoring of plugin disposal logic.

This refactoring properly handles both IDisposable and IAsyncDisposable interfaces, improving code organization and maintainability.


162-167: Improved plugin directory management with clear sequencing.

The code correctly updates JSON RPC plugin directories before loading plugins (when they're needed) and .NET plugin directories after loading (when assembly names are available).


169-190: Well-implemented plugin directory path management.

These new methods establish proper path management using the new metadata properties, which aligns with the PR objectives. The separation by plugin language type ensures correct path construction for different plugin types.


264-264: Improved dictionary lookup pattern.

Changed from direct check to TryGetValue pattern for better readability.


580-590: Good approach to plugin disposal before removal.

Disposing plugins before deletion ensures they release file handles, which helps with successfully removing directories.


592-613: Well-structured plugin settings directory handling.

The code properly uses the new metadata properties instead of constructing paths manually, which aligns with the PR objectives. The exception handling with user-friendly error messages is also commendable.


617-628: Good implementation of cache directory removal.

Similar to settings directory handling, this properly uses the new metadata properties and includes appropriate error handling with user feedback.


598-598: Reference to previous discussion on AssemblyName usage.

This line demonstrates how the new AssemblyName property replaces the previous reflection-based approach, as mentioned in the past review comments. Good implementation.

This comment has been minimized.

This comment has been minimized.

@prlabeler prlabeler bot added the bug Something isn't working label Mar 6, 2025
@Jack251970 Jack251970 requested a review from taooceros March 6, 2025 13:21

This comment has been minimized.

Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors Count
ℹ️ candidate-pattern 1
❌ forbidden-pattern 22
⚠️ ignored-expect-variant 1
⚠️ non-alpha-in-dictionary 19

See ❌ Event descriptions for more information.

Pattern suggestions ✂️ (1)

You could add these patterns to .github/actions/spelling/patterns.txt:

# Automatically suggested patterns

# hit-count: 3 file-count: 1
# Non-English
[a-zA-Z]*[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3}[a-zA-ZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]*

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Documentation Update required to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants