Fix nested member access and ImageResource pattern detection#96
Fix nested member access and ImageResource pattern detection#96adamlaw-oe wants to merge 1 commit intoonevcat:masterfrom
Conversation
Fixes incomplete detection of Xcode-generated asset symbols for: 1. Folder-organized assets (nested member access) 2. ImageResource dot notation references 3. Asset names containing dots **Problems Fixed:** 1. **Nested Member Access (Issue onevcat#83 follow-up)** PR onevcat#84 added support for simple patterns like `.icFlag`, but didn't handle nested patterns like `Image(.Icons.Settings.logo)` that Xcode generates for folder-structured asset catalogs. 2. **ImageResource Pattern** `ImageResource.homeIcon` and `ImageResource.Icons.Settings.logo` patterns were not detected at all. 3. **Dots in Asset Names** Asset names like "empty.icon" or "navigation-menu.row.icon" were incorrectly converted to `.empty.icon` instead of `.emptyIcon`. The generatedAssetSymbolKey function didn't treat dots as word boundaries like Xcode does. **Solution:** 1. Added regex pattern for nested member access inside Image() calls 2. Added regex pattern for ImageResource dot notation 3. Track ranges to exclude nested patterns from simple matching 4. Updated suffix matching logic for namespaced symbols 5. Fixed generatedAssetSymbolKey to treat dots as word boundaries 6. Added comprehensive tests for all patterns **Testing:** - New tests cover: deeply nested patterns (4+ levels), ImageResource notation, whitespace handling, dots in filenames, and mixed usage - Verified on real iOS project with folder-organized assets **Impact:** This fix makes FengNiao work correctly with modern Xcode projects that organize assets in folders and use type-safe asset symbols.
|
Thanks for the detailed investigation and tests here. The problem is real: folder-organized asset symbols, nested member access, and asset names containing dots do expose gaps in the current detection logic. I am not going to merge this PR directly because the branch is now behind I will take the confirmed problem forward from current |
|
Closing this PR in favor of a follow-up fix based on current |
|
Thanks again for the investigation here. I carried the fix forward from current That follow-up keeps the newer generated-symbol support already on |
Fixes incomplete detection of Xcode-generated asset symbols for:
Problems Fixed:
Nested Member Access (Issue Add check unuse for Xcode generated asset symbols #83 follow-up) PR Handle generated asset symbols via member access scanning #84 added support for simple patterns like
.icFlag, but didn't handle nested patterns likeImage(.Icons.Settings.logo)that Xcode generates for folder-structured asset catalogs.ImageResource Pattern
ImageResource.homeIconandImageResource.Icons.Settings.logopatterns were not detected at all.Dots in Asset Names Asset names like "empty.icon" or "navigation-menu.row.icon" were incorrectly converted to
.empty.iconinstead of.emptyIcon. The generatedAssetSymbolKey function didn't treat dots as word boundaries like Xcode does.Solution:
Testing:
Impact:
This fix makes FengNiao work correctly with modern Xcode projects that organize assets in folders and use type-safe asset symbols.