title_bar: Remove dependency on command_palette (#21006)

This PR removes the `title_bar` crate's dependency on the
`command_palette`.

The `command_palette::Toggle` action now resides at
`zed_actions::command_palette::Toggle`.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-11-21 13:37:34 -05:00 committed by GitHub
parent 268ac4c047
commit c16dfc1a39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 8 deletions

1
Cargo.lock generated
View file

@ -12607,7 +12607,6 @@ dependencies = [
"call", "call",
"client", "client",
"collections", "collections",
"command_palette",
"editor", "editor",
"feature_flags", "feature_flags",
"feedback", "feedback",

View file

@ -11,7 +11,7 @@ use command_palette_hooks::{
}; };
use fuzzy::{StringMatch, StringMatchCandidate}; use fuzzy::{StringMatch, StringMatchCandidate};
use gpui::{ 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, ParentElement, Render, Styled, Task, UpdateGlobal, View, ViewContext, VisualContext, WeakView,
}; };
use picker::{Picker, PickerDelegate}; use picker::{Picker, PickerDelegate};
@ -21,9 +21,7 @@ use settings::Settings;
use ui::{h_flex, prelude::*, v_flex, HighlightedLabel, KeyBinding, ListItem, ListItemSpacing}; use ui::{h_flex, prelude::*, v_flex, HighlightedLabel, KeyBinding, ListItem, ListItemSpacing};
use util::ResultExt; use util::ResultExt;
use workspace::{ModalView, Workspace, WorkspaceSettings}; use workspace::{ModalView, Workspace, WorkspaceSettings};
use zed_actions::OpenZedUrl; use zed_actions::{command_palette::Toggle, OpenZedUrl};
actions!(command_palette, [Toggle]);
pub fn init(cx: &mut AppContext) { pub fn init(cx: &mut AppContext) {
client::init_settings(cx); client::init_settings(cx);

View file

@ -31,7 +31,6 @@ test-support = [
auto_update.workspace = true auto_update.workspace = true
call.workspace = true call.workspace = true
client.workspace = true client.workspace = true
command_palette.workspace = true
feedback.workspace = true feedback.workspace = true
feature_flags.workspace = true feature_flags.workspace = true
gpui.workspace = true gpui.workspace = true

View file

@ -18,7 +18,10 @@ impl Render for ApplicationMenu {
.menu(move |cx| { .menu(move |cx| {
ContextMenu::build(cx, move |menu, cx| { ContextMenu::build(cx, move |menu, cx| {
menu.header("Workspace") 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)) .when_some(cx.focused(), |menu, focused| menu.context(focused))
.custom_row(move |cx| { .custom_row(move |cx| {
h_flex() h_flex()

View file

@ -146,7 +146,7 @@ pub fn app_menus() -> Vec<Menu> {
MenuItem::action("Back", workspace::GoBack), MenuItem::action("Back", workspace::GoBack),
MenuItem::action("Forward", workspace::GoForward), MenuItem::action("Forward", workspace::GoForward),
MenuItem::separator(), MenuItem::separator(),
MenuItem::action("Command Palette...", command_palette::Toggle), MenuItem::action("Command Palette...", zed_actions::command_palette::Toggle),
MenuItem::separator(), MenuItem::separator(),
MenuItem::action("Go to File...", workspace::ToggleFileFinder::default()), MenuItem::action("Go to File...", workspace::ToggleFileFinder::default()),
// MenuItem::action("Go to Symbol in Project", project_symbols::Toggle), // MenuItem::action("Go to Symbol in Project", project_symbols::Toggle),

View file

@ -44,6 +44,12 @@ actions!(
] ]
); );
pub mod command_palette {
use gpui::actions;
actions!(command_palette, [Toggle]);
}
#[derive(Clone, Default, Deserialize, PartialEq)] #[derive(Clone, Default, Deserialize, PartialEq)]
pub struct InlineAssist { pub struct InlineAssist {
pub prompt: Option<String>, pub prompt: Option<String>,