Skip to content

Enhancement: Rename Quick Access Links #3586

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

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

Conversation

01Dri
Copy link
Contributor

@01Dri 01Dri commented May 25, 2025

Issue: #2207

Screenshots

image
image
image
image
image

Notes

  • If "Name" is not provided, it will be derived from the file or folder name in the given path.

@prlabeler prlabeler bot added the enhancement New feature or request label May 25, 2025

This comment has been minimized.

Copy link

gitstream-cm bot commented May 25, 2025

🥷 Code experts: jjw24

Jack251970, jjw24 have most 🧠 knowledge in the files.

See details

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Knowledge based on git-blame:
jjw24: 51%
Jack251970: 7%

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml

Knowledge based on git-blame:
jjw24: 25%
Jack251970: 6%

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

Knowledge based on git-blame:
jjw24: 45%

Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/AccessLink.cs

Knowledge based on git-blame:
jjw24: 86%

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs

Knowledge based on git-blame:
jjw24: 5%
Jack251970: 4%

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

Knowledge based on git-blame:
Jack251970: 89%
jjw24: 1%

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

Copy link
Contributor

coderabbitai bot commented May 25, 2025

📝 Walkthrough

Walkthrough

This update introduces explicit naming for quick access links in the Explorer plugin. It adds a helper for deriving names from paths, refactors the settings UI and commands for clearer management of quick access links and excluded paths, and provides a dedicated dialog for editing quick access links with validation and localization support.

Changes

File(s) Change Summary
.../ContextMenu.cs Sets Name property for new quick access links using GetPathName() helper when adding via context menu.
.../Helper/PathHelper.cs Introduces PathHelper static class with GetPathName string extension method to extract a display name from a file system path.
.../Languages/en.xaml Adds new localized strings for quick access link naming, warnings, and UI headers.
.../Main.cs Adds FixLegacyQuickAccessLinkNames method to assign names to legacy quick access links during initialization.
.../Search/QuickAccessLinks/AccessLink.cs Refactors AccessLink.Name to be a settable property (was computed); removes computed logic and related attributes/usings.
.../ViewModels/SettingsViewModel.cs Refactors and splits commands for editing/adding quick access links and excluded paths; introduces dialogs for quick access link management; adds validation and clearer separation of concerns.
.../Views/ExplorerSettings.xaml Updates ListView for quick access links to a GridView with Name and Path columns; updates command bindings to new, more specific commands for links and excluded paths.
.../Views/QuickAccessLinkSettings.xaml, .../Views/QuickAccessLinkSettings.xaml.cs Adds a new WPF window/dialog for adding and editing quick access links, with validation, two-way data binding, and localized UI; implements logic for path selection, duplicate prevention, and property change notification.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SettingsViewModel
    participant QuickAccessLinkSettings (Dialog)
    participant AccessLinkCollection

    User->>SettingsViewModel: Clicks "Add/Edit Quick Access Link"
    SettingsViewModel->>QuickAccessLinkSettings (Dialog): Opens dialog with current collection/link
    User->>QuickAccessLinkSettings (Dialog): Edits name/path, selects folder
    QuickAccessLinkSettings (Dialog)->>QuickAccessLinkSettings (Dialog): Validates input (name/path, duplicates)
    QuickAccessLinkSettings (Dialog)-->>SettingsViewModel: On "Done", updates/creates AccessLink
    SettingsViewModel->>AccessLinkCollection: Adds or updates AccessLink with explicit Name
Loading

Suggested labels

Explorer Plugin, kind/ui

Poem

A rabbit hopped through folders bright,
And named each path with pure delight.
With dialogs new and settings clear,
Quick access links now bring us cheer.
Paths and names, side by side,
In Explorer, let’s joyfully ride!
🐇✨


📜 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 cd62e7b and 29831d6.

📒 Files selected for processing (3)
  • Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml (3 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs (3 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs
  • Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Report (PR)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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: 7

🧹 Nitpick comments (4)
Plugins/Flow.Launcher.Plugin.Explorer/Helper/PathHelper.cs (1)

12-20: Consider consistency in directory separator usage.

The method uses Constants.DirectorySeparator for checking trailing separators but Path.DirectorySeparatorChar for splitting. This could lead to inconsistencies on different platforms.

Apply this diff to use consistent separator handling:

-var path = selectedPath.EndsWith(Constants.DirectorySeparator) ? selectedPath[0..^1] : selectedPath;
+var path = selectedPath.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);

-return path.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
+return path.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries)
     .Last();

