wip
This commit is contained in:
parent
124b4645c4
commit
bded0e12f4
5 changed files with 41 additions and 19 deletions
|
@ -36,12 +36,12 @@ use task::{DebugScenario, TaskContext};
|
||||||
use tree_sitter::{Query, StreamingIterator as _};
|
use tree_sitter::{Query, StreamingIterator as _};
|
||||||
use ui::{ContextMenu, Divider, PopoverMenuHandle, Tooltip, prelude::*};
|
use ui::{ContextMenu, Divider, PopoverMenuHandle, Tooltip, prelude::*};
|
||||||
use util::{ResultExt, maybe};
|
use util::{ResultExt, maybe};
|
||||||
use workspace::SplitDirection;
|
|
||||||
use workspace::item::SaveOptions;
|
use workspace::item::SaveOptions;
|
||||||
use workspace::{
|
use workspace::{
|
||||||
Item, Pane, Workspace,
|
Item, Pane, Workspace,
|
||||||
dock::{DockPosition, Panel, PanelEvent},
|
dock::{DockPosition, Panel, PanelEvent},
|
||||||
};
|
};
|
||||||
|
use workspace::{OpenInDebugJson, SplitDirection};
|
||||||
use zed_actions::ToggleFocus;
|
use zed_actions::ToggleFocus;
|
||||||
|
|
||||||
pub enum DebugPanelEvent {
|
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 {
|
Self {
|
||||||
size: px(300.),
|
size: px(300.),
|
||||||
sessions: vec![],
|
sessions: vec![],
|
||||||
|
|
|
@ -343,12 +343,6 @@ impl NewProcessModal {
|
||||||
return;
|
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 {
|
let Some(debugger) = self.debugger.clone() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -806,7 +800,6 @@ pub(super) struct ConfigureMode {
|
||||||
program: Entity<Editor>,
|
program: Entity<Editor>,
|
||||||
cwd: Entity<Editor>,
|
cwd: Entity<Editor>,
|
||||||
stop_on_entry: ToggleState,
|
stop_on_entry: ToggleState,
|
||||||
save_to_debug_json: ToggleState,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfigureMode {
|
impl ConfigureMode {
|
||||||
|
@ -825,7 +818,6 @@ impl ConfigureMode {
|
||||||
program,
|
program,
|
||||||
cwd,
|
cwd,
|
||||||
stop_on_entry: ToggleState::Unselected,
|
stop_on_entry: ToggleState::Unselected,
|
||||||
save_to_debug_json: ToggleState::Unselected,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1446,11 +1446,20 @@ impl CodeActionsMenu {
|
||||||
)
|
)
|
||||||
.on_click(cx.listener({
|
.on_click(cx.listener({
|
||||||
let scenario = scenario.clone();
|
let scenario = scenario.clone();
|
||||||
move |_, _, _window, cx| {
|
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();
|
cx.stop_propagation();
|
||||||
cx.emit(OpenInDebugJson {
|
|
||||||
scenario: scenario.clone(),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
|
@ -1499,8 +1508,3 @@ impl CodeActionsMenu {
|
||||||
Popover::new().child(list).into_any_element()
|
Popover::new().child(list).into_any_element()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct OpenInDebugJson {
|
|
||||||
pub scenario: DebugScenario,
|
|
||||||
}
|
|
||||||
|
|
|
@ -1385,7 +1385,6 @@ fn clip_ranges<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventEmitter<SearchEvent> for Editor {}
|
impl EventEmitter<SearchEvent> for Editor {}
|
||||||
impl EventEmitter<crate::code_context_menus::OpenInDebugJson> for Editor {}
|
|
||||||
|
|
||||||
impl Editor {
|
impl Editor {
|
||||||
pub fn update_restoration_data(
|
pub fn update_restoration_data(
|
||||||
|
|
|
@ -1092,6 +1092,14 @@ pub struct Workspace {
|
||||||
|
|
||||||
impl EventEmitter<Event> for Workspace {}
|
impl EventEmitter<Event> for Workspace {}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct OpenInDebugJson {
|
||||||
|
pub scenario: DebugScenario,
|
||||||
|
pub id: WorkspaceId,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl EventEmitter<OpenInDebugJson> for Workspace {}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||||
pub struct ViewId {
|
pub struct ViewId {
|
||||||
pub creator: CollaboratorId,
|
pub creator: CollaboratorId,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue