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]]
Piotr Osiewicz created
Cargo.lock | 2 +
crates/collab_ui/Cargo.toml | 1
crates/collab_ui/src/collab_titlebar_item.rs | 4 +-
crates/zed-actions/src/lib.rs | 40 ++++++++++++++-------
crates/zed/Cargo.toml | 2
crates/zed/src/main.rs | 2
crates/zed/src/zed.rs | 28 --------------
7 files changed, 35 insertions(+), 44 deletions(-)
@@ -1328,6 +1328,7 @@ dependencies = [
"theme_selector",
"util",
"workspace",
+ "zed-actions",
]
[[package]]
@@ -8907,6 +8908,7 @@ dependencies = [
"vim",
"welcome",
"workspace",
+ "zed-actions",
]
[[package]]
@@ -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 = true
futures.workspace = true
@@ -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(
@@ -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,
+ ]
+);
@@ -67,7 +67,7 @@ util = { path = "../util" }
vim = { path = "../vim" }
workspace = { path = "../workspace" }
welcome = { path = "../welcome" }
-
+zed-actions = {path = "../zed-actions"}
anyhow.workspace = true
async-compression = { version = "0.3", features = ["gzip", "futures-bufread"] }
async-tar = "0.4.2"
@@ -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),
]
}
@@ -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| {