This approach:

  • Uses TrimEnd to handle both directory separators uniformly
  • Removes empty entries to handle cases with multiple consecutive separators
  • Handles both primary and alternate directory separators (e.g., '/' and '' on Windows)
Plugins/Flow.Launcher.Plugin.Explorer/Main.cs (1)

101-110: Well-implemented backward compatibility method.

This method effectively handles the migration of legacy quick access links that lack explicit names. The logic correctly identifies links with missing names and applies the path-based naming convention using the GetPathName() helper method.

Consider adding a null check for safety:

 private void FixLegacyQuickAccessLinkNames()
 {
-    foreach (var link in Settings.QuickAccessLinks)
+    foreach (var link in Settings.QuickAccessLinks ?? Enumerable.Empty<AccessLink>())
     {
         if (string.IsNullOrWhiteSpace(link.Name))
         {
             link.Name = link.Path.GetPathName();
         }
     }
 }
Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml (1)

79-80: Consider adding input validation.

The Name TextBox should consider adding validation to prevent empty or duplicate names that could cause confusion.

 <TextBox
     Margin="10 0 0 0"
     VerticalAlignment="Center"
     FontSize="12"
     Width="250"
+    MaxLength="100"
     Text="{Binding SelectedName, Mode=TwoWay}" />
Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs (1)

330-422: Consider adding duplicate validation across all methods.

The current implementation doesn't prevent duplicate paths from being added to collections. Consider adding validation to check for existing paths before adding new AccessLink instances.

private bool IsPathAlreadyExists(ICollection<AccessLink> collection, string path)
{
    return collection.Any(link => string.Equals(link.Path, path, StringComparison.OrdinalIgnoreCase));
}

Then use this validation in add/edit methods before modifying collections.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6333cd3 and cd62e7b.

