From b24a30916ae4c0126d0fbe5bdea2f6e28bf02eeb Mon Sep 17 00:00:00 2001 From: Julia Ryan Date: Fri, 11 Jul 2025 09:00:24 -0700 Subject: [PATCH] wip: start adding action --- crates/editor/src/code_context_menus.rs | 28 ++++++++++++++----------- crates/zed_actions/src/lib.rs | 25 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/crates/editor/src/code_context_menus.rs b/crates/editor/src/code_context_menus.rs index e7403edf8af60fb38f373b4999cb86145a125dd5..f7bd7beb942f6b248fbd2b9e29af662ff39588ba 100644 --- a/crates/editor/src/code_context_menus.rs +++ b/crates/editor/src/code_context_menus.rs @@ -1446,18 +1446,22 @@ impl CodeActionsMenu { .on_click(cx.listener( move |editor, _, window, cx| { cx.stop_propagation(); - if let Some(workspace) = editor.workspace() - { - workspace.update(cx, |this, cx| { - // if let Some(panel) = this.panel::(cx) { - // let kind = todo!(); - // let id = todo!(); - // panel.update_in(cx, |panel, window, cx| { - // panel.go_to_scenario_definition(kind, scenario, id, window, cx) - // })? - // } - }) - } + window.dispatch_action( + zed_actions::OpenInDebugJson.boxed_clone(), + cx, + ); + // if let Some(workspace) = editor.workspace() + // { + // workspace.update(cx, |this, cx| { + // // if let Some(panel) = this.panel::(cx) { + // // let kind = todo!(); + // // let id = todo!(); + // // panel.update_in(cx, |panel, window, cx| { + // // panel.go_to_scenario_definition(kind, scenario, id, window, cx) + // // })? + // // } + // }) + // } }, )), ) diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs index 06121a9de8e0b68316c8ffda1d4a393beedb217f..760f00e36a5d091b6640c42bda81ee6cb60ae115 100644 --- a/crates/zed_actions/src/lib.rs +++ b/crates/zed_actions/src/lib.rs @@ -471,3 +471,28 @@ actions!( OpenProjectDebugTasks, ] ); + +/// Reruns the last task. +#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] +#[action(namespace = debugger)] +#[serde(deny_unknown_fields)] +pub struct OpenInDebugJson { + /// Controls whether the task context is reevaluated prior to execution of a task. + /// If it is not, environment variables such as ZED_COLUMN, ZED_FILE are gonna be the same as in the last execution of a task + /// If it is, these variables will be updated to reflect current state of editor at the time task::Rerun is executed. + /// default: false + #[serde(default)] + pub reevaluate_context: bool, + /// Overrides `allow_concurrent_runs` property of the task being reran. + /// Default: null + #[serde(default)] + pub allow_concurrent_runs: Option, + /// Overrides `use_new_terminal` property of the task being reran. + /// Default: null + #[serde(default)] + pub scenario: Scenario, + + /// If present, rerun the task with this ID, otherwise rerun the last task. + #[serde(skip)] + pub task_id: Option, +}