Move keymap editor into it's own crate and create settings ui crate

We also change the structure of the settings ui macro. The trait is
still a requirement on the Settings trait implementation, but it returns
a SettingUIItemVariant now, which the settings ui crate will take
adventage of to generate UI

This allows us to get around circular dependency errors and still get
the type system to ensure all settings fulfill the settings UI crate

Co-authored-by: Ben Kunkle <ben@zed.dev>
This commit is contained in:
Anthony 2025-08-26 12:00:10 -04:00
parent 3c0ec5f612
commit 15f634f8cc
53 changed files with 234 additions and 111 deletions

View file

@ -131,6 +131,7 @@ serde_json.workspace = true
session.workspace = true
settings.workspace = true
settings_ui.workspace = true
keymap_editor.workspace = true
shellexpand.workspace = true
smol.workspace = true
snippet_provider.workspace = true

View file

@ -632,6 +632,7 @@ pub fn main() {
svg_preview::init(cx);
onboarding::init(cx);
settings_ui::init(cx);
keymap_editor::init(cx);
extensions_ui::init(cx);
zeta::init(cx);
inspector_ui::init(app_state.clone(), cx);

View file

@ -1482,7 +1482,7 @@ fn reload_keymaps(cx: &mut App, mut user_key_bindings: Vec<KeyBinding>) {
workspace::NewWindow,
)]);
// todo: nicer api here?
settings_ui::keybindings::KeymapEventChannel::trigger_keymap_changed(cx);
keymap_editor::KeymapEventChannel::trigger_keymap_changed(cx);
}
pub fn load_default_keymap(cx: &mut App) {

View file

@ -1,6 +1,5 @@
use collab_ui::collab_panel;
use gpui::{Menu, MenuItem, OsAction};
use settings_ui::keybindings;
use terminal_view::terminal_panel;
pub fn app_menus() -> Vec<Menu> {
@ -17,7 +16,7 @@ pub fn app_menus() -> Vec<Menu> {
name: "Settings".into(),
items: vec![
MenuItem::action("Open Settings", super::OpenSettings),
MenuItem::action("Open Key Bindings", keybindings::OpenKeymapEditor),
MenuItem::action("Open Key Bindings", keymap_editor::OpenKeymapEditor),
MenuItem::action("Open Default Settings", super::OpenDefaultSettings),
MenuItem::action(
"Open Default Key Bindings",