command_palette: Fix keymap editor not matching actions with underscored namespaces#50415
Merged
probably-neb merged 1 commit intozed-industries:mainfrom Mar 31, 2026
Conversation
…red namespaces normalize_action_query preserved underscores, but search candidates use humanize_action_name which converts underscores to spaces. Fuzzy matching failed because '_' never appears in humanized candidates. Actions like terminal_panel::Toggle, project_panel::ToggleFocus, etc. would show "No matches found" when clicking "Change Keybinding" from the command palette.
Contributor
Collaborator
|
This looks great, thanks! |
Collaborator
|
@zed-zippy approved |
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.
Closes #50223
Summary
When clicking Change Keybinding from the command palette on an action whose namespace contains underscores (e.g.
terminal_panel::Toggle,project_panel::ToggleFocus), the keymap editor showed "No matches found for the provided query". Actions without underscores (e.g.zed::OpenLog) worked fine.I opened this issue for this #50223, but took the liberty of sending a PR.
Root cause:
normalize_action_querypreserved underscores in the query, but the search candidates are built withhumanize_action_namewhich converts underscores to spaces. The fuzzy matcher looked for_in a candidate like"terminal panel: toggle"where it doesn't exist, so matching always failed.Fix:
normalize_action_querynow converts underscores to spaces before the deduplication checks, consistent withhumanize_action_name. This also correctly collapses consecutive underscores with adjacent spaces.All three call sites of
normalize_action_query(command palette search, keymap editor filter, action completion provider) match against humanized candidates, so the fix improves consistency across all of them.Before (Left) / After (Right)
Release Notes:
terminal_panel::Toggle,project_panel::ToggleFocus)