Change keymap precedence to favor user (#37557)

Closes #35623 

Previously if a base keymap had a `null` set to an action, leading to a
`NoAction` being assigned to the keymap, if a user wanted to take
advantage of that keymap (in this particular case, `cmd-2`), the keymap
binding check would favor the `NoAction` over the user, since
technically the context depth matched better. Instead, we should always
prefer the user's settings over whatever base or default.

Release Notes:

- Fixed keymap precedence by favoring user settings over base keymap /
configs.
This commit is contained in:
Mitch (a.k.a Voz)
2025-09-11 00:29:31 -06:00
committed by GitHub
parent 9708c8d507
commit f764077020
2 changed files with 72 additions and 2 deletions
+4 -1
View File
@@ -70,11 +70,14 @@ impl VimTestContext {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<VimModeSetting>(cx, |s| s.vim_mode = Some(enabled));
});
let default_key_bindings = settings::KeymapFile::load_asset_allow_partial_failure(
let mut default_key_bindings = settings::KeymapFile::load_asset_allow_partial_failure(
"keymaps/default-macos.json",
cx,
)
.unwrap();
for key_binding in &mut default_key_bindings {
key_binding.set_meta(settings::KeybindSource::Default.meta());
}
cx.bind_keys(default_key_bindings);
if enabled {
let vim_key_bindings = settings::KeymapFile::load_asset(