Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
title_bar: Remove dependency on `theme_selector` (#21009)
Marshall Bowers6b2f1cc54341
diff --git a/Cargo.lock b/Cargo.lockindex 8888754a338..2bb4c4e0c72 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -12410,6 +12410,7 @@ dependencies = ["ui","util","workspace",+ "zed_actions",][[package]]@@ -12637,7 +12638,6 @@ dependencies = ["smallvec","story","theme",- "theme_selector","tree-sitter-md","ui","util",diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rsindex 01e2b1dd66d..1586f3546e2 100644--- a/crates/extensions_ui/src/extensions_ui.rs+++ b/crates/extensions_ui/src/extensions_ui.rs@@ -257,7 +257,7 @@ impl ExtensionsPage {.update(cx, |workspace, cx| {theme_selector::toggle(workspace,- &theme_selector::Toggle {+ &zed_actions::theme_selector::Toggle {themes_filter: Some(themes),},cx,diff --git a/crates/theme_selector/Cargo.toml b/crates/theme_selector/Cargo.tomlindex ec7e9aa8776..dc0d5f3ac44 100644--- a/crates/theme_selector/Cargo.toml+++ b/crates/theme_selector/Cargo.toml@@ -25,5 +25,6 @@ theme.workspace = trueui.workspace = trueutil.workspace = trueworkspace.workspace = true+zed_actions.workspace = true[dev-dependencies]diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rsindex d0763c2793b..e09ad40bf4e 100644--- a/crates/theme_selector/src/theme_selector.rs+++ b/crates/theme_selector/src/theme_selector.rs@@ -2,25 +2,18 @@ use client::telemetry::Telemetry;use fs::Fs;use fuzzy::{match_strings, StringMatch, StringMatchCandidate};use gpui::{- actions, impl_actions, AppContext, DismissEvent, EventEmitter, FocusableView, Render,- UpdateGlobal, View, ViewContext, VisualContext, WeakView,+ actions, AppContext, DismissEvent, EventEmitter, FocusableView, Render, UpdateGlobal, View,+ ViewContext, VisualContext, WeakView,};use picker::{Picker, PickerDelegate};-use serde::Deserialize;use settings::{update_settings_file, SettingsStore};use std::sync::Arc;use theme::{Appearance, Theme, ThemeMeta, ThemeRegistry, ThemeSettings};use ui::{prelude::*, v_flex, ListItem, ListItemSpacing};use util::ResultExt;use workspace::{ui::HighlightedLabel, ModalView, Workspace};+use zed_actions::theme_selector::Toggle;-#[derive(PartialEq, Clone, Default, Debug, Deserialize)]-pub struct Toggle {- /// A list of theme names to filter the theme selector down to.- pub themes_filter: Option<Vec<String>>,-}--impl_actions!(theme_selector, [Toggle]);actions!(theme_selector, [Reload]);pub fn init(cx: &mut AppContext) {diff --git a/crates/title_bar/Cargo.toml b/crates/title_bar/Cargo.tomlindex 809915b4dc0..75cb49b5a87 100644--- a/crates/title_bar/Cargo.toml+++ b/crates/title_bar/Cargo.toml@@ -42,7 +42,6 @@ serde.workspace = truesmallvec.workspace = truestory = { workspace = true, optional = true }theme.workspace = true-theme_selector.workspace = trueui.workspace = trueutil.workspace = truevcs_menu.workspace = truediff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rsindex bcf13a5ac78..744f4ce26dc 100644--- a/crates/title_bar/src/title_bar.rs+++ b/crates/title_bar/src/title_bar.rs@@ -579,7 +579,10 @@ impl TitleBar {}).action("Settings", zed_actions::OpenSettings.boxed_clone()).action("Key Bindings", Box::new(zed_actions::OpenKeymap))- .action("Themes…", theme_selector::Toggle::default().boxed_clone())+ .action(+ "Themes…",+ zed_actions::theme_selector::Toggle::default().boxed_clone(),+ ).action("Extensions", zed_actions::Extensions.boxed_clone()).separator().link(@@ -615,7 +618,10 @@ impl TitleBar {ContextMenu::build(cx, |menu, _| {menu.action("Settings", zed_actions::OpenSettings.boxed_clone()).action("Key Bindings", Box::new(zed_actions::OpenKeymap))- .action("Themes…", theme_selector::Toggle::default().boxed_clone())+ .action(+ "Themes…",+ zed_actions::theme_selector::Toggle::default().boxed_clone(),+ ).action("Extensions", zed_actions::Extensions.boxed_clone()).separator().link(diff --git a/crates/zed/src/zed/app_menus.rs b/crates/zed/src/zed/app_menus.rsindex 4a2f3516271..3affa319869 100644--- a/crates/zed/src/zed/app_menus.rs+++ b/crates/zed/src/zed/app_menus.rs@@ -23,7 +23,10 @@ pub fn app_menus() -> Vec<Menu> {zed_actions::OpenDefaultKeymap,),MenuItem::action("Open Project Settings", super::OpenProjectSettings),- MenuItem::action("Select Theme...", theme_selector::Toggle::default()),+ MenuItem::action(+ "Select Theme...",+ zed_actions::theme_selector::Toggle::default(),+ ),],}),MenuItem::separator(),diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rsindex b777f03646c..0e62e88fea5 100644--- a/crates/zed_actions/src/lib.rs+++ b/crates/zed_actions/src/lib.rs@@ -50,6 +50,19 @@ pub mod command_palette {actions!(command_palette, [Toggle]);}+pub mod theme_selector {+ use gpui::impl_actions;+ use serde::Deserialize;++ #[derive(PartialEq, Clone, Default, Debug, Deserialize)]+ pub struct Toggle {+ /// A list of theme names to filter the theme selector down to.+ pub themes_filter: Option<Vec<String>>,+ }++ impl_actions!(theme_selector, [Toggle]);+}+#[derive(Clone, Default, Deserialize, PartialEq)]pub struct InlineAssist {pub prompt: Option<String>,