diff --git a/crates/debugger_ui/src/debugger_panel.rs b/crates/debugger_ui/src/debugger_panel.rs index c90a2878e9..0c74bb47bc 100644 --- a/crates/debugger_ui/src/debugger_panel.rs +++ b/crates/debugger_ui/src/debugger_panel.rs @@ -36,12 +36,12 @@ use task::{DebugScenario, TaskContext}; use tree_sitter::{Query, StreamingIterator as _}; use ui::{ContextMenu, Divider, PopoverMenuHandle, Tooltip, prelude::*}; use util::{ResultExt, maybe}; -use workspace::SplitDirection; use workspace::item::SaveOptions; use workspace::{ Item, Pane, Workspace, dock::{DockPosition, Panel, PanelEvent}, }; +use workspace::{OpenInDebugJson, SplitDirection}; use zed_actions::ToggleFocus; pub enum DebugPanelEvent { @@ -98,6 +98,25 @@ impl DebugPanel { }, ); + if let Some(entity) = workspace.weak_handle().upgrade() { + let edit_scenario_subscription = cx.subscribe_in( + &entity, + window, + move |this, workspace, OpenInDebugJson { scenario, id }, window, cx| { + let task = this.go_to_scenario_definition( + TaskSourceKind::UserInput, + scenario.clone(), + todo!(), + // *id, + window, + cx, + ); + cx.spawn(async move |_, cx| task.await) + .detach_and_log_err(cx); + }, + ); + } + Self { size: px(300.), sessions: vec![], diff --git a/crates/debugger_ui/src/new_process_modal.rs b/crates/debugger_ui/src/new_process_modal.rs index 6d7fa244a2..0aeb91f938 100644 --- a/crates/debugger_ui/src/new_process_modal.rs +++ b/crates/debugger_ui/src/new_process_modal.rs @@ -343,12 +343,6 @@ impl NewProcessModal { return; } - if let NewProcessMode::Launch = &self.mode { - if self.configure_mode.read(cx).save_to_debug_json.selected() { - self.save_debug_scenario(window, cx); - } - } - let Some(debugger) = self.debugger.clone() else { return; }; @@ -806,7 +800,6 @@ pub(super) struct ConfigureMode { program: Entity, cwd: Entity, stop_on_entry: ToggleState, - save_to_debug_json: ToggleState, } impl ConfigureMode { @@ -825,7 +818,6 @@ impl ConfigureMode { program, cwd, stop_on_entry: ToggleState::Unselected, - save_to_debug_json: ToggleState::Unselected, }) } diff --git a/crates/editor/src/code_context_menus.rs b/crates/editor/src/code_context_menus.rs index 8fbae8d605..9ec976563d 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(), @@ -1438,6 +1439,30 @@ impl CodeActionsMenu { .overflow_hidden() .child("debug: ") .child(scenario.label.clone()) + .child( + IconButton::new( + SharedString::new(format!("edit-{ix}")), + IconName::Pencil, + ) + .on_click(cx.listener({ + let scenario = scenario.clone(); + move |editor, _, _window, cx| { + if let Some((workspace, Some(id))) = + editor.workspace.as_ref() + { + workspace + .update(cx, |_, cx| { + cx.emit(workspace::OpenInDebugJson { + scenario: scenario.clone(), + id: *id, + }); + }) + .ok(); + } + cx.stop_propagation(); + } + })), + ) .when(selected, |this| { this.text_color(colors.text_accent) }), diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 014583912f..3076c00d16 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -2836,7 +2836,6 @@ impl EditorElement { ) -> Vec { self.editor.update(cx, |editor, cx| { let active_task_indicator_row = - // TODO: add edit button on the right side of each row in the context menu if let Some(crate::CodeContextMenu::CodeActions(CodeActionsMenu { deployed_from, actions, diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 125b5bb98a..2371f2f7c6 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1092,6 +1092,14 @@ pub struct Workspace { impl EventEmitter for Workspace {} +#[derive(Clone)] +pub struct OpenInDebugJson { + pub scenario: DebugScenario, + pub id: WorkspaceId, +} + +impl EventEmitter for Workspace {} + #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub struct ViewId { pub creator: CollaboratorId,