Open
Conversation
Owner
|
Hi! I won't be using this particular solution in the plugin, since I don't use AI-generated code in my projects for maintenance reasons. I'll leave this PR open in the meantime though, since other people might find it useful. ✨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #98
Note
This is vibecoded to make it work. Is it efficient? Does it make architectural sense? Not sure. However, it can serve as a starting point for anyone interested, as it's at least an MVP/POC, since it works for my need of adding an icon to a Folder Note.
Tip
If you want to use this now, feel free to go to my fork at https://github.com/piotrnajda3000/iconic/tree/folder-notes-integration, build the project, and copy main.js, manifest and styles.css into
.obsidian/plugins/iconic.Example
Rulebook:
With setting on for a Folder Note:
With setting off:
Changes Made (AI Generated)
IconicPlugin.ts - Added a new setting integrateFolderNotes (boolean, default false) to the IconicSettings interface and DEFAULT_SETTINGS.
Strings.ts - Added UI strings for the new setting:
• integrateFolderNotes.name: "Folder Notes integration"
• integrateFolderNotes.desc: "Apply file rules to folders when the matched file is that folder's Folder Note."
IconicSettingTab.ts - Added a toggle control in the "Sidebars & tabs" section to enable/disable the Folder Notes integration.
FileIconManager.ts - Implemented the core integration logic:
• Added a folderNoteCache Map to cache folder → folder-note path mappings
• Added clearFolderNoteCache() method to reset the cache
• Added getFolderNotePath() helper method that:
• Checks for detached folder notes first using Folder Notes plugin's excludeFolders settings
• Computes attached folder note paths based on Folder Notes' folderNoteName, storageLocation, and folderNoteType settings
• Falls back to supportedFileTypes if primary type not found
• Modified refreshIcons() to clear the cache on each refresh
• Modified refreshChildIcons() to:
• For folders: check for a folder-note file ruling if no folder rule exists and integration is enabled
• Apply the color-only folder-note rules by showing a colored default folder icon
• Proper precedence: Folder rule > Folder-note rule > Manual folder icon