Move workspace::toast_layer::RunAction to zed_actions::toast::RunAction (#32222)

Cleaner to have references to this be `toast::RunAction` matching how it
appears in the keymap, instead of `workspace::RunAction`.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-06-06 00:23:09 -06:00 committed by GitHub
parent 96609151c6
commit 5c9b8e8321
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 14 additions and 6 deletions

1
Cargo.lock generated
View file

@ -10206,6 +10206,7 @@ dependencies = [
"util",
"workspace",
"workspace-hack",
"zed_actions",
]
[[package]]

View file

@ -35,6 +35,7 @@ ui.workspace = true
util.workspace = true
workspace.workspace = true
workspace-hack.workspace = true
zed_actions.workspace = true
[dev-dependencies]
client = { workspace = true, features = ["test-support"] }

View file

@ -3,6 +3,7 @@ use std::rc::Rc;
use gpui::{DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, IntoElement};
use ui::{Tooltip, prelude::*};
use workspace::{ToastAction, ToastView};
use zed_actions::toast;
#[derive(Clone, Copy)]
pub struct ToastIcon {
@ -109,7 +110,7 @@ impl Render for StatusToast {
Button::new(action.id.clone(), action.label.clone())
.tooltip(Tooltip::for_action_title(
action.label.clone(),
&workspace::RunAction,
&toast::RunAction,
))
.color(Color::Muted)
.when_some(action.on_click.clone(), |el, handler| {

View file

@ -3,19 +3,18 @@ use std::{
time::{Duration, Instant},
};
use gpui::{AnyView, DismissEvent, Entity, FocusHandle, ManagedView, Subscription, Task, actions};
use gpui::{AnyView, DismissEvent, Entity, FocusHandle, ManagedView, Subscription, Task};
use ui::{animation::DefaultAnimations, prelude::*};
use zed_actions::toast;
use crate::Workspace;
const DEFAULT_TOAST_DURATION: Duration = Duration::from_secs(10);
const MINIMUM_RESUME_DURATION: Duration = Duration::from_millis(800);
actions!(toast, [RunAction]);
pub fn init(cx: &mut App) {
cx.observe_new(|workspace: &mut Workspace, _window, _cx| {
workspace.register_action(|_workspace, _: &RunAction, window, cx| {
workspace.register_action(|_workspace, _: &toast::RunAction, window, cx| {
let workspace = cx.entity();
let window = window.window_handle();
cx.defer(move |cx| {

View file

@ -15,7 +15,7 @@ mod toast_layer;
mod toolbar;
mod workspace_settings;
pub use toast_layer::{RunAction, ToastAction, ToastLayer, ToastView};
pub use toast_layer::{ToastAction, ToastLayer, ToastView};
use anyhow::{Context as _, Result, anyhow};
use call::{ActiveCall, call_settings::CallSettings};

View file

@ -154,6 +154,12 @@ pub mod jj {
actions!(jj, [BookmarkList]);
}
pub mod toast {
use gpui::actions;
actions!(toast, [RunAction]);
}
pub mod command_palette {
use gpui::actions;