📒 Files selected for processing (9)
  • Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Helper/PathHelper.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml (3 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Main.cs (3 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/AccessLink.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs (2 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml (3 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs (1)
Plugins/Flow.Launcher.Plugin.Explorer/Helper/PathHelper.cs (1)
  • GetPathName (10-20)
Plugins/Flow.Launcher.Plugin.Explorer/Main.cs (1)
Plugins/Flow.Launcher.Plugin.Explorer/Helper/PathHelper.cs (1)
  • GetPathName (10-20)
🪛 GitHub Actions: Check Spelling
Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

[warning] 73-73: Spell check warning: quickaccess is not a recognized word. (unrecognized-spelling)


[warning] 84-84: Spell check warning: addfilefoldersuccess is not a recognized word. (unrecognized-spelling)


[warning] 92-92: Spell check warning: contextmenu is not a recognized word. (unrecognized-spelling)


[warning] 92-92: Spell check warning: titletooltip is not a recognized word. (unrecognized-spelling)


[warning] 101-101: Spell check warning: quickaccess is not a recognized word. (unrecognized-spelling)


[warning] 102-102: Spell check warning: quickaccess is not a recognized word. (unrecognized-spelling)


[warning] 108-108: Spell check warning: removefilefoldersuccess is not a recognized word. (unrecognized-spelling)


[warning] 115-115: Spell check warning: contextmenu is not a recognized word. (unrecognized-spelling)


[warning] 115-115: Spell check warning: titletooltip is not a recognized word. (unrecognized-spelling)


[warning] 116-116: Spell check warning: contextmenu is not a recognized word. (unrecognized-spelling)


[warning] 116-116: Spell check warning: titletooltip is not a recognized word. (unrecognized-spelling)


[warning] 125-125: Spell check warning: copypath is not a recognized word. (unrecognized-spelling)


[warning] 148-148: Spell check warning: copyname is not a recognized word. (unrecognized-spelling)


[warning] 218-218: Spell check warning: deletefilefoldersuccess is not a recognized word. (unrecognized-spelling)


[warning] 240-240: Spell check warning: contextmenu is not a recognized word. (unrecognized-spelling)


[warning] 259-259: Spell check warning: runasdifferentuser is not a recognized word. (unrecognized-spelling)


[warning] 328-328: Spell check warning: opencontainingfolder is not a recognized word. (unrecognized-spelling)


[warning] 372-372: Spell check warning: openwitheditor is not a recognized word. (unrecognized-spelling)


[warning] 405-405: Spell check warning: openwithshell is not a recognized word. (unrecognized-spelling)


[warning] 453-453: Spell check warning: openindexingoptions is not a recognized word. (unrecognized-spelling)


[warning] 470-470: Spell check warning: openindexingoptions is not a recognized word. (unrecognized-spelling)


[warning] 486-486: Spell check warning: openwith is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

[warning] 491-491: Spell check warning: previewpanel is not a recognized word. (unrecognized-spelling)


[warning] 498-498: Spell check warning: previewpanel is not a recognized word. (unrecognized-spelling)


[warning] 502-502: Spell check warning: previewpanel is not a recognized word. (unrecognized-spelling)


[warning] 506-506: Spell check warning: previewpanel is not a recognized word. (unrecognized-spelling)


[warning] 719-719: Spell check warning: lbx is not a recognized word. (unrecognized-spelling)


[warning] 794-794: Spell check warning: lbx is not a recognized word. (unrecognized-spelling)


[warning] 797-797: Spell check warning: lbx is not a recognized word. (unrecognized-spelling)


[warning] 798-798: Spell check warning: Lbx is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs

[warning] 260-260: Spell check warning: actionkeywordview is not a recognized word. (unrecognized-spelling)


[warning] 262-262: Spell check warning: actionkeywordview is not a recognized word. (unrecognized-spelling)


[warning] 264-264: Spell check warning: actionkeywordview is not a recognized word. (unrecognized-spelling)


[warning] 266-266: Spell check warning: actionkeywordview is not a recognized word. (unrecognized-spelling)


[warning] 266-266: Spell check warning: quickaccess is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (16)
Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/AccessLink.cs (1)

9-9: LGTM!

The change from a computed property to a settable property correctly supports the new explicit naming feature for quick access links. This aligns well with the use of PathHelper.GetPathName() for name assignment.

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (1)

37-52: 🛠️ Refactor suggestion

Potential infinite recursion in SelectedName getter.

The SelectedName getter calls _selectedPath.GetPathName() when _selectedName is null or empty, but if _selectedPath is also null, this could cause issues. Additionally, this logic might not behave as expected in all scenarios.

Consider simplifying the logic:

public string SelectedName
{
    get
    {
-        if (string.IsNullOrEmpty(_selectedName)) return _selectedPath.GetPathName();
-        return _selectedName;
+        return _selectedName ?? string.Empty;
    }
    set
    {
        if (_selectedName != value)
        {
            _selectedName = value;
            OnPropertyChanged();
        }
    }
}

The automatic name generation is already handled in the setter of SelectedPath (line 29), so the getter doesn't need this logic.

Likely an incorrect or invalid review comment.

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs (1)

78-81: LGTM!

The addition of the Name property assignment using GetPathName() correctly implements the new explicit naming feature for quick access links. This change aligns perfectly with the refactoring of the AccessLink class and the introduction of the PathHelper utility.

The pipeline spelling warnings for translation keys like "quickaccess", "addfilefoldersuccess", etc. are false positives since these are intentionally compound words used as localization keys.

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs (2)

9-9: LGTM - Required import for LINQ operations.

The System.Linq import is necessary for the foreach loop in the new FixLegacyQuickAccessLinkNames method.


39-39: Good placement for legacy data migration.

Calling FixLegacyQuickAccessLinkNames() here is appropriate - it runs after settings are loaded but before the view model is created, ensuring legacy quick access links get proper names.

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml (4)

722-722: Improved binding mode for better selection handling.

Changing to Mode=TwoWay ensures proper bidirectional communication between the UI and view model for selected item tracking.


723-741: Excellent UI enhancement with GridView layout.

The transition from a simple DataTemplate to a GridView with separate Name and Path columns significantly improves the user experience. The layout provides clear visual separation and makes it easy to distinguish between the customizable name and the actual path. The ellipsis trimming on the path column is a nice touch for handling long paths.


759-759: Good command naming specificity.

Renaming from generic EditLinkCommand and AddLinkCommand to EditQuickAccessLinkCommand and AddQuickAccessLinkCommand improves code clarity and maintainability by explicitly indicating the purpose of each command.

Also applies to: 765-765


819-819: Consistent command naming pattern.

The renaming to EditIndexSearchExcludePathsCommand and AddIndexSearchExcludePathsCommand maintains consistency with the quick access link command naming pattern and clearly separates functionality.

Also applies to: 825-825

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml (2)

8-9: Helpful validation messages for user guidance.

These new strings provide clear and actionable feedback to users when managing quick access links. The messages guide users to select a folder path or choose different values when conflicts arise.


32-32: Well-crafted UI labels for the new dialog.

The new header "Customise Quick Access" and label "Name:" appropriately support the new QuickAccessLinkSettings dialog interface, maintaining consistency with the existing localization patterns.

Also applies to: 98-98

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml (4)

1-19: Well-configured window properties for modal dialog.

The window configuration is appropriate for a modal dialog:

  • ResizeMode="NoResize" prevents unintended resizing
  • WindowStartupLocation="CenterScreen" ensures proper positioning
  • SizeToContent="Width" with fixed height provides optimal sizing
  • Dynamic resource bindings maintain theme consistency

35-55: Professional title bar implementation.

The custom title bar with close button follows modern WPF patterns. The path styling with opacity changes based on window activation state provides good visual feedback to the user.


67-108: Logical input field layout with good UX patterns.

The horizontal arrangement of label and input fields is clean and intuitive. Making the path field read-only with a dedicated "Select" button is a good UX pattern that prevents manual path entry errors and guides users to use proper folder selection.


112-136: Standard dialog button layout.

The bottom button area follows Windows dialog conventions with Cancel and Done buttons. The accent styling on the Done button appropriately emphasizes the primary action.

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs (1)

418-422: Good implementation of helper method.

The ShowUnselectedMessage method is well-implemented with proper localization support and clear responsibility separation.

Comment on lines 93 to 98
if (QuickAccessLinks.Any(x => x.Path == SelectedPath && x.Name == SelectedName))
{
var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_select_different_folder");
Main.Context.API.ShowMsgBox(warning);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve duplicate link validation logic.

The current validation only checks if both name and path match exactly, but it should also prevent duplicate paths with different names, as this could confuse users.

Apply this diff to improve validation:

-if (QuickAccessLinks.Any(x => x.Path == SelectedPath && x.Name == SelectedName))
+if (QuickAccessLinks.Any(x => x.Path.Equals(SelectedPath, StringComparison.OrdinalIgnoreCase) && !ReferenceEquals(x, SelectedAccessLink)))
{
-    var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_select_different_folder");
+    var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_path_already_exists");
    Main.Context.API.ShowMsgBox(warning);
    return;
}

This change:

  • Uses case-insensitive path comparison
  • Excludes the currently edited link from the duplicate check
  • Focuses on path uniqueness rather than name+path combination
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (QuickAccessLinks.Any(x => x.Path == SelectedPath && x.Name == SelectedName))
{
var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_select_different_folder");
Main.Context.API.ShowMsgBox(warning);
return;
}
if (QuickAccessLinks.Any(x =>
x.Path.Equals(SelectedPath, StringComparison.OrdinalIgnoreCase)
&& !ReferenceEquals(x, SelectedAccessLink)))
{
var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_path_already_exists");
Main.Context.API.ShowMsgBox(warning);
return;
}
🤖 Prompt for AI Agents
In Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs
around lines 93 to 98, the duplicate link validation only checks for exact
matches of both path and name, which misses cases where paths are duplicated
with different names. Update the validation to check for duplicate paths only,
using a case-insensitive comparison, and exclude the currently edited link from
this check to avoid false positives. This will ensure path uniqueness and
prevent user confusion.

Comment on lines 332 to 357
private void EditIndexSearchExcludePaths(object commandParameter)
{
var (selectedLink, collection) = commandParameter switch
{
"QuickAccessLink" => (SelectedQuickAccessLink, Settings.QuickAccessLinks),
"IndexSearchExcludedPaths" => (SelectedIndexSearchExcludedPath, Settings.IndexSearchExcludedSubdirectoryPaths),
_ => throw new ArgumentOutOfRangeException(nameof(commandParameter))
};

if (selectedLink is null)
var collection = Settings.IndexSearchExcludedSubdirectoryPaths;

if (SelectedIndexSearchExcludedPath is null)
{
ShowUnselectedMessage();
return;
}

var path = PromptUserSelectPath(selectedLink.Type,
selectedLink.Type == ResultType.Folder
? selectedLink.Path
: Path.GetDirectoryName(selectedLink.Path));
var path = PromptUserSelectPath(SelectedIndexSearchExcludedPath.Type,
SelectedIndexSearchExcludedPath.Type == ResultType.Folder
? SelectedIndexSearchExcludedPath.Path
: Path.GetDirectoryName(SelectedIndexSearchExcludedPath.Path));

if (path is null)
return;

collection.Remove(selectedLink);
var selectedType = SelectedIndexSearchExcludedPath.Type;
collection.Remove(SelectedIndexSearchExcludedPath);
collection.Add(new AccessLink
{
Path = path, Type = selectedLink.Type,
Path = path, Type = selectedType,
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing Name property assignment for AccessLink.

The method creates a new AccessLink but only sets Path and Type properties. According to the AI summary, the AccessLink class now requires explicit Name assignment instead of using a computed property.

 collection.Add(new AccessLink
 {
-    Path = path, Type = selectedType,
+    Path = path, 
+    Type = selectedType,
+    Name = PathHelper.GetPathName(path)
 });

Also consider adding validation to prevent duplicate paths and unnecessary operations when the path hasn't changed.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private void EditIndexSearchExcludePaths(object commandParameter)
{
var (selectedLink, collection) = commandParameter switch
{
"QuickAccessLink" => (SelectedQuickAccessLink, Settings.QuickAccessLinks),
"IndexSearchExcludedPaths" => (SelectedIndexSearchExcludedPath, Settings.IndexSearchExcludedSubdirectoryPaths),
_ => throw new ArgumentOutOfRangeException(nameof(commandParameter))
};
if (selectedLink is null)
var collection = Settings.IndexSearchExcludedSubdirectoryPaths;
if (SelectedIndexSearchExcludedPath is null)
{
ShowUnselectedMessage();
return;
}
var path = PromptUserSelectPath(selectedLink.Type,
selectedLink.Type == ResultType.Folder
? selectedLink.Path
: Path.GetDirectoryName(selectedLink.Path));
var path = PromptUserSelectPath(SelectedIndexSearchExcludedPath.Type,
SelectedIndexSearchExcludedPath.Type == ResultType.Folder
? SelectedIndexSearchExcludedPath.Path
: Path.GetDirectoryName(SelectedIndexSearchExcludedPath.Path));
if (path is null)
return;
collection.Remove(selectedLink);
var selectedType = SelectedIndexSearchExcludedPath.Type;
collection.Remove(SelectedIndexSearchExcludedPath);
collection.Add(new AccessLink
{
Path = path, Type = selectedLink.Type,
Path = path, Type = selectedType,
});
}
var selectedType = SelectedIndexSearchExcludedPath.Type;
collection.Remove(SelectedIndexSearchExcludedPath);
collection.Add(new AccessLink
{
Path = path,
Type = selectedType,
Name = PathHelper.GetPathName(path)
});
🤖 Prompt for AI Agents
In Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs lines
332 to 357, the new AccessLink instance is missing the required Name property
assignment. Update the code to explicitly set the Name property when creating
the new AccessLink. Additionally, add validation to check if the new path is
different from the existing one and ensure no duplicate paths are added to the
collection to avoid unnecessary operations.

@01Dri 01Dri closed this May 25, 2025
@01Dri 01Dri reopened this May 25, 2025

This comment has been minimized.

This comment has been minimized.

@Jack251970 Jack251970 changed the title [Feature Request] Rename Quick Access Links Enhancement: Rename Quick Access Links May 26, 2025
@Jack251970 Jack251970 added this to the Future milestone May 26, 2025
@Jack251970 Jack251970 linked an issue May 26, 2025 that may be closed by this pull request
@Jack251970
Copy link
Contributor

Thanks for your PR! I will check it after 1.20.0 release.

Copy link

@check-spelling-bot Report

🔴 Please review

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

❌ Errors and Warnings Count
❌ forbidden-pattern 22
⚠️ non-alpha-in-dictionary 13

See ❌ Event descriptions for more information.

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
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Rename Quick Access Links
2 participants