@@ -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::<DebugPanel>(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,
+}
@@ -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<bool>,
- /// 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<String>,
-}