-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Fix Command Palette not handling diacritics in apps search #44098
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: main
Are you sure you want to change the base?
Fix Command Palette not handling diacritics in apps search #44098
Conversation
Add Unicode normalization to FuzzyStringMatcher.FoldCase() to properly handle diacritical marks (accents, tildes, umlauts, etc.) in search queries. This allows searching 'camera' to match 'Câmera' and similar accented variations. The fix uses FormKD normalization to decompose characters into base characters and combining marks, then removes the combining marks (NonSpacingMark category). This brings Command Palette search behavior in line with PowerToys Run and Settings search, which already handle diacritics correctly. Closes microsoft#44066
Note to MaintainersI apologize for the confusion - the original PR #44070 was accidentally closed when the source branch was deleted during a branch cleanup operation on my fork. This PR contains the exact same changes as #44070, rebased onto the latest Sorry for any inconvenience this may have caused. Thank you for your patience! 🙏 |
| [TestMethod] | ||
| public void QueryMatchesAppsWithDiacritics() | ||
| { | ||
| // Arrange - simulating Brazilian Portuguese "Câmera" app |
Check warning
Code scanning / check-spelling
Candidate Pattern Warning
|
|
||
| /// <summary> | ||
| /// Normalizes a string for fuzzy matching by converting to uppercase and removing diacritical marks. | ||
| /// This allows matching "camera" with "Câmera", "camêra", etc. |
Check warning
Code scanning / check-spelling
Candidate Pattern Warning
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 Command Palette's fuzzy string matching to handle diacritics (accented characters) properly, enabling searches like "camera" to match app names like "Câmera". The implementation follows the same normalization pattern already used in PowerToys Settings search.
Key changes:
- Enhanced
FuzzyStringMatcher.FoldCase()to normalize diacritics using Unicode decomposition (FormKD) and filtering of NonSpacingMark characters - Added comprehensive unit tests covering multiple languages (Portuguese, French, Spanish, German)
- Updated spell-check dictionary to include "mera" from test case references
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/FuzzyStringMatcher.cs |
Updated FoldCase() method to normalize diacritics by decomposing Unicode characters and removing combining marks |
src/modules/cmdpal/Tests/Microsoft.CmdPal.Ext.Apps.UnitTests/QueryTests.cs |
Added two test methods: FuzzyMatcherHandlesDiacritics with 11 data-driven test cases and QueryMatchesAppsWithDiacritics for integration testing |
.github/actions/spell-check/expect.txt |
Added "mera" to recognized terms for "Câmera" references in test code |
Hi @htcfreek, sorry to bother you. Do you know anything about this? |
Summary of the Pull Request
Fixes Command Palette not correctly handling diacritics (accented characters) in the apps/programs extension search.
Note: This is a re-open of #44070 which was accidentally closed when the branch was deleted.
PR Checklist
Problem
When searching for apps in Command Palette, queries without diacritics would not match app names containing diacritical marks:
This was inconsistent with PowerToys Run and Settings search, which both handle diacritics correctly.
Solution
Updated
FuzzyStringMatcher.FoldCase()to normalize diacritics using Unicode decomposition:Now both query and target are normalized, allowing diacritic-insensitive matching.