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 `command_palette` (#21006)

Marshall Bowersc16dfc1a39f4
diff --git a/Cargo.lock b/Cargo.lock
index ddf89ba3cd1..f4163812256 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -12607,7 +12607,6 @@ dependencies = [
"call",
"client",
"collections",
- "command_palette",
"editor",
"feature_flags",
"feedback",
diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs
index 21dd06e81c0..11bc6848fe1 100644
--- a/crates/command_palette/src/command_palette.rs
+++ b/crates/command_palette/src/command_palette.rs
@@ -11,7 +11,7 @@ use command_palette_hooks::{
};
use fuzzy::{StringMatch, StringMatchCandidate};
use gpui::{
- actions, Action, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, Global,
+ Action, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, Global,
ParentElement, Render, Styled, Task, UpdateGlobal, View, ViewContext, VisualContext, WeakView,
};
use picker::{Picker, PickerDelegate};
@@ -21,9 +21,7 @@ use settings::Settings;
use ui::{h_flex, prelude::*, v_flex, HighlightedLabel, KeyBinding, ListItem, ListItemSpacing};
use util::ResultExt;
use workspace::{ModalView, Workspace, WorkspaceSettings};
-use zed_actions::OpenZedUrl;
-
-actions!(command_palette, [Toggle]);
+use zed_actions::{command_palette::Toggle, OpenZedUrl};
pub fn init(cx: &mut AppContext) {
client::init_settings(cx);
diff --git a/crates/title_bar/Cargo.toml b/crates/title_bar/Cargo.toml
index 05bd1be5027..809915b4dc0 100644
--- a/crates/title_bar/Cargo.toml
+++ b/crates/title_bar/Cargo.toml
@@ -31,7 +31,6 @@ test-support = [
auto_update.workspace = true
call.workspace = true
client.workspace = true
-command_palette.workspace = true
feedback.workspace = true
feature_flags.workspace = true
gpui.workspace = true
diff --git a/crates/title_bar/src/application_menu.rs b/crates/title_bar/src/application_menu.rs
index c3994f81d78..3d5a774e8fd 100644
--- a/crates/title_bar/src/application_menu.rs
+++ b/crates/title_bar/src/application_menu.rs
@@ -18,7 +18,10 @@ impl Render for ApplicationMenu {
.menu(move |cx| {
ContextMenu::build(cx, move |menu, cx| {
menu.header("Workspace")
- .action("Open Command Palette", Box::new(command_palette::Toggle))
+ .action(
+ "Open Command Palette",
+ Box::new(zed_actions::command_palette::Toggle),
+ )
.when_some(cx.focused(), |menu, focused| menu.context(focused))
.custom_row(move |cx| {
h_flex()
diff --git a/crates/zed/src/zed/app_menus.rs b/crates/zed/src/zed/app_menus.rs
index 824704fca5e..4a2f3516271 100644
--- a/crates/zed/src/zed/app_menus.rs
+++ b/crates/zed/src/zed/app_menus.rs
@@ -146,7 +146,7 @@ pub fn app_menus() -> Vec<Menu> {
MenuItem::action("Back", workspace::GoBack),
MenuItem::action("Forward", workspace::GoForward),
MenuItem::separator(),
- MenuItem::action("Command Palette...", command_palette::Toggle),
+ MenuItem::action("Command Palette...", zed_actions::command_palette::Toggle),
MenuItem::separator(),
MenuItem::action("Go to File...", workspace::ToggleFileFinder::default()),
// MenuItem::action("Go to Symbol in Project", project_symbols::Toggle),
diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs
index 53f5b202a86..b777f03646c 100644
--- a/crates/zed_actions/src/lib.rs
+++ b/crates/zed_actions/src/lib.rs
@@ -44,6 +44,12 @@ actions!(
]
);
+pub mod command_palette {
+ use gpui::actions;
+
+ actions!(command_palette, [Toggle]);
+}
+
#[derive(Clone, Default, Deserialize, PartialEq)]
pub struct InlineAssist {
pub prompt: Option<String>,