-
Notifications
You must be signed in to change notification settings - Fork 615
Fix tilemap icon for unicode-named assets in text editors #10999
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
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 fixes an issue where Unicode characters in tilemap asset names prevented the tilemap icon from appearing in text editors. The fix updates regex patterns across multiple Monaco field editors (tilemap, sprite, music, animation) to support Unicode asset names by replacing restrictive ASCII-only character classes with more permissive patterns.
Key Changes
- Updated regex matchers from ASCII-only patterns (
[a-zA-Z0-9_]) to Unicode-supporting patterns ([^delimiter]*) - Applied changes consistently across sprite, music, and animation field editors
- Updated tilemap field editor with similar intent but with a pattern issue (see comments)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pxteditor/monaco-fields/field_tilemap.ts | Updated regex matcher to support Unicode in tilemap names, but uses combined pattern that may cause issues |
| pxteditor/monaco-fields/field_sprite.ts | Correctly updated assets.image patterns for both TypeScript and Python to support Unicode |
| pxteditor/monaco-fields/field_musiceditor.ts | Correctly updated assets.song patterns for both TypeScript and Python to support Unicode |
| pxteditor/monaco-fields/field_animation.ts | Correctly updated assets.animation patterns for both TypeScript and Python to support Unicode |
| // match both JS and python | ||
| searchString: "(?:tilemap(?:8|16|32)?\\s*(?:`|\\(\"\"\")(?:[ a-zA-Z0-9_]|\\n)*\\s*(?:`|\"\"\"\\)))|(?:tiles\\s*\\.\\s*createTilemap\\s*\\([^\\)]+\\))", | ||
| // match both JS and python, allowing Unicode characters in tilemap names | ||
| searchString: "(?:tilemap(?:8|16|32)?\\s*(?:`|\\(\"\"\")(?:[^`\"]|\\n)*\\s*(?:`|\"\"\"\\)))|(?:tiles\\s*\\.\\s*createTilemap\\s*\\([^\\)]+\\))", |
Copilot
AI
Dec 9, 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.
The regex pattern [^"]` excludes both backticks and double-quotes, which creates issues for matching tilemap names:
- In backtick syntax (
tilemap`name`), names containing"won't match - In triple-quote syntax (
tilemap("""name""")), names containing`won't match
The pattern should be split into separate alternatives that each exclude only their respective delimiter:
searchString: "(?:tilemap(?:8|16|32)?\\s*`[^`]*`)|(?:tilemap(?:8|16|32)?\\s*\\(\\\"\\\"\\\"[^\"]*\\\"\\\"\\\"\\))|(?:tiles\\s*\\.\\s*createTilemap\\s*\\([^\\)]+\\))",This matches the approach used in the parsing regex at line 42.
| searchString: "(?:tilemap(?:8|16|32)?\\s*(?:`|\\(\"\"\")(?:[^`\"]|\\n)*\\s*(?:`|\"\"\"\\)))|(?:tiles\\s*\\.\\s*createTilemap\\s*\\([^\\)]+\\))", | |
| searchString: "(?:tilemap(?:8|16|32)?\\s*`[^`]*`)|(?:tilemap(?:8|16|32)?\\s*\\(\"\"\"[^\"]*\"\"\"\\))|(?:tiles\\s*\\.\\s*createTilemap\\s*\\([^\\)]+\\))", |
…erk/asset-editor-icon-fix
Fixes microsoft/pxt-arcade#3690
Code generated by copilot.
Limiting asset names to only ASCII characters makes searches for assets with non-Latin-based languages fail, thus not populating the icon that allows users to edit those assets. This is particularly relevant to tilemaps because once the tilemap is edited, we give it a localized default name, and that name is used to reference the asset itself. This doesn't happen by default to our other field editors because we have objects that we use for the asset itself that don't necessarily rely on the localized asset name (the image or the song, for example).
Upload target: https://arcade.makecode.com/app/2aadb1f4086b9d0e98310aedae8176c11f6d1535-09e8053e58#