gpui: Add keybind metadata API (#33316)
Closes #ISSUE Adds a very simple API to track metadata about keybindings in GPUI, namely the source of the binding. The motivation for this is displaying the source of keybindings in the [keymap UI](https://github.com/zed-industries/zed/pull/32436). The API is designed to be as simple and flexible as possible, storing only a `Option<u32>` on the bindings themselves to keep the struct small. It is intended to be used as an index or key into a table/map created and managed by the consumer of the API to map from indices to arbitrary meta-data. I.e. the consumer is responsible for both generating these indices and giving them meaning. The current usage in Zed is stateless, just a mapping between constants and User, Default, Base, and Vim keymap sources, however, this can be extended in the future to also track _which_ base keymap is being used. Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
parent
13f134448d
commit
deb2564b31
6 changed files with 119 additions and 13 deletions
|
@ -146,7 +146,7 @@ fn load_embedded_fonts(cx: &App) -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
fn load_storybook_keymap(cx: &mut App) {
|
||||
cx.bind_keys(KeymapFile::load_asset("keymaps/storybook.json", cx).unwrap());
|
||||
cx.bind_keys(KeymapFile::load_asset("keymaps/storybook.json", None, cx).unwrap());
|
||||
}
|
||||
|
||||
pub fn init(cx: &mut App) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue