Load all keybindings from JSON file
This commit is contained in:
parent
b4babbeeaa
commit
9a4b8e3d8c
9 changed files with 81 additions and 53 deletions
|
@ -1,4 +1,4 @@
|
|||
use anyhow::Result;
|
||||
use anyhow::{Context, Result};
|
||||
use collections::BTreeMap;
|
||||
use gpui::{keymap::Binding, MutableAppContext};
|
||||
use serde::Deserialize;
|
||||
|
@ -28,7 +28,12 @@ pub fn load_keymap(cx: &mut MutableAppContext, content: &str) -> Result<()> {
|
|||
} else {
|
||||
let name = serde_json::from_str(action)?;
|
||||
cx.deserialize_action(name, None)
|
||||
}?;
|
||||
}
|
||||
.with_context(|| {
|
||||
format!(
|
||||
"invalid binding value for keystroke {keystroke}, context {context:?}"
|
||||
)
|
||||
})?;
|
||||
Binding::load(keystroke, action, context)
|
||||
})
|
||||
.collect::<Result<Vec<_>>>()?,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue