debugger: Always show process list in attach (#28685)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
d4a985a6e3
commit
98d001bad5
10 changed files with 78 additions and 112 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4001,7 +4001,6 @@ dependencies = [
|
||||||
"node_runtime",
|
"node_runtime",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"paths",
|
"paths",
|
||||||
"regex",
|
|
||||||
"schemars",
|
"schemars",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -4033,7 +4032,6 @@ dependencies = [
|
||||||
"gpui",
|
"gpui",
|
||||||
"language",
|
"language",
|
||||||
"paths",
|
"paths",
|
||||||
"regex",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"task",
|
"task",
|
||||||
|
|
|
@ -39,7 +39,6 @@ log.workspace = true
|
||||||
node_runtime.workspace = true
|
node_runtime.workspace = true
|
||||||
parking_lot.workspace = true
|
parking_lot.workspace = true
|
||||||
paths.workspace = true
|
paths.workspace = true
|
||||||
regex.workspace = true
|
|
||||||
schemars.workspace = true
|
schemars.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|
|
@ -20,7 +20,7 @@ use std::{
|
||||||
net::Ipv4Addr,
|
net::Ipv4Addr,
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::{Arc, LazyLock},
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use task::{DebugAdapterConfig, DebugTaskDefinition};
|
use task::{DebugAdapterConfig, DebugTaskDefinition};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
@ -291,14 +291,7 @@ pub trait DebugAdapter: 'static + Send + Sync {
|
||||||
|
|
||||||
/// Should return base configuration to make the debug adapter work
|
/// Should return base configuration to make the debug adapter work
|
||||||
fn request_args(&self, config: &DebugTaskDefinition) -> Value;
|
fn request_args(&self, config: &DebugTaskDefinition) -> Value;
|
||||||
|
|
||||||
fn attach_processes_filter(&self) -> regex::Regex {
|
|
||||||
EMPTY_REGEX.clone()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EMPTY_REGEX: LazyLock<regex::Regex> =
|
|
||||||
LazyLock::new(|| regex::Regex::new("").expect("Regex compilation to succeed"));
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub struct FakeAdapter {}
|
pub struct FakeAdapter {}
|
||||||
|
|
||||||
|
@ -375,10 +368,4 @@ impl DebugAdapter for FakeAdapter {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn attach_processes_filter(&self) -> regex::Regex {
|
|
||||||
static REGEX: LazyLock<regex::Regex> =
|
|
||||||
LazyLock::new(|| regex::Regex::new("^fake-binary").unwrap());
|
|
||||||
REGEX.clone()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ struct DapRegistryState {
|
||||||
adapters: BTreeMap<DebugAdapterName, Arc<dyn DebugAdapter>>,
|
adapters: BTreeMap<DebugAdapterName, Arc<dyn DebugAdapter>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Clone, Default)]
|
||||||
/// Stores available debug adapters.
|
/// Stores available debug adapters.
|
||||||
pub struct DapRegistry(Arc<RwLock<DapRegistryState>>);
|
pub struct DapRegistry(Arc<RwLock<DapRegistryState>>);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ dap.workspace = true
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
language.workspace = true
|
language.workspace = true
|
||||||
paths.workspace = true
|
paths.workspace = true
|
||||||
regex.workspace = true
|
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
task.workspace = true
|
task.workspace = true
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub fn init(registry: Arc<DapRegistry>) {
|
||||||
registry.add_adapter(Arc::from(CodeLldbDebugAdapter::default()));
|
registry.add_adapter(Arc::from(CodeLldbDebugAdapter::default()));
|
||||||
registry.add_adapter(Arc::from(PythonDebugAdapter));
|
registry.add_adapter(Arc::from(PythonDebugAdapter));
|
||||||
registry.add_adapter(Arc::from(PhpDebugAdapter));
|
registry.add_adapter(Arc::from(PhpDebugAdapter));
|
||||||
registry.add_adapter(Arc::from(JsDebugAdapter::default()));
|
registry.add_adapter(Arc::from(JsDebugAdapter));
|
||||||
registry.add_adapter(Arc::from(LldbDebugAdapter));
|
registry.add_adapter(Arc::from(LldbDebugAdapter));
|
||||||
registry.add_adapter(Arc::from(GoDebugAdapter));
|
registry.add_adapter(Arc::from(GoDebugAdapter));
|
||||||
registry.add_adapter(Arc::from(GdbDebugAdapter));
|
registry.add_adapter(Arc::from(GdbDebugAdapter));
|
||||||
|
|
|
@ -1,24 +1,13 @@
|
||||||
use adapters::latest_github_release;
|
use adapters::latest_github_release;
|
||||||
use gpui::AsyncApp;
|
use gpui::AsyncApp;
|
||||||
use regex::Regex;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use task::{DebugRequestType, DebugTaskDefinition};
|
use task::{DebugRequestType, DebugTaskDefinition};
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct JsDebugAdapter {
|
pub(crate) struct JsDebugAdapter;
|
||||||
attach_processes: Regex,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for JsDebugAdapter {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
attach_processes: Regex::new(r"(?i)^(?:node|bun|iojs)(?:$|\b)")
|
|
||||||
.expect("Regex compilation to succeed"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl JsDebugAdapter {
|
impl JsDebugAdapter {
|
||||||
const ADAPTER_NAME: &'static str = "JavaScript";
|
const ADAPTER_NAME: &'static str = "JavaScript";
|
||||||
const ADAPTER_NPM_NAME: &'static str = "vscode-js-debug";
|
const ADAPTER_NPM_NAME: &'static str = "vscode-js-debug";
|
||||||
|
@ -149,8 +138,4 @@ impl DebugAdapter for JsDebugAdapter {
|
||||||
}
|
}
|
||||||
args
|
args
|
||||||
}
|
}
|
||||||
|
|
||||||
fn attach_processes_filter(&self) -> Regex {
|
|
||||||
self.attach_processes.clone()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ use gpui::Subscription;
|
||||||
use gpui::{DismissEvent, Entity, EventEmitter, Focusable, Render};
|
use gpui::{DismissEvent, Entity, EventEmitter, Focusable, Render};
|
||||||
use picker::{Picker, PickerDelegate};
|
use picker::{Picker, PickerDelegate};
|
||||||
|
|
||||||
use std::cell::LazyCell;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use sysinfo::System;
|
use sysinfo::System;
|
||||||
use ui::{Context, Tooltip, prelude::*};
|
use ui::{Context, Tooltip, prelude::*};
|
||||||
|
@ -24,7 +23,7 @@ pub(crate) struct AttachModalDelegate {
|
||||||
matches: Vec<StringMatch>,
|
matches: Vec<StringMatch>,
|
||||||
placeholder_text: Arc<str>,
|
placeholder_text: Arc<str>,
|
||||||
project: Entity<project::Project>,
|
project: Entity<project::Project>,
|
||||||
debug_config: task::DebugTaskDefinition,
|
pub(crate) debug_config: task::DebugTaskDefinition,
|
||||||
candidates: Arc<[Candidate]>,
|
candidates: Arc<[Candidate]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +57,7 @@ impl AttachModal {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut processes: Vec<_> = System::new_all()
|
let mut processes: Box<[_]> = System::new_all()
|
||||||
.processes()
|
.processes()
|
||||||
.values()
|
.values()
|
||||||
.map(|process| {
|
.map(|process| {
|
||||||
|
@ -75,30 +74,18 @@ impl AttachModal {
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
processes.sort_by_key(|k| k.name.clone());
|
processes.sort_by_key(|k| k.name.clone());
|
||||||
|
let processes = processes.into_iter().collect();
|
||||||
Self::with_processes(project, debug_config, processes, modal, window, cx)
|
Self::with_processes(project, debug_config, processes, modal, window, cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn with_processes(
|
pub(super) fn with_processes(
|
||||||
project: Entity<project::Project>,
|
project: Entity<project::Project>,
|
||||||
debug_config: task::DebugTaskDefinition,
|
debug_config: task::DebugTaskDefinition,
|
||||||
processes: Vec<Candidate>,
|
processes: Arc<[Candidate]>,
|
||||||
modal: bool,
|
modal: bool,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let adapter = project
|
|
||||||
.read(cx)
|
|
||||||
.debug_adapters()
|
|
||||||
.adapter(&debug_config.adapter);
|
|
||||||
let filter = LazyCell::new(|| adapter.map(|adapter| adapter.attach_processes_filter()));
|
|
||||||
let processes = processes
|
|
||||||
.into_iter()
|
|
||||||
.filter(|process| {
|
|
||||||
filter
|
|
||||||
.as_ref()
|
|
||||||
.map_or(false, |filter| filter.is_match(&process.name))
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
let picker = cx.new(|cx| {
|
let picker = cx.new(|cx| {
|
||||||
Picker::uniform_list(
|
Picker::uniform_list(
|
||||||
AttachModalDelegate::new(project, debug_config, processes),
|
AttachModalDelegate::new(project, debug_config, processes),
|
||||||
|
@ -117,9 +104,10 @@ impl AttachModal {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for AttachModal {
|
impl Render for AttachModal {
|
||||||
fn render(&mut self, _window: &mut Window, _: &mut Context<Self>) -> impl ui::IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl ui::IntoElement {
|
||||||
v_flex()
|
v_flex()
|
||||||
.key_context("AttachModal")
|
.key_context("AttachModal")
|
||||||
|
.track_focus(&self.focus_handle(cx))
|
||||||
.w(rems(34.))
|
.w(rems(34.))
|
||||||
.child(self.picker.clone())
|
.child(self.picker.clone())
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ use gpui::{
|
||||||
App, AppContext, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Render, TextStyle,
|
App, AppContext, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Render, TextStyle,
|
||||||
WeakEntity,
|
WeakEntity,
|
||||||
};
|
};
|
||||||
|
use project::Project;
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
use task::{DebugTaskDefinition, LaunchConfig};
|
use task::{DebugTaskDefinition, LaunchConfig};
|
||||||
use theme::ThemeSettings;
|
use theme::ThemeSettings;
|
||||||
|
@ -59,7 +60,7 @@ impl NewSessionModal {
|
||||||
debug_panel: WeakEntity<DebugPanel>,
|
debug_panel: WeakEntity<DebugPanel>,
|
||||||
workspace: WeakEntity<Workspace>,
|
workspace: WeakEntity<Workspace>,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut App,
|
cx: &mut Context<Self>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let debugger = past_debug_definition
|
let debugger = past_debug_definition
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -171,25 +172,13 @@ impl NewSessionModal {
|
||||||
attach.update(cx, |this, cx| {
|
attach.update(cx, |this, cx| {
|
||||||
if selected_debugger != this.debug_definition.adapter {
|
if selected_debugger != this.debug_definition.adapter {
|
||||||
this.debug_definition.adapter = selected_debugger.into();
|
this.debug_definition.adapter = selected_debugger.into();
|
||||||
if let Some(project) = this
|
|
||||||
.workspace
|
|
||||||
.read_with(cx, |workspace, _| workspace.project().clone())
|
|
||||||
.ok()
|
|
||||||
{
|
|
||||||
this.attach_picker = Some(cx.new(|cx| {
|
|
||||||
let modal = AttachModal::new(
|
|
||||||
project,
|
|
||||||
this.debug_definition.clone(),
|
|
||||||
false,
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
|
|
||||||
window.focus(&modal.focus_handle(cx));
|
this.attach_picker.update(cx, |this, cx| {
|
||||||
|
this.picker.update(cx, |this, cx| {
|
||||||
modal
|
this.delegate.debug_config.adapter = selected_debugger.into();
|
||||||
}));
|
this.focus(window, cx);
|
||||||
}
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
@ -256,7 +245,6 @@ impl NewSessionModal {
|
||||||
ContextMenu::build(window, cx, move |mut menu, _, cx| {
|
ContextMenu::build(window, cx, move |mut menu, _, cx| {
|
||||||
let setter_for_name = |task: DebugTaskDefinition| {
|
let setter_for_name = |task: DebugTaskDefinition| {
|
||||||
let weak = weak.clone();
|
let weak = weak.clone();
|
||||||
let workspace = workspace.clone();
|
|
||||||
move |window: &mut Window, cx: &mut App| {
|
move |window: &mut Window, cx: &mut App| {
|
||||||
weak.update(cx, |this, cx| {
|
weak.update(cx, |this, cx| {
|
||||||
this.last_selected_profile_name = Some(SharedString::from(&task.label));
|
this.last_selected_profile_name = Some(SharedString::from(&task.label));
|
||||||
|
@ -271,12 +259,19 @@ impl NewSessionModal {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
DebugRequestType::Attach(_) => {
|
DebugRequestType::Attach(_) => {
|
||||||
|
let Ok(project) = this
|
||||||
|
.workspace
|
||||||
|
.read_with(cx, |this, _| this.project().clone())
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
this.mode = NewSessionMode::attach(
|
this.mode = NewSessionMode::attach(
|
||||||
this.debugger.clone(),
|
this.debugger.clone(),
|
||||||
workspace.clone(),
|
project,
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
this.mode.focus_handle(cx).focus(window);
|
||||||
if let Some((debugger, attach)) =
|
if let Some((debugger, attach)) =
|
||||||
this.debugger.as_ref().zip(this.mode.as_attach())
|
this.debugger.as_ref().zip(this.mode.as_attach())
|
||||||
{
|
{
|
||||||
|
@ -365,18 +360,16 @@ impl LaunchMode {
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct AttachMode {
|
struct AttachMode {
|
||||||
workspace: WeakEntity<Workspace>,
|
|
||||||
debug_definition: DebugTaskDefinition,
|
debug_definition: DebugTaskDefinition,
|
||||||
attach_picker: Option<Entity<AttachModal>>,
|
attach_picker: Entity<AttachModal>,
|
||||||
focus_handle: FocusHandle,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AttachMode {
|
impl AttachMode {
|
||||||
fn new(
|
fn new(
|
||||||
debugger: Option<SharedString>,
|
debugger: Option<SharedString>,
|
||||||
workspace: WeakEntity<Workspace>,
|
project: Entity<Project>,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut App,
|
cx: &mut Context<NewSessionModal>,
|
||||||
) -> Entity<Self> {
|
) -> Entity<Self> {
|
||||||
let debug_definition = DebugTaskDefinition {
|
let debug_definition = DebugTaskDefinition {
|
||||||
label: "Attach New Session Setup".into(),
|
label: "Attach New Session Setup".into(),
|
||||||
|
@ -387,27 +380,15 @@ impl AttachMode {
|
||||||
initialize_args: None,
|
initialize_args: None,
|
||||||
stop_on_entry: Some(false),
|
stop_on_entry: Some(false),
|
||||||
};
|
};
|
||||||
|
let attach_picker = cx.new(|cx| {
|
||||||
|
let modal = AttachModal::new(project, debug_definition.clone(), false, window, cx);
|
||||||
|
window.focus(&modal.focus_handle(cx));
|
||||||
|
|
||||||
let attach_picker = if let Some(project) = debugger.and(
|
modal
|
||||||
workspace
|
});
|
||||||
.read_with(cx, |workspace, _| workspace.project().clone())
|
cx.new(|_| Self {
|
||||||
.ok(),
|
|
||||||
) {
|
|
||||||
Some(cx.new(|cx| {
|
|
||||||
let modal = AttachModal::new(project, debug_definition.clone(), false, window, cx);
|
|
||||||
window.focus(&modal.focus_handle(cx));
|
|
||||||
|
|
||||||
modal
|
|
||||||
}))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
cx.new(|cx| Self {
|
|
||||||
workspace,
|
|
||||||
debug_definition,
|
debug_definition,
|
||||||
attach_picker,
|
attach_picker,
|
||||||
focus_handle: cx.focus_handle(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn debug_task(&self) -> task::AttachConfig {
|
fn debug_task(&self) -> task::AttachConfig {
|
||||||
|
@ -444,7 +425,7 @@ impl Focusable for NewSessionMode {
|
||||||
fn focus_handle(&self, cx: &App) -> FocusHandle {
|
fn focus_handle(&self, cx: &App) -> FocusHandle {
|
||||||
match &self {
|
match &self {
|
||||||
NewSessionMode::Launch(entity) => entity.read(cx).program.focus_handle(cx),
|
NewSessionMode::Launch(entity) => entity.read(cx).program.focus_handle(cx),
|
||||||
NewSessionMode::Attach(entity) => entity.read(cx).focus_handle.clone(),
|
NewSessionMode::Attach(entity) => entity.read(cx).attach_picker.focus_handle(cx),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,8 +457,11 @@ impl RenderOnce for LaunchMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderOnce for AttachMode {
|
impl RenderOnce for AttachMode {
|
||||||
fn render(self, _: &mut Window, _: &mut App) -> impl IntoElement {
|
fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||||
v_flex().w_full().children(self.attach_picker.clone())
|
v_flex()
|
||||||
|
.w_full()
|
||||||
|
.track_focus(&self.attach_picker.focus_handle(cx))
|
||||||
|
.child(self.attach_picker.clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,13 +481,17 @@ impl RenderOnce for NewSessionMode {
|
||||||
impl NewSessionMode {
|
impl NewSessionMode {
|
||||||
fn attach(
|
fn attach(
|
||||||
debugger: Option<SharedString>,
|
debugger: Option<SharedString>,
|
||||||
workspace: WeakEntity<Workspace>,
|
project: Entity<Project>,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut App,
|
cx: &mut Context<NewSessionModal>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self::Attach(AttachMode::new(debugger, workspace, window, cx))
|
Self::Attach(AttachMode::new(debugger, project, window, cx))
|
||||||
}
|
}
|
||||||
fn launch(past_launch_config: Option<LaunchConfig>, window: &mut Window, cx: &mut App) -> Self {
|
fn launch(
|
||||||
|
past_launch_config: Option<LaunchConfig>,
|
||||||
|
window: &mut Window,
|
||||||
|
cx: &mut Context<NewSessionModal>,
|
||||||
|
) -> Self {
|
||||||
Self::Launch(LaunchMode::new(past_launch_config, window, cx))
|
Self::Launch(LaunchMode::new(past_launch_config, window, cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -592,18 +580,25 @@ impl Render for NewSessionModal {
|
||||||
.toggle_state(matches!(self.mode, NewSessionMode::Attach(_)))
|
.toggle_state(matches!(self.mode, NewSessionMode::Attach(_)))
|
||||||
.style(ui::ButtonStyle::Subtle)
|
.style(ui::ButtonStyle::Subtle)
|
||||||
.on_click(cx.listener(|this, _, window, cx| {
|
.on_click(cx.listener(|this, _, window, cx| {
|
||||||
|
let Ok(project) = this
|
||||||
|
.workspace
|
||||||
|
.read_with(cx, |this, _| this.project().clone())
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
this.mode = NewSessionMode::attach(
|
this.mode = NewSessionMode::attach(
|
||||||
this.debugger.clone(),
|
this.debugger.clone(),
|
||||||
this.workspace.clone(),
|
project,
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
this.mode.focus_handle(cx).focus(window);
|
||||||
if let Some((debugger, attach)) =
|
if let Some((debugger, attach)) =
|
||||||
this.debugger.as_ref().zip(this.mode.as_attach())
|
this.debugger.as_ref().zip(this.mode.as_attach())
|
||||||
{
|
{
|
||||||
Self::update_attach_picker(&attach, &debugger, window, cx);
|
Self::update_attach_picker(&attach, &debugger, window, cx);
|
||||||
}
|
}
|
||||||
this.mode.focus_handle(cx).focus(window);
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}))
|
}))
|
||||||
.last(),
|
.last(),
|
||||||
|
|
|
@ -100,7 +100,7 @@ async fn test_show_attach_modal_and_select_process(
|
||||||
},
|
},
|
||||||
Candidate {
|
Candidate {
|
||||||
pid: 3,
|
pid: 3,
|
||||||
name: "non-fake-binary-1".into(),
|
name: "real-binary-1".into(),
|
||||||
command: vec![],
|
command: vec![],
|
||||||
},
|
},
|
||||||
Candidate {
|
Candidate {
|
||||||
|
@ -108,7 +108,9 @@ async fn test_show_attach_modal_and_select_process(
|
||||||
name: "fake-binary-2".into(),
|
name: "fake-binary-2".into(),
|
||||||
command: vec![],
|
command: vec![],
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
|
.into_iter()
|
||||||
|
.collect(),
|
||||||
true,
|
true,
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
|
@ -121,17 +123,30 @@ async fn test_show_attach_modal_and_select_process(
|
||||||
|
|
||||||
cx.run_until_parked();
|
cx.run_until_parked();
|
||||||
|
|
||||||
|
// assert we got the expected processes
|
||||||
|
workspace
|
||||||
|
.update(cx, |_, window, cx| {
|
||||||
|
let names =
|
||||||
|
attach_modal.update(cx, |modal, cx| attach_modal::_process_names(&modal, cx));
|
||||||
|
// Initially all processes are visible.
|
||||||
|
assert_eq!(3, names.len());
|
||||||
|
attach_modal.update(cx, |this, cx| {
|
||||||
|
this.picker.update(cx, |this, cx| {
|
||||||
|
this.set_query("fakb", window, cx);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
cx.run_until_parked();
|
||||||
// assert we got the expected processes
|
// assert we got the expected processes
|
||||||
workspace
|
workspace
|
||||||
.update(cx, |_, _, cx| {
|
.update(cx, |_, _, cx| {
|
||||||
let names =
|
let names =
|
||||||
attach_modal.update(cx, |modal, cx| attach_modal::_process_names(&modal, cx));
|
attach_modal.update(cx, |modal, cx| attach_modal::_process_names(&modal, cx));
|
||||||
|
// Initially all processes are visible.
|
||||||
// we filtered out all processes that are not starting with `fake-binary`
|
|
||||||
assert_eq!(2, names.len());
|
assert_eq!(2, names.len());
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// select the only existing process
|
// select the only existing process
|
||||||
cx.dispatch_action(Confirm);
|
cx.dispatch_action(Confirm);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue