Fix some bugs in keymap handling (#3895)

- `base_keymap` setting was not respected, now it is
- without a `~/.config/zed/keymap.json` file, we would fail to load the
*default* keymap

Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
Max Brunsfeld 2024-01-04 13:04:17 -08:00 committed by GitHub
parent 2da314fb79
commit 5e3d4885bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 41 deletions

View file

@ -370,6 +370,7 @@ mod tests {
use gpui::TestAppContext;
use language::Point;
use project::Project;
use settings::KeymapFile;
use workspace::{AppState, Workspace};
#[test]
@ -503,7 +504,20 @@ mod tests {
workspace::init(app_state.clone(), cx);
init(cx);
Project::init_settings(cx);
settings::load_default_keymap(cx);
KeymapFile::parse(
r#"[
{
"bindings": {
"cmd-n": "workspace::NewFile",
"enter": "menu::Confirm",
"cmd-shift-p": "command_palette::Toggle"
}
}
]"#,
)
.unwrap()
.add_to_cx(cx)
.unwrap();
app_state
})
}