debugger: Do not use Disclosure for attach button (#27068)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
3874d315ec
commit
23686aa394
1 changed files with 23 additions and 19 deletions
|
@ -7,10 +7,10 @@ use settings::Settings as _;
|
||||||
use task::TCPHost;
|
use task::TCPHost;
|
||||||
use theme::ThemeSettings;
|
use theme::ThemeSettings;
|
||||||
use ui::{
|
use ui::{
|
||||||
h_flex, relative, v_flex, ActiveTheme as _, ButtonLike, Clickable, Context, ContextMenu,
|
div, h_flex, relative, v_flex, ActiveTheme as _, ButtonCommon, ButtonLike, Clickable, Context,
|
||||||
Disableable, Disclosure, DropdownMenu, FluentBuilder, InteractiveElement, IntoElement, Label,
|
ContextMenu, Disableable, DropdownMenu, FluentBuilder, Icon, IconName, IconSize,
|
||||||
LabelCommon, LabelSize, ParentElement, PopoverMenu, PopoverMenuHandle, Render, SharedString,
|
InteractiveElement, IntoElement, Label, LabelCommon, LabelSize, ParentElement, PopoverMenu,
|
||||||
SplitButton, Styled, Window,
|
PopoverMenuHandle, Render, SharedString, SplitButton, Styled, Window,
|
||||||
};
|
};
|
||||||
use workspace::Workspace;
|
use workspace::Workspace;
|
||||||
|
|
||||||
|
@ -176,10 +176,19 @@ impl Render for InertState {
|
||||||
this.child(SplitButton {
|
this.child(SplitButton {
|
||||||
left: spawn_button,
|
left: spawn_button,
|
||||||
right: PopoverMenu::new("debugger-select-spawn-mode")
|
right: PopoverMenu::new("debugger-select-spawn-mode")
|
||||||
.trigger(Disclosure::new(
|
.trigger(
|
||||||
"debugger-spawn-button-disclosure",
|
ButtonLike::new_rounded_right(
|
||||||
self.popover_handle.is_deployed(),
|
"debugger-spawn-button-mode",
|
||||||
))
|
)
|
||||||
|
.layer(ui::ElevationIndex::ModalSurface)
|
||||||
|
.size(ui::ButtonSize::None)
|
||||||
|
.child(
|
||||||
|
div().px_1().child(
|
||||||
|
Icon::new(IconName::ChevronDownSmall)
|
||||||
|
.size(IconSize::XSmall),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
.menu(move |window, cx| {
|
.menu(move |window, cx| {
|
||||||
Some(ContextMenu::build(window, cx, {
|
Some(ContextMenu::build(window, cx, {
|
||||||
let entity = entity.clone();
|
let entity = entity.clone();
|
||||||
|
@ -255,7 +264,6 @@ impl InertState {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn attach(&self, window: &mut Window, cx: &mut Context<Self>) {
|
fn attach(&self, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
let process_id = self.program_editor.read(cx).text(cx).parse::<u32>().ok();
|
|
||||||
let cwd = PathBuf::from(self.cwd_editor.read(cx).text(cx));
|
let cwd = PathBuf::from(self.cwd_editor.read(cx).text(cx));
|
||||||
let kind = kind_for_label(self.selected_debugger.as_deref().unwrap_or_else(|| {
|
let kind = kind_for_label(self.selected_debugger.as_deref().unwrap_or_else(|| {
|
||||||
unimplemented!("Automatic selection of a debugger based on users project")
|
unimplemented!("Automatic selection of a debugger based on users project")
|
||||||
|
@ -264,22 +272,18 @@ impl InertState {
|
||||||
let config = DebugAdapterConfig {
|
let config = DebugAdapterConfig {
|
||||||
label: "hard coded attach".into(),
|
label: "hard coded attach".into(),
|
||||||
kind,
|
kind,
|
||||||
request: DebugRequestType::Attach(task::AttachConfig { process_id }),
|
request: DebugRequestType::Attach(task::AttachConfig { process_id: None }),
|
||||||
program: None,
|
program: None,
|
||||||
cwd: Some(cwd),
|
cwd: Some(cwd),
|
||||||
initialize_args: None,
|
initialize_args: None,
|
||||||
supports_attach: true,
|
supports_attach: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if process_id.is_some() {
|
let _ = self.workspace.update(cx, |workspace, cx| {
|
||||||
cx.emit(InertEvent::Spawned { config });
|
let project = workspace.project().clone();
|
||||||
} else {
|
workspace.toggle_modal(window, cx, |window, cx| {
|
||||||
let _ = self.workspace.update(cx, |workspace, cx| {
|
AttachModal::new(project, config, window, cx)
|
||||||
let project = workspace.project().clone();
|
|
||||||
workspace.toggle_modal(window, cx, |window, cx| {
|
|
||||||
AttachModal::new(project, config, window, cx)
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue