Skip to content

armgit / zed

Public Imported from GitHub
0

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 `vcs_menu` (#21011)

Marshall Bowers4c7b48b35d7e
diff --git a/Cargo.lock b/Cargo.lock
index 2bb4c4e0c72..f4b1662a01b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -12641,7 +12641,6 @@ dependencies = [
"tree-sitter-md",
"ui",
"util",
- "vcs_menu",
"windows 0.58.0",
"workspace",
"zed_actions",
@@ -13653,6 +13652,7 @@ dependencies = [
"ui",
"util",
"workspace",
+ "zed_actions",
]
[[package]]
diff --git a/crates/title_bar/Cargo.toml b/crates/title_bar/Cargo.toml
index 75cb49b5a87..8433ecad216 100644
--- a/crates/title_bar/Cargo.toml
+++ b/crates/title_bar/Cargo.toml
@@ -44,7 +44,6 @@ story = { workspace = true, optional = true }
theme.workspace = true
ui.workspace = true
util.workspace = true
-vcs_menu.workspace = true
workspace.workspace = true
zed_actions.workspace = true
diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs
index 744f4ce26dc..4e9a99433ae 100644
--- a/crates/title_bar/src/title_bar.rs
+++ b/crates/title_bar/src/title_bar.rs
@@ -27,7 +27,6 @@ use ui::{
IconSize, IconWithIndicator, Indicator, PopoverMenu, Tooltip,
};
use util::ResultExt;
-use vcs_menu::{BranchList, OpenRecent as ToggleVcsMenu};
use workspace::{notifications::NotifyResultExt, Workspace};
use zed_actions::{OpenBrowser, OpenRecent, OpenRemote};
@@ -442,14 +441,14 @@ impl TitleBar {
.tooltip(move |cx| {
Tooltip::with_meta(
"Recent Branches",
- Some(&ToggleVcsMenu),
+ Some(&zed_actions::branches::OpenRecent),
"Local branches only",
cx,
)
})
.on_click(move |_, cx| {
- let _ = workspace.update(cx, |this, cx| {
- BranchList::open(this, &Default::default(), cx);
+ let _ = workspace.update(cx, |_this, cx| {
+ cx.dispatch_action(zed_actions::branches::OpenRecent.boxed_clone());
});
}),
)
diff --git a/crates/vcs_menu/Cargo.toml b/crates/vcs_menu/Cargo.toml
index 11de3718689..47bf3d89845 100644
--- a/crates/vcs_menu/Cargo.toml
+++ b/crates/vcs_menu/Cargo.toml
@@ -18,3 +18,4 @@ project.workspace = true
ui.workspace = true
util.workspace = true
workspace.workspace = true
+zed_actions.workspace = true
diff --git a/crates/vcs_menu/src/lib.rs b/crates/vcs_menu/src/lib.rs
index f165c91bfe9..f61bad57fae 100644
--- a/crates/vcs_menu/src/lib.rs
+++ b/crates/vcs_menu/src/lib.rs
@@ -2,10 +2,9 @@ use anyhow::{anyhow, Context, Result};
use fuzzy::{StringMatch, StringMatchCandidate};
use git::repository::Branch;
use gpui::{
- actions, rems, AnyElement, AppContext, AsyncAppContext, DismissEvent, EventEmitter,
- FocusHandle, FocusableView, InteractiveElement, IntoElement, ParentElement, Render,
- SharedString, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView,
- WindowContext,
+ rems, AnyElement, AppContext, AsyncAppContext, DismissEvent, EventEmitter, FocusHandle,
+ FocusableView, InteractiveElement, IntoElement, ParentElement, Render, SharedString, Styled,
+ Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowContext,
};
use picker::{Picker, PickerDelegate};
use project::ProjectPath;
@@ -14,8 +13,7 @@ use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing};
use util::ResultExt;
use workspace::notifications::DetachAndPromptErr;
use workspace::{ModalView, Workspace};
-
-actions!(branches, [OpenRecent]);
+use zed_actions::branches::OpenRecent;
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(|workspace: &mut Workspace, _| {
diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs
index 0e62e88fea5..848412c2a3b 100644
--- a/crates/zed_actions/src/lib.rs
+++ b/crates/zed_actions/src/lib.rs
@@ -44,6 +44,12 @@ actions!(
]
);
+pub mod branches {
+ use gpui::actions;
+
+ actions!(branches, [OpenRecent]);
+}
+
pub mod command_palette {
use gpui::actions;