diff --git a/crates/editor/src/code_context_menus.rs b/crates/editor/src/code_context_menus.rs index f7bd7beb942f6b248fbd2b9e29af662ff39588ba..7c5cfaf4525deedba0442fda743cde610a7b5305 100644 --- a/crates/editor/src/code_context_menus.rs +++ b/crates/editor/src/code_context_menus.rs @@ -1392,6 +1392,7 @@ impl CodeActionsMenu { ) -> AnyElement { let actions = self.actions.clone(); let selected_item = self.selected_item; + let list = uniform_list( "code_actions_menu", self.actions.len(), @@ -1443,27 +1444,15 @@ impl CodeActionsMenu { SharedString::new(format!("edit-{ix}")), IconName::Pencil, ) - .on_click(cx.listener( - move |editor, _, window, cx| { + .on_click(cx.listener({ + let scenario = scenario.clone(); + move |_, _, _window, cx| { cx.stop_propagation(); - 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) - // // })? - // // } - // }) - // } - }, - )), + cx.emit(OpenInDebugJson { + scenario: scenario.clone(), + }); + } + })), ) .when(selected, |this| { this.text_color(colors.text_accent) @@ -1510,3 +1499,8 @@ impl CodeActionsMenu { Popover::new().child(list).into_any_element() } } + +#[derive(Clone)] +pub struct OpenInDebugJson { + pub scenario: DebugScenario, +} diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index 2e4631a62b16db51476c5ce5918bdc973806381e..4d6b78740fa408d7b0971ba4f8a9d3782b5f722e 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -1385,6 +1385,7 @@ fn clip_ranges<'a>( } impl EventEmitter for Editor {} +impl EventEmitter for Editor {} impl Editor { pub fn update_restoration_data( diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs index 760f00e36a5d091b6640c42bda81ee6cb60ae115..06121a9de8e0b68316c8ffda1d4a393beedb217f 100644 --- a/crates/zed_actions/src/lib.rs +++ b/crates/zed_actions/src/lib.rs @@ -471,28 +471,3 @@ 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, -}