Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Move zed actions to zed-actions
Piotr Osiewicz092cf93dae70
diff --git a/Cargo.lock b/Cargo.lockindex 13d194440cf..6d953d8dc09 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1328,6 +1328,7 @@ dependencies = ["theme_selector","util","workspace",+ "zed-actions",][[package]]@@ -8907,6 +8908,7 @@ dependencies = ["vim","welcome","workspace",+ "zed-actions",][[package]]diff --git a/crates/collab_ui/Cargo.toml b/crates/collab_ui/Cargo.tomlindex 9865f8a9c8d..ee410ccba7a 100644--- a/crates/collab_ui/Cargo.toml+++ b/crates/collab_ui/Cargo.toml@@ -40,6 +40,7 @@ theme = { path = "../theme" }theme_selector = { path = "../theme_selector" }util = { path = "../util" }workspace = { path = "../workspace" }+zed-actions = {path = "../zed-actions"}anyhow.workspace = truefutures.workspace = truediff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rsindex d9127e707f8..d2a9dda4803 100644--- a/crates/collab_ui/src/collab_titlebar_item.rs+++ b/crates/collab_ui/src/collab_titlebar_item.rs@@ -301,7 +301,7 @@ impl CollabTitlebarItem {self.user_menu.update(cx, |user_menu, cx| {let items = if let Some(_) = self.user_store.read(cx).current_user() {vec![- ContextMenuItem::action("Settings", SignIn),+ ContextMenuItem::action("Settings", zed_actions::OpenSettings),ContextMenuItem::action("Theme", theme_selector::Toggle),ContextMenuItem::separator(),ContextMenuItem::action(@@ -312,7 +312,7 @@ impl CollabTitlebarItem {]} else {vec![- ContextMenuItem::action("Settings", SignIn),+ ContextMenuItem::action("Settings", zed_actions::OpenSettings),ContextMenuItem::action("Theme", theme_selector::Toggle),ContextMenuItem::separator(),ContextMenuItem::action(diff --git a/crates/zed-actions/src/lib.rs b/crates/zed-actions/src/lib.rsindex 7d12d9af819..bcd086924d2 100644--- a/crates/zed-actions/src/lib.rs+++ b/crates/zed-actions/src/lib.rs@@ -1,14 +1,28 @@-pub fn add(left: usize, right: usize) -> usize {- left + right-}+use gpui::actions;-#[cfg(test)]-mod tests {- use super::*;-- #[test]- fn it_works() {- let result = add(2, 2);- assert_eq!(result, 4);- }-}+actions!(+ zed,+ [+ About,+ Hide,+ HideOthers,+ ShowAll,+ Minimize,+ Zoom,+ ToggleFullScreen,+ Quit,+ DebugElements,+ OpenLog,+ OpenLicenses,+ OpenTelemetryLog,+ OpenKeymap,+ OpenSettings,+ OpenLocalSettings,+ OpenDefaultSettings,+ OpenDefaultKeymap,+ IncreaseBufferFontSize,+ DecreaseBufferFontSize,+ ResetBufferFontSize,+ ResetDatabase,+ ]+);diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.tomlindex d8e47d1c3ea..e97005ec7ee 100644--- a/crates/zed/Cargo.toml+++ b/crates/zed/Cargo.toml@@ -67,7 +67,7 @@ util = { path = "../util" }vim = { path = "../vim" }workspace = { path = "../workspace" }welcome = { path = "../welcome" }-+zed-actions = {path = "../zed-actions"}anyhow.workspace = trueasync-compression = { version = "0.3", features = ["gzip", "futures-bufread"] }async-tar = "0.4.2"diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex dcdf5c1ea5f..5d013a68498 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -871,6 +871,6 @@ pub fn background_actions() -> &'static [(&'static str, &'static dyn Action)] {("Go to file", &file_finder::Toggle),("Open command palette", &command_palette::Toggle),("Open recent projects", &recent_projects::OpenRecent),- ("Change your settings", &zed::OpenSettings),+ ("Change your settings", &zed_actions::OpenSettings),]}diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rsindex bcdfe57a469..9f3b1457937 100644--- a/crates/zed/src/zed.rs+++ b/crates/zed/src/zed.rs@@ -50,6 +50,7 @@ use workspace::{notifications::simple_message_notification::MessageNotification, open_new, AppState, NewFile,NewWindow, Workspace, WorkspaceSettings,};+use zed_actions::*;#[derive(Deserialize, Clone, PartialEq)]pub struct OpenBrowser {@@ -58,33 +59,6 @@ pub struct OpenBrowser {impl_actions!(zed, [OpenBrowser]);-actions!(- zed,- [- About,- Hide,- HideOthers,- ShowAll,- Minimize,- Zoom,- ToggleFullScreen,- Quit,- DebugElements,- OpenLog,- OpenLicenses,- OpenTelemetryLog,- OpenKeymap,- OpenSettings,- OpenLocalSettings,- OpenDefaultSettings,- OpenDefaultKeymap,- IncreaseBufferFontSize,- DecreaseBufferFontSize,- ResetBufferFontSize,- ResetDatabase,- ]-);-pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::AppContext) {cx.add_action(about);cx.add_global_action(|_: &Hide, cx: &mut gpui::AppContext| {