-
Notifications
You must be signed in to change notification settings - Fork 6
Add custom ignore rules #6
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
base: poe1
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a customizable ignore rules system that allows users to define their own rules for hiding entities from the minimap through a persistent configuration file and UI controls.
Key Changes:
- Adds a new ignore rules system supporting metadata and entity name matching with multiple match types (exact, starts with, contains)
- Implements UI controls in plugin settings for managing custom ignore rules
- Integrates the custom rules into the icon rendering pipeline to filter entities
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| config/custom_ignore_rules.txt | Template configuration file with documentation for custom ignore rule syntax |
| MinimapIcons.cs | Integrated custom ignore rules manager and wired up UI event handlers for rule management |
| MapIconsSettings.cs | Added CustomIgnoreSettings section to plugin settings menu |
| IgnoreRules/IgnoreRulesManager.cs | Core manager for loading, saving, parsing, and applying custom ignore rules with caching |
| IgnoreRules/IgnoreRule.cs | Rule representation with matching logic for different rule types |
| IgnoreRules/CustomIgnoreSettings.cs | UI settings definition for custom ignore rules controls |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -0,0 +1,25 @@ | |||
| # Custom Ignore Rules for MinimapIcons | |||
| # | |||
| # Rule formats: | |||
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'formats' to 'format' to match line 63.
| # Rule formats: | |
| # Rule format: |
|
|
||
| public override bool Initialise() | ||
| { | ||
| _ignoreRulesManager = new IgnoreRulesManager(DirectoryFullName); |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding null check or error handling for IgnoreRulesManager initialization. If initialization fails (e.g., directory creation issues), the plugin will crash on first use of _ignoreRulesManager.
| var configPath = System.IO.Path.Combine(DirectoryFullName, "config"); | ||
| Process.Start("explorer.exe", configPath); |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opening the config folder assumes Windows (explorer.exe). This will fail on other operating systems. Consider using a cross-platform approach or checking the OS before launching explorer.exe.
| if (!Settings.DrawMonsters && icon.Entity.Type == EntityType.Monster) | ||
| continue; | ||
|
|
||
|
|
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Remove extra blank line before comment for consistency with the codebase style.
| continue; | ||
| } | ||
|
|
||
| // hardcoded ignore list |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Capitalize comment to 'Hardcoded ignore list' for consistency with comment style on line 306.
| // hardcoded ignore list | |
| // Hardcoded ignore list |
| if (IgnoreCache.GetOrAdd(icon.Entity.Path, () => Ignored.Any(x => icon.Entity.Path.StartsWith(x)))) | ||
| continue; | ||
|
|
||
|
|
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Remove extra blank line for consistency with the codebase style.
| catch | ||
| { | ||
| // Silent fail - error will be handled by caller |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catching all exceptions without logging prevents debugging of file parsing issues. Consider logging the exception details or at minimum the exception type to help users diagnose configuration file problems.
| catch | |
| { | |
| // Silent fail - error will be handled by caller | |
| catch (Exception ex) | |
| { | |
| Console.Error.WriteLine($"[IgnoreRulesManager] Failed to load custom rules from '{_customRulesFilePath}': {ex.GetType().Name}: {ex.Message}"); |
| var lines = new List<string> | ||
| { | ||
| "# Custom Ignore Rules for MinimapIcons", | ||
| "# Format examples:", |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistency between documentation here ('Format examples:') and the template file ('Rule formats:'). They should use the same wording for consistency.
| "# Format examples:", | |
| "# Rule formats:", |
| catch | ||
| { | ||
| // Silent fail - error will be handled by caller | ||
| } |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catching all exceptions without logging prevents debugging of file save issues. Consider logging the exception details to help users diagnose permission or disk space problems.
This pull request introduces a customizable ignore rules system for minimap icons, allowing users to define their own rules for hiding entities based on metadata or name patterns. The system includes a new UI section in the plugin settings, supports rule persistence in a config file, and integrates with the icon rendering logic to filter out entities according to user-defined rules.
Custom Ignore Rules System:
CustomIgnoreSettingssection to the plugin settings UI, allowing users to enable custom ignore rules, add new rules, reload rules from file, and open the config folder. (MapIconsSettings.cs,IgnoreRules/CustomIgnoreSettings.cs) [1] [2]IgnoreRuleandIgnoreRuleTypeclasses to represent individual ignore rules, supporting various match types (exact, starts with, contains) for both metadata and entity names. (IgnoreRules/IgnoreRule.cs)IgnoreRulesManagerto manage loading, saving, parsing, and applying custom ignore rules from a persistent config file (custom_ignore_rules.txt). (IgnoreRules/IgnoreRulesManager.cs,config/custom_ignore_rules.txt) [1] [2]Integration with Plugin Logic:
MinimapIcons.cs) [1] [2]MinimapIcons.cs)These changes make it much easier for users to control which entities appear on their minimap by adding, disabling, or removing custom ignore rules through the plugin's settings interface.