Visual Studio Code, rebuilt in Rust
Rust
feat(debug): draw inline breakpoints and candidate dots
rokartur8b476d64ae76
diff --git a/native/crates/app/src/editor/injected_text.rs b/native/crates/app/src/editor/injected_text.rsindex ee0109293a3..fc5aa2b1bb6 100644--- a/native/crates/app/src/editor/injected_text.rs+++ b/native/crates/app/src/editor/injected_text.rs@@ -21,6 +21,8 @@ pub enum InjectionOwner {DebugInlineValue,/// The arrow before a top stack frame's column (callStackEditorContribution.ts `makeStackFrameColumnDecoration`).StackFrameColumn,+ /// An inline breakpoint or candidate's `debug-breakpoint-placeholder` (breakpointEditorContribution.ts).+ InlineBreakpoint,}impl InjectionOwner {@@ -32,7 +34,7 @@ impl InjectionOwner {InjectionOwner::InlayHint => CursorStops::Right,// A debug inline value's `InjectedTextCursorStops.None` sits at the line's end, where Left is the one stop.InjectionOwner::GhostText | InjectionOwner::DecorationContent | InjectionOwner::DebugInlineValue => CursorStops::Left,- InjectionOwner::Color | InjectionOwner::InlineProgress | InjectionOwner::StackFrameColumn => CursorStops::Both,+ InjectionOwner::Color | InjectionOwner::InlineProgress | InjectionOwner::StackFrameColumn | InjectionOwner::InlineBreakpoint => CursorStops::Both,}}}diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rsindex 304ff8c9581..e8da000fcc4 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -10,6 +10,7 @@ mod actions;mod part_navigation;mod activity_bar_menu;mod breakpoint_widget;+mod inline_breakpoints;mod bulk_text_edits;mod configuration;mod configuration_migration;@@ -625,6 +626,7 @@ impl Render for Workbench {self.follow_references_peek_editor();self.follow_hierarchy_peek_editor(window, cx);self.sync_stack_frame_columns();+ self.sync_inline_breakpoints(cx);// The floating widgets sit on the rows of each file's diff, recomputed after an edit.self.update_multi_diff_editor();self.append_multi_diff_layout_logs();diff --git a/native/crates/app/src/workbench/breakpoint_widget.rs b/native/crates/app/src/workbench/breakpoint_widget.rsindex ec933480111..9244c2c0259 100644--- a/native/crates/app/src/workbench/breakpoint_widget.rs+++ b/native/crates/app/src/workbench/breakpoint_widget.rs@@ -28,6 +28,8 @@ pub struct BreakpointWidget {pub uri: Value,/// 1-based line and the zone that shows the widget below it.pub line: u32,+ /// The column a new breakpoint takes: an inline breakpoint widget's context menu adds at its column.+ pub column: Option<u32>,pub zone_id: u32,pub breakpoint: Option<String>,pub context: WidgetContext,@@ -149,23 +151,23 @@ impl Workbench {cx.notify();Outcome::done()});- // The glyph margin context menu's actions, with `[uri, line]` arguments.+ // The glyph margin and inline breakpoint context menus' actions, with `[uri, line, column?]` arguments.self.commands.register("_debug.gutter.addBreakpoint", |workbench, args, _, cx| {- let (uri, line) = gutter_args(&args);- let change = workbench.debug.model.add_breakpoints(&uri, vec![BreakpointData::at(line)]);+ let (uri, line, column) = gutter_args(&args);+ let change = workbench.debug.model.add_breakpoints(&uri, vec![BreakpointData { column, ..BreakpointData::at(line) }]);workbench.breakpoints_changed(change, true, cx);Outcome::done()});let adds = [("_debug.gutter.addConditionalBreakpoint", WidgetContext::Condition), ("_debug.gutter.addLogpoint", WidgetContext::LogMessage), ("_debug.gutter.addTriggeredBreakpoint", WidgetContext::TriggerPoint)];for (id, context) in adds {self.commands.register(id, move |workbench, args, window, cx| {- let (_, line) = gutter_args(&args);- workbench.show_breakpoint_widget(line, None, context, window, cx);+ let (_, line, column) = gutter_args(&args);+ workbench.show_breakpoint_widget(line, column, None, context, window, cx);Outcome::done()});}self.commands.register("_debug.gutter.runToLine", |workbench, args, window, cx| {- let (uri, line) = gutter_args(&args);+ let (uri, line, _) = gutter_args(&args);workbench.run_to_line(&uri, line, None, window, cx);Outcome::done()});@@ -173,7 +175,7 @@ impl Workbench {self.commands.register("_debug.gutter.editBreakpoint", |workbench, args, window, cx| {let Some(breakpoint) = args.first().and_then(Value::as_str).and_then(|id| workbench.debug.model.breakpoint(id)) else { return Outcome::done() };let (line, id) = (breakpoint.line_number(), breakpoint.id().to_owned());- workbench.show_breakpoint_widget(line, Some(id), WidgetContext::Condition, window, cx);+ workbench.show_breakpoint_widget(line, None, Some(id), WidgetContext::Condition, window, cx);Outcome::done()});self.commands.register("_debug.gutter.removeBreakpoint", |workbench, args, _, cx| {@@ -191,21 +193,27 @@ impl Workbench {});}- /// breakpointEditorContribution.ts's gutter actions generator (`getContextMenuActions`), the line-number menu's- /// `2_debug` group: add actions on a line without breakpoints, else actions on its one breakpoint or submenus per- /// breakpoint, then Run to Line while stopped.+ /// breakpointEditorContribution.ts's gutter actions generator, the line-number menu's `2_debug` group: the+ /// `getContextMenuActions` of the line's breakpoints.pub(super) fn debug_gutter_actions(&mut self, line: u32) -> Vec<MenuAction> {let Some(editor) = self.editors.active() else { return Vec::new() };if self.debug.debuggers.is_empty() || !self.can_set_breakpoints_in(editor) {return Vec::new();}let uri = editor.document().uri();- let mut breakpoints: Vec<Breakpoint> = self.debug.model.breakpoints_in(&editor.document().uri_string()).filter(|breakpoint| breakpoint.line_number() == line).cloned().collect();+ let breakpoints: Vec<Breakpoint> = self.debug.model.breakpoints_in(&editor.document().uri_string()).filter(|breakpoint| breakpoint.line_number() == line).cloned().collect();+ self.breakpoint_menu_actions(breakpoints, uri, line, None)+ }++ /// `getContextMenuActions`: add actions (at `column` when given) without breakpoints, else actions on the one+ /// breakpoint or submenus per breakpoint, then Run to Line while stopped.+ pub(super) fn breakpoint_menu_actions(&mut self, mut breakpoints: Vec<Breakpoint>, uri: Value, line: u32, column: Option<u32>) -> Vec<MenuAction> {let mut actions = Vec::new();let action = |workbench: &mut Self, title: String, command: &str, args: Vec<Value>| MenuAction::Command { id: workbench.bound_command(command, args), title, enabled: true, checked: false, alt: None };match breakpoints.as_slice() {[] => {- let line_args = vec![uri.clone(), json!(line)];+ let mut line_args = vec![uri.clone(), json!(line)];+ line_args.extend(column.map(|column| json!(column)));for (title, command) in [("Add Breakpoint", "_debug.gutter.addBreakpoint"), ("Add Conditional Breakpoint...", "_debug.gutter.addConditionalBreakpoint"), ("Add Logpoint...", "_debug.gutter.addLogpoint"), ("Add Triggered Breakpoint...", "_debug.gutter.addTriggeredBreakpoint")] {actions.push(action(self, title.into(), command, line_args.clone()));}@@ -454,7 +462,7 @@ impl Workbench {/// breakpointEditorContribution.ts `getContextMenuActions`./// `BreakpointWidget.show`: a zone of two lines below the line, the input focused with the breakpoint's value.- pub(crate) fn show_breakpoint_widget(&mut self, line: u32, breakpoint: Option<String>, context: WidgetContext, window: &mut Window, cx: &mut Context<Self>) {+ pub(crate) fn show_breakpoint_widget(&mut self, line: u32, column: Option<u32>, breakpoint: Option<String>, context: WidgetContext, window: &mut Window, cx: &mut Context<Self>) {self.close_breakpoint_widget(window, cx);let viewport = self.editors.viewport;let Some(editor) = self.editors.active_mut() else { return };@@ -484,7 +492,7 @@ impl Workbench {WidgetContext::LogMessage => log_message.clone(),});let uri = editor.document().uri();- self.breakpoint_widget = Some(BreakpointWidget { model_uri: editor.document().uri_string(), uri, line, zone_id, breakpoint, context, input, condition, hit_count, log_message, triggered_by });+ self.breakpoint_widget = Some(BreakpointWidget { model_uri: editor.document().uri_string(), uri, line, column, zone_id, breakpoint, context, input, condition, hit_count, log_message, triggered_by });self.debug_view.widget_view.reset();window.focus(&self.debug_view.widget_focus, cx);cx.notify();@@ -510,7 +518,7 @@ impl Workbench {true => (None, None, None, widget.triggered_by.clone()),false => (some(&widget.condition), some(&widget.hit_count), some(&widget.log_message), None),};- let (uri, line, breakpoint) = (widget.uri.clone(), widget.line, widget.breakpoint.clone());+ let (uri, line, column, breakpoint) = (widget.uri.clone(), widget.line, widget.column, widget.breakpoint.clone());let change = match breakpoint {Some(id) => {let mut update = serde_json::Map::new();@@ -520,7 +528,7 @@ impl Workbench {update.insert("triggeredBy".into(), json!(triggered_by));self.debug.model.update_breakpoints(&[(id, update)])}- None if trigger_point || condition.is_some() || hit_condition.is_some() || log_message.is_some() => self.debug.model.add_breakpoints(&uri, vec![BreakpointData { condition, hit_condition, log_message, triggered_by, ..BreakpointData::at(line) }]),+ None if trigger_point || condition.is_some() || hit_condition.is_some() || log_message.is_some() => self.debug.model.add_breakpoints(&uri, vec![BreakpointData { column, condition, hit_condition, log_message, triggered_by, ..BreakpointData::at(line) }]),None => crate::debug::BreakpointsChange::default(),};self.breakpoints_changed(change, true, cx);@@ -693,8 +701,8 @@ fn trigger_candidates<'a>(model: &'a DebugModel, own: Option<&str>) -> Vec<&'a Bmodel.breakpoints.iter().filter(|breakpoint| Some(breakpoint.id()) != own && breakpoint.base.log_message.is_none()).collect()}-fn gutter_args(args: &[Value]) -> (Value, u32) {- (args.first().cloned().unwrap_or_default(), args.get(1).and_then(Value::as_u64).unwrap_or(1) as u32)+fn gutter_args(args: &[Value]) -> (Value, u32, Option<u32>) {+ (args.first().cloned().unwrap_or_default(), args.get(1).and_then(Value::as_u64).unwrap_or(1) as u32, args.get(2).and_then(Value::as_u64).map(|column| column as u32))}#[cfg(test)]diff --git a/native/crates/app/src/workbench/debug_commands.rs b/native/crates/app/src/workbench/debug_commands.rsindex 0c39d154d48..f4fdf59374c 100644--- a/native/crates/app/src/workbench/debug_commands.rs+++ b/native/crates/app/src/workbench/debug_commands.rs@@ -140,7 +140,7 @@ impl Workbench {self.commands.register(id, move |workbench, _, window, cx| {let Some(editor) = workbench.editors.active() else { return Outcome::done() };let line = editor.selections[0].head.line as u32 + 1;- workbench.show_breakpoint_widget(line, None, kind, window, cx);+ workbench.show_breakpoint_widget(line, None, None, kind, window, cx);Outcome::done()});}@@ -149,7 +149,7 @@ impl Workbench {let line = editor.selections[0].head.line as u32 + 1;let uri = editor.document().uri_string();let id = workbench.debug.model.breakpoints_in(&uri).find(|breakpoint| breakpoint.line_number() == line).map(|breakpoint| breakpoint.id().to_owned());- workbench.show_breakpoint_widget(line, id, super::breakpoint_widget::WidgetContext::Condition, window, cx);+ workbench.show_breakpoint_widget(line, None, id, super::breakpoint_widget::WidgetContext::Condition, window, cx);Outcome::done()});self.commands.register("workbench.debug.viewlet.action.removeAllBreakpoints", |workbench, _, _, cx| {diff --git a/native/crates/app/src/workbench/debug_service.rs b/native/crates/app/src/workbench/debug_service.rsindex deb05b1c877..999e3833ced 100644--- a/native/crates/app/src/workbench/debug_service.rs+++ b/native/crates/app/src/workbench/debug_service.rs@@ -83,6 +83,7 @@ pub struct DebugService {pub scopes: Vec<Variable>,pub children: HashMap<(String, i64), Vec<Variable>>,pub visualizers: super::debug_visualizers::DebugVisualizers,+ pub inline_breakpoints: super::inline_breakpoints::InlineBreakpoints,/// Watch expression results by expression id.pub watch_values: HashMap<String, Variable>,pub repl: Vec<ReplElement>,@@ -1512,7 +1513,7 @@ fn launch_vs_code_args(arguments: &Value) -> Vec<String> {}/// The DAP `Source` of a breakpoint's resource: a file's path, else the URI string.-fn source_of_uri(uri: &Value) -> Value {+pub(super) fn source_of_uri(uri: &Value) -> Value {let path = match uri["scheme"].as_str() {Some("file") => uri["path"].clone(),_ => json!(crate::debug::uri_string(uri)),diff --git a/native/crates/app/src/workbench/editor_view/injected_text_view.rs b/native/crates/app/src/workbench/editor_view/injected_text_view.rsindex 2b3a6308697..760620fb497 100644--- a/native/crates/app/src/workbench/editor_view/injected_text_view.rs+++ b/native/crates/app/src/workbench/editor_view/injected_text_view.rs@@ -71,6 +71,11 @@ impl Workbench {InjectionOwner::InlineProgress => None,InjectionOwner::DebugInlineValue => Some(self.debug_inline_value_element(&injection.content, left, metrics.line_height)),InjectionOwner::StackFrameColumn => Some(self.stack_frame_column_element(injection.id == 1, left, metrics.line_height)),+ InjectionOwner::InlineBreakpoint => {+ // The widget sits at the column before its decoration's (`getPosition`).+ let anchor = injection.position.column.checked_sub(1).map(|column| layout.char_x(column) * metrics.char_width);+ self.inline_breakpoint_element(editor, injection.id, anchor, metrics.line_height, cx)+ }};elements.extend(element);}diff --git a/native/crates/app/src/workbench/inline_breakpoints.rs b/native/crates/app/src/workbench/inline_breakpoints.rsnew file mode 100644index 00000000000..6f262cc0a73--- /dev/null+++ b/native/crates/app/src/workbench/inline_breakpoints.rs@@ -0,0 +1,338 @@+//! breakpointEditorContribution.ts's inline breakpoints: the `InlineBreakpointWidget` before a column breakpoint+//! and the candidate dots the focused session's `breakpointLocations` answers on the breakpoints' lines.++use std::collections::HashMap;++use gpui::{AnyElement, ClickEvent, Context, MouseButton, MouseDownEvent, Window, div, prelude::*, px};+use serde_json::{Value, json};++use super::Workbench;+use super::breakpoint_widget::breakpoint_icon;+use crate::debug::session::State;+use crate::debug::{Breakpoint, BreakpointData};+use crate::editor::injected_text::{InjectedText, InjectionOwner, WrapWidth};+use crate::editor::{OpenEditor, Position};++/// One `InlineBreakpointWidget`: its 1-based decoration start, icon, and the breakpoint it toggles (none for a+/// candidate, which adds one).+#[derive(Clone, Debug, PartialEq)]+pub struct InlineWidget {+ pub line: u32,+ pub column: u32,+ pub icon: &'static str,+ pub breakpoint: Option<String>,+}++#[derive(Default)]+pub struct InlineBreakpoints {+ /// The widgets of each model URI; an injection's `id` indexes its model's.+ pub widgets: HashMap<String, Vec<InlineWidget>>,+ /// The session, debug state and breakpoint lines each model's candidates were asked for, and the 1-based+ /// positions answered.+ asked: HashMap<String, (String, State, Vec<u32>)>,+ candidates: HashMap<String, Vec<(u32, u32)>>,+}++/// A breakpoint decoration of `createBreakpointDecorations`: its 1-based start and whether it renders inline.+struct BreakpointDecoration<'a> {+ breakpoint: &'a Breakpoint,+ line: u32,+ column: u32,+ inline: bool,+}++impl Workbench {+ /// `setDecorations` in every editor, run on every render: the inline widgets of breakpoints and candidates, each+ /// after a `debug-breakpoint-placeholder` of `0.9em` when it has one.+ pub(super) fn sync_inline_breakpoints(&mut self, cx: &mut Context<Self>) {+ self.request_breakpoint_candidates(cx);+ let placeholder = 0.9 * super::editor_view::EDITOR_FONT_SIZE * self.editor_zoom.multiplier() / self.editors.viewport.char_width;+ let mut widgets = HashMap::new();+ let mut wanted = Vec::new();+ for editor in self.editors.editors.iter().chain(&self.editors.models) {+ let (editor_widgets, injections) = self.inline_breakpoints(editor, placeholder);+ if !editor_widgets.is_empty() {+ widgets.insert(editor.document().uri_string(), editor_widgets);+ }+ wanted.push(injections);+ }+ self.debug.inline_breakpoints.widgets = widgets;+ for (editor, injections) in self.editors.editors.iter_mut().chain(&mut self.editors.models).zip(wanted) {+ let current = editor.injected_text.iter().filter(|injection| injection.owner == InjectionOwner::InlineBreakpoint);+ if !current.eq(injections.iter()) {+ editor.set_injected_text(InjectionOwner::InlineBreakpoint, injections);+ }+ }+ }++ fn inline_breakpoints(&self, editor: &OpenEditor, placeholder: f32) -> (Vec<InlineWidget>, Vec<InjectedText>) {+ let document = editor.document();+ let uri = document.uri_string();+ let lines = &document.lines;+ let debug_active = matches!(self.debug.state(), State::Running | State::Stopped);+ let icon = |breakpoint: &Breakpoint| breakpoint_icon(breakpoint, &self.debug.model, debug_active, editor.is_dirty()).0;+ let decorations = breakpoint_decorations(self.debug.model.breakpoints_in(&uri).collect(), lines);+ let mut widgets = Vec::new();+ let mut injections = Vec::new();+ let mut push = |widget: InlineWidget, columns: Option<f32>| {+ let index = widget.line as usize - 1;+ let position = Position::new(index, (widget.column as usize - 1).min(lines[index].chars().count()));+ let (content, columns) = columns.map_or((String::new(), 0.), |columns| ("\u{a0}".into(), columns));+ injections.push(InjectedText { position, columns, content, wrap: WrapWidth::Fixed, owner: InjectionOwner::InlineBreakpoint, id: widgets.len(), at_range_start: true });+ widgets.push(widget);+ };+ for decoration in decorations.iter().filter(|decoration| decoration.inline) {+ let widget = InlineWidget { line: decoration.line, column: decoration.column, icon: icon(decoration.breakpoint), breakpoint: Some(decoration.breakpoint.id().to_owned()) };+ push(widget, Some(placeholder));+ }+ // `createCandidateDecorations`.+ let candidates = self.debug.inline_breakpoints.candidates.get(&uri).map(Vec::as_slice).unwrap_or_default();+ for &(line, column) in candidates {+ let Some(text) = lines.get(line as usize - 1) else { continue };+ let (first, last) = (first_non_whitespace_column(text), last_non_whitespace_column(text));+ let later_on_line = decorations.iter().any(|decoration| decoration.line == line && decoration.column > first);+ // Not at the line's start without another breakpoint on the line, nor past its end.+ if (column <= first && !later_on_line) || column > last {+ continue;+ }+ let at_position = decorations.iter().find(|decoration| decoration.line == line && decoration.column == column);+ match at_position {+ // Space already occupied.+ Some(decoration) if decoration.inline => {}+ Some(decoration) => push(InlineWidget { line, column, icon: icon(decoration.breakpoint), breakpoint: Some(decoration.breakpoint.id().to_owned()) }, None),+ None => push(InlineWidget { line, column, icon: "debug-breakpoint-disabled", breakpoint: None }, Some(placeholder)),+ }+ }+ injections.sort_by_key(|injection| injection.position);+ (widgets, injections)+ }++ /// `requestBreakpointCandidateLocations` with `debug.showInlineBreakpointCandidates` on: the focused session's+ /// `breakpointLocations` for each breakpoint line of each model, asked again when the session, its state+ /// (`onDidChangeState`) or the lines change.+ fn request_breakpoint_candidates(&mut self, cx: &mut Context<Self>) {+ let session = self.debug.focused_session().filter(|session| session.capabilities["supportsBreakpointLocationsRequest"] == true).map(|session| session.id.clone());+ let Some(session_id) = session.filter(|_| self.setting("debug.showInlineBreakpointCandidates") == true) else {+ self.debug.inline_breakpoints.asked.clear();+ self.debug.inline_breakpoints.candidates.clear();+ return;+ };+ let mut asks = Vec::new();+ for editor in self.editors.editors.iter().chain(&self.editors.models) {+ let document = editor.document();+ let uri = document.uri_string();+ let mut lines: Vec<u32> = self.debug.model.breakpoints_in(&uri).map(Breakpoint::line_number).filter(|line| *line as usize <= document.lines.len()).collect();+ lines.sort();+ lines.dedup();+ let key = (session_id.clone(), self.debug.state(), lines);+ if self.debug.inline_breakpoints.asked.get(&uri) != Some(&key) {+ asks.push((uri, document.uri(), key));+ }+ }+ for (uri, document_uri, key) in asks {+ let source = super::debug_service::source_of_uri(&document_uri);+ let replies: Vec<_> = key.2.iter().map(|line| self.dap_request(&session_id, "breakpointLocations", json!({ "source": source, "line": line }))).collect();+ self.debug.inline_breakpoints.asked.insert(uri.clone(), key.clone());+ cx.spawn(async move |this, cx| {+ let mut positions = Vec::new();+ for reply in replies {+ // A failed request has no positions.+ let body = super::debug_service::answer(reply).await.unwrap_or_default();+ for location in body["breakpoints"].as_array().into_iter().flatten() {+ let position = (location["line"].as_u64().unwrap_or_default() as u32, location["column"].as_u64().unwrap_or(1) as u32);+ if !positions.contains(&position) {+ positions.push(position);+ }+ }+ }+ let _ = this.update(cx, |workbench, cx| {+ let candidates = &mut workbench.debug.inline_breakpoints;+ if candidates.asked.get(&uri) == Some(&key) {+ candidates.candidates.insert(uri, positions);+ cx.notify();+ }+ });+ })+ .detach();+ }+ }++ /// `InlineBreakpointWidget`: `ceil(0.8 * lineHeight)` wide with a 4px left margin at the column before its+ /// decoration (`left: -8px` at the line's start); disabled-icon candidates at 0.7 opacity.+ pub(super) fn inline_breakpoint_element(&self, editor: &OpenEditor, id: usize, anchor: Option<f32>, line_height: f32, cx: &mut Context<Self>) -> Option<AnyElement> {+ let uri = editor.document().uri_string();+ let widget = self.debug.inline_breakpoints.widgets.get(&uri)?.get(id)?.clone();+ let icon = self.breakpoint_icon(widget.icon, 16.).when(widget.icon == "debug-breakpoint-disabled", |icon| icon.opacity(0.7));+ let left = anchor.unwrap_or(-8.) + 4.;+ let document_uri = editor.document().uri();+ let menu_widget = widget.clone();+ let menu_uri = document_uri.clone();+ let element = div()+ .id(("inline-breakpoint", id))+ .debug_selector(|| "inline-breakpoint-widget".into())+ .absolute()+ .top_0()+ .left(px(left))+ .w(px((0.8 * line_height).ceil()))+ .h(px(line_height))+ .flex()+ .items_center()+ .cursor_pointer()+ .child(icon)+ // `suppressMouseDown`: the editor does not take the press.+ .on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation())+ .on_mouse_down(MouseButton::Right, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| {+ cx.stop_propagation();+ workbench.show_inline_breakpoint_menu(&menu_uri, &menu_widget, event.position, window, cx);+ }))+ .on_click(cx.listener(move |workbench, _: &ClickEvent, _, cx| workbench.inline_breakpoint_clicked(&document_uri, &widget, cx)));+ Some(element.into_any_element())+ }++ /// The widget's click: a candidate adds a breakpoint at its column, an enabled breakpoint goes, a disabled one is enabled.+ fn inline_breakpoint_clicked(&mut self, uri: &Value, widget: &InlineWidget, cx: &mut Context<Self>) {+ let enabled = widget.breakpoint.as_deref().and_then(|id| self.debug.model.breakpoint(id)).map(|breakpoint| breakpoint.base.enabled);+ let change = match (enabled, &widget.breakpoint) {+ (Some(true), Some(id)) => self.debug.model.remove_breakpoints(std::slice::from_ref(id)),+ (Some(false), Some(id)) => self.debug.model.set_enablement(id, true),+ _ => self.debug.model.add_breakpoints(uri, vec![BreakpointData { column: Some(widget.column), ..BreakpointData::at(widget.line) }]),+ };+ self.breakpoints_changed(change, true, cx);+ cx.notify();+ }++ fn show_inline_breakpoint_menu(&mut self, uri: &Value, widget: &InlineWidget, pointer: gpui::Point<gpui::Pixels>, window: &mut Window, cx: &mut Context<Self>) {+ let breakpoints: Vec<Breakpoint> = widget.breakpoint.as_deref().and_then(|id| self.debug.model.breakpoint(id)).cloned().into_iter().collect();+ let actions = self.breakpoint_menu_actions(breakpoints, uri.clone(), widget.line, Some(widget.column));+ let context = self.key_context(window);+ self.show_context_menu_actions(actions, &context, super::editor_menus::point_anchor(pointer), Vec::new(), window, cx);+ }+}++/// `createBreakpointDecorations`: each breakpoint at its column or the line's first non-whitespace one, inline when+/// it has a column past that or shares its line.+fn breakpoint_decorations<'a>(breakpoints: Vec<&'a Breakpoint>, lines: &[String]) -> Vec<BreakpointDecoration<'a>> {+ let mut decorations = Vec::new();+ for breakpoint in &breakpoints {+ let line = breakpoint.line_number();+ let Some(text) = lines.get(line as usize - 1) else { continue };+ let first = first_non_whitespace_column(text);+ let others = breakpoints.iter().any(|other| !std::ptr::eq(*other, *breakpoint) && other.line_number() == line);+ // `validateRange`: within 1 and the line's end column.+ let column = breakpoint.column().unwrap_or(first).clamp(1, text.chars().count() as u32 + 1);+ let inline = breakpoint.column().is_some_and(|column| others || column > first);+ decorations.push(BreakpointDecoration { breakpoint, line, column, inline });+ }+ decorations+}++/// `getLineFirstNonWhitespaceColumn`: 1-based, 0 for a blank line.+fn first_non_whitespace_column(text: &str) -> u32 {+ text.chars().position(|c| c != ' ' && c != '\t').map_or(0, |index| index as u32 + 1)+}++/// `getLineLastNonWhitespaceColumn`: the 1-based column after the last non-whitespace char, 0 for a blank line.+fn last_non_whitespace_column(text: &str) -> u32 {+ let chars: Vec<char> = text.chars().collect();+ chars.iter().rposition(|c| *c != ' ' && *c != '\t').map_or(0, |index| index as u32 + 2)+}++#[cfg(test)]+mod tests {+ use gpui::TestAppContext;++ use super::super::testing_gutter::tests::titles;+ use super::super::variable_menu::tests::{respond, sent_request, stopped_session};+ use super::*;++ fn open(workbench: &gpui::Entity<Workbench>, text: &str, cx: &mut gpui::VisualTestContext) -> (std::path::PathBuf, Value, String) {+ let dir = std::env::temp_dir().join(format!("vsrustium-{}", crate::test_name()));+ std::fs::create_dir_all(&dir).unwrap();+ let file = dir.join("a.js");+ std::fs::write(&file, text).unwrap();+ let (uri, uri_string) = workbench.update_in(cx, |workbench, window, cx| {+ workbench.open_file(file.clone(), true, window, cx);+ let document = workbench.editors.active().unwrap().document();+ (document.uri(), document.uri_string())+ });+ cx.run_until_parked();+ (dir, uri, uri_string)+ }++ fn widgets(workbench: &gpui::Entity<Workbench>, uri: &str, cx: &mut gpui::VisualTestContext) -> Vec<(u32, u32, &'static str, bool)> {+ workbench.read_with(cx, |workbench, _| workbench.debug.inline_breakpoints.widgets.get(uri).into_iter().flatten().map(|widget| (widget.line, widget.column, widget.icon, widget.breakpoint.is_some())).collect())+ }++ /// (column, width in px) of each placeholder on the active editor's first line.+ fn placeholders(workbench: &gpui::Entity<Workbench>, cx: &mut gpui::VisualTestContext) -> Vec<(usize, f32)> {+ workbench.read_with(cx, |workbench, _| {+ let editor = workbench.editors.active().unwrap();+ editor.injected_text.iter().filter(|injection| injection.owner == InjectionOwner::InlineBreakpoint).map(|injection| (injection.position.column, (injection.columns * workbench.editors.viewport.char_width * 10.).round() / 10.)).collect()+ })+ }++ fn click_widget(cx: &mut gpui::VisualTestContext) {+ let bounds = cx.debug_bounds("inline-breakpoint-widget").expect("an inline breakpoint widget draws");+ cx.simulate_click(bounds.center(), gpui::Modifiers::none());+ cx.run_until_parked();+ }++ /// `requestBreakpointCandidateLocations` and `createCandidateDecorations`: the breakpoint line's+ /// `breakpointLocations` answer a dot past the line's first column, not one at it or past its end; clicking the dot+ /// adds an inline breakpoint there, after which the line breakpoint's own position takes a widget too.+ #[gpui::test]+ fn candidate_dots_come_from_breakpoint_locations_and_add_a_breakpoint(cx: &mut TestAppContext) {+ let (workbench, cx, host) = stopped_session(cx, json!({ "supportsBreakpointLocationsRequest": true }));+ let (dir, uri, uri_string) = open(&workbench, "\tconsole.log(a, b);\n", cx);+ workbench.update(cx, |workbench, cx| {+ workbench.debug.model.add_breakpoints(&uri, vec![BreakpointData::at(1)]);+ cx.notify();+ });+ cx.run_until_parked();+ let request = sent_request(&host, "breakpointLocations");+ assert_eq!(request["arguments"]["line"], 1);+ assert_eq!(request["arguments"]["source"]["name"], "a.js");+ respond(&workbench, cx, &request, true, json!({ "breakpoints": [{ "line": 1, "column": 2 }, { "line": 1, "column": 10 }, { "line": 1, "column": 10 }, { "line": 1, "column": 40 }] }));+ assert_eq!(widgets(&workbench, &uri_string, cx), [(1, 10, "debug-breakpoint-disabled", false)]);+ assert_eq!(placeholders(&workbench, cx), [(9, 10.8)]);++ click_widget(cx);+ let column = workbench.read_with(cx, |workbench, _| workbench.debug.model.breakpoints_in(&uri_string).filter_map(Breakpoint::column).collect::<Vec<_>>());+ assert_eq!(column, [10]);+ let mut drawn = widgets(&workbench, &uri_string, cx);+ drawn.sort();+ assert_eq!(drawn.iter().map(|(line, column, _, has_breakpoint)| (*line, *column, *has_breakpoint)).collect::<Vec<_>>(), [(1, 2, true), (1, 10, true)]);+ assert_eq!(placeholders(&workbench, cx), [(1, 0.), (9, 10.8)], "the line breakpoint's widget takes no room");+ std::fs::remove_dir_all(dir).unwrap();+ }++ /// `InlineBreakpointWidget`: a column breakpoint past the line's first column draws inline after a `0.9em`+ /// placeholder; its menu is the breakpoint's, a click enables it when disabled and removes it when enabled.+ #[gpui::test]+ fn a_column_breakpoint_draws_inline_and_toggles_on_click(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = stopped_session(cx, json!({}));+ let (dir, uri, uri_string) = open(&workbench, "let a = f();\n", cx);+ workbench.update(cx, |workbench, cx| {+ workbench.debug.model.add_breakpoints(&uri, vec![BreakpointData { column: Some(9), enabled: false, ..BreakpointData::at(1) }]);+ cx.notify();+ });+ cx.run_until_parked();+ assert_eq!(widgets(&workbench, &uri_string, cx), [(1, 9, "debug-breakpoint-disabled", true)]);+ assert_eq!(placeholders(&workbench, cx), [(8, 10.8)]);++ let bounds = cx.debug_bounds("inline-breakpoint-widget").unwrap();+ let actions = workbench.update_in(cx, |workbench, window, cx| {+ let widget = workbench.debug.inline_breakpoints.widgets[&uri_string][0].clone();+ workbench.show_inline_breakpoint_menu(&uri, &widget, bounds.center(), window, cx);+ workbench.context_menu.take().expect("a context menu shows").levels[0].actions.clone()+ });+ assert_eq!(titles(&actions), ["Remove Breakpoint", "Edit Breakpoint...", "Enable Breakpoint"]);++ click_widget(cx);+ assert_eq!(widgets(&workbench, &uri_string, cx)[0].2, "debug-breakpoint");+ click_widget(cx);+ assert!(workbench.read_with(cx, |workbench, _| workbench.debug.model.breakpoints.is_empty()));+ assert!(placeholders(&workbench, cx).is_empty());+ std::fs::remove_dir_all(dir).unwrap();+ }+}diff --git a/port/ledger.md b/port/ledger.mdindex 077ebcf741e..f566a1f2494 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -530,7 +530,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/contrib/commands | workbench contribution | M9 | verified | | runCommands (commands.rs register_run_commands): cargo test -p app commands::, argument checks, spread args, order, stop at a failure; argument errors and the failure notify (cargo test -p app run_commands_argument_errors_notify) || workbench/contrib/comments | workbench contribution | M13 | verified | | workbench/comments_view.rs, workbench/comment_thread_widget.rs, comment_thread_floating.rs, workbench/comment_thread_floating_layout.rs, workbench/comment_node.rs, workbench/commenting_ranges.rs, workbench/comment_navigation.rs, workbench/editor_view/comment_glyph.rs, multi_diff_editor_view.rs: cargo test -p app comment diff floating room multi_diff comment_thread_floating two_threads_keep_their_reply_forms_open_together a_wrapped_comment_body_grows_its_zone the_reached_thread_takes_the_focus a_markdown_comment_previews_its_first_rendered_block the_filter_keeps_its_history_and_escape_clears_it the_thread_menu_replies_to_the_thread a_comment_s_code_span_draws_no_code_block_background additional_actions_show_under_the_body_and_run_with_the_thread a_commenting_range_is_reached_at_its_columns_unless_it_holds_the_cursor dismissing_a_new_template_keeps_it_open an_expanded_thread_shows_a_zone_and_replies_run_the_form_actions a_comment_switched_to_editing_runs_the_edit_actions rows_sit_in_the_pane_s_inset_with_the_tree_s_indent_and_guides (commentThreadFloatingWidget.test.ts); ui-pair `portComments.openDiff` (modified, original, multi, floating), steps-comment-floating.json, steps-comment-additional.json, steps-comment-escape-typed.json, steps-comment-reply-editor.json, steps-comments.json (port/results/language-features.md Comments, Comment editing and commands, Floating comment threads); cargo test -p app reactions_are_action_items_4px_apart || workbench/contrib/customEditor | workbench contribution | M17 | ported | [3 L] custom_editors.rs: a diff always opens in the text diff editor, where customEditors.ts `createDiffEditorInput` opens a diff of resources matching an editor's selector (`workbench.diffEditorAssociations`, `priority.diffEditor`) as a `CustomEditorDiffInput` (customEditorDiffInput.ts, inline) or a `DiffEditorInput` of two `CustomEditorSideBySideDiffInput`s or `CustomEditorInput`s, with the proposed `customEditorDiffs` capabilities (`supportsInlineDiff`, `supportsSideBySideDiff`, used by markdown-language-features' preview); so `activeCustomEditorTextDiff` (contextkeys.ts) is never set and Reopen as Text (editor.contribution.ts `ReOpenInTextEditorAction`, `enableInModalMode`) is missing from the editor title and the modal header | cargo test -p app custom_editors each_group_s_custom_text_editor_has_its_own_webview a_custom_text_editor_s_navigation_drives_the_outline a_custom_document_open_in_another_group_moves_to_the_active_one a_custom_document_with_multiple_editors_opens_one_more_in_the_active_group a_workspace_association_wins_over_a_user_one_of_the_same_length a_reopened_preview_keeps_its_tab_position two_default_editors_for_a_resource_ask_once_which_to_keep markdown_editor_files_offer; `FIXTURE=custom-editor-tests port/tools/webview-check` 8/8 |-| workbench/contrib/debug | workbench contribution | M16 | ported | [3 M] variable_menu.rs: no View Binary Data: debug.contribution.ts registers it only in the rows' `inline` group, and the port's Variables, Watch and hover rows have no inline action bar, no `vscode-debug-memory` file system and no hex editor install prompt (variablesView.ts `VIEW_MEMORY_ID`) <br> [3 M] debug_editor: no inline breakpoint widgets: neither the candidate dots (breakpointEditorContribution.ts `requestBreakpointCandidateLocations`, `breakpointLocations` request on the breakpoints' lines) nor the `InlineBreakpointWidget` of a column breakpoint (ui-pair `debug/variables-menu.json`, line 5 of app.js) | cargo test -p app debug launch_picker_shrinks the_debug_container_more_actions debug_service a_workbench_hover_draws_over_the_debug_hover the_tree_height_keeps_an_above_hover_off_the_hovered_line watch_expression_labels_use_the_monospace_font debug_view debug_task_runner debug_commands debug_console debug::ansi an_ended_session_stays_in_the_picker_until_cleared_or_started_again a_start_or_restart_saves_the_dirty_editors a_hit_breakpoint_enables_its_dependents debug_inline_values debug_hover alt_click_toggles_the_loaded_subtree a_click_on_a_hover_row_focuses_the_tree a_lazy_row_takes_its_value_from_the_eye_button the_find_widget_filters_the_hover_tree disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints a_right_clicked_call_stack_row_takes_the_list_focus the_debug_toolbar_and_create_configuration_menus_take_contributed_items debug_toolbar variable_menu a_stop_on_a_line_in_view_keeps_the_scroll the_debug_picker_lists_and_starts_the_launch_configurations the_first_scope_expands_only_once_the_variables_view_exists the_find_widget_filters_the_console a_variable_row_draws_its_scopes_indent_guide a_top_frame_past_column_1_injects_the_column_arrow the_call_stack_selects_the_focused_frame_only_after_a_focus_change_it_saw a_visualized_child_shows_its_tree_in_the_hover a_watch_expressions_visualized_child_draws_its_tree a_dynamic_selection_keeps_its_type_for_f5; ui-pair port/fixtures/debug-node (breakpoint, F5, views, REPL, toolbar, `greeting` and `numbers` hovers), menus/view-container-title.json, port/fixtures/ui-pair/debug/hover-find.json, port/fixtures/ui-pair/debug/unverified-breakpoints.json, port/fixtures/ui-pair/debug/call-stack-menu.json, port/fixtures/ui-pair/debug/toolbar.json, port/fixtures/ui-pair/debug/variables-menu.json, port/fixtures/ui-pair/debug/lazy-variable.json, port/fixtures/ui-pair/debug/quick-access.json; shortcuts in port/notes.md |+| workbench/contrib/debug | workbench contribution | M16 | ported | [3 M] variable_menu.rs: no View Binary Data: debug.contribution.ts registers it only in the rows' `inline` group, and the port's Variables, Watch and hover rows have no inline action bar, no `vscode-debug-memory` file system and no hex editor install prompt (variablesView.ts `VIEW_MEMORY_ID`) | cargo test -p app debug launch_picker_shrinks the_debug_container_more_actions debug_service a_workbench_hover_draws_over_the_debug_hover the_tree_height_keeps_an_above_hover_off_the_hovered_line watch_expression_labels_use_the_monospace_font debug_view debug_task_runner debug_commands debug_console debug::ansi an_ended_session_stays_in_the_picker_until_cleared_or_started_again a_start_or_restart_saves_the_dirty_editors a_hit_breakpoint_enables_its_dependents debug_inline_values debug_hover alt_click_toggles_the_loaded_subtree a_click_on_a_hover_row_focuses_the_tree a_lazy_row_takes_its_value_from_the_eye_button the_find_widget_filters_the_hover_tree disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints a_right_clicked_call_stack_row_takes_the_list_focus the_debug_toolbar_and_create_configuration_menus_take_contributed_items debug_toolbar variable_menu a_stop_on_a_line_in_view_keeps_the_scroll the_debug_picker_lists_and_starts_the_launch_configurations the_first_scope_expands_only_once_the_variables_view_exists the_find_widget_filters_the_console a_variable_row_draws_its_scopes_indent_guide a_top_frame_past_column_1_injects_the_column_arrow the_call_stack_selects_the_focused_frame_only_after_a_focus_change_it_saw a_visualized_child_shows_its_tree_in_the_hover a_watch_expressions_visualized_child_draws_its_tree a_dynamic_selection_keeps_its_type_for_f5 inline_breakpoints; ui-pair port/fixtures/debug-node (breakpoint, F5, views, REPL, toolbar, `greeting` and `numbers` hovers), menus/view-container-title.json, port/fixtures/ui-pair/debug/hover-find.json, port/fixtures/ui-pair/debug/unverified-breakpoints.json, port/fixtures/ui-pair/debug/call-stack-menu.json, port/fixtures/ui-pair/debug/toolbar.json, port/fixtures/ui-pair/debug/variables-menu.json, port/fixtures/ui-pair/debug/lazy-variable.json, port/fixtures/ui-pair/debug/quick-access.json; shortcuts in port/notes.md || workbench/contrib/dropOrPasteInto | workbench contribution | M13 | verified | | commands.ts `configurePreferredPasteAction`/`configurePreferredDropAction`: the widgets' menus and the Paste As pick open user settings JSON at `editor.pasteAs.preferences` or `editor.dropIntoEditor.preferences` (workbench/paste_edits.rs); the `editor.pasteAs.*` and `editor.dropIntoEditor.*` settings come from core-settings.json; ui-pair paste-menu (port/results/language-features.md) || workbench/contrib/editSessions | workbench contribution | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/contrib/editTelemetry | workbench contribution | | removed | | no AI or Microsoft services by decision (port/notes.md); API stays inert |diff --git a/port/notes.md b/port/notes.mdindex bf3141c5724..2119addf2fd 100644--- a/port/notes.md+++ b/port/notes.md@@ -881,6 +881,7 @@ Scope as in the M19 Work row of port/ledger.md.- Inline values (`workbench/debug_inline_values.rs`; debugEditorContribution.ts): `debug.inlineValues` `on` or `auto` with a provider shows the focused frame's values as `InjectionOwner::DebugInlineValue` text after the lines, `editor.inlineValuesForeground` on `editor.inlineValuesBackground`. Shortcuts: only the active editor shows them, where upstream decorates every editor on the frame's file; the scopes and variables are fetched again, not shared with the Variables view's cache; the text area width stands in for `layoutInfo.width` in the line length cut.- Debug hover (`workbench/debug_hover.rs`; debugHover.ts, debugEditorContribution.ts hover handling): while stopped, the expression at the mouse in the focused frame's file (the first `EvaluatableExpressionProvider` through `$provideEvaluatableExpression`, else `getExactExpressionStartAndEnd`) is evaluated with `context: "hover"` (or looked up in the cheap scopes without `supportsEvaluateForHovers`) after the doubled `editor.hover.delay`, the editor hover off meanwhile; Alt swaps it for the editor hover; Cmd+K Cmd+I shows it at the cursor. The focused tree takes listWidget.ts's and abstractTree.ts's keys through the `list.*` commands (Up, Down, Page Up, Page Down, Home, End, Left, Right, Space, Enter, type navigation by name), Escape clears a selection before it hides the widget; `layoutTree` sizes the tree to its rows plus 10px, at most max(266px, 55% of the editor) and the hovered line's top less 22px. The visualizers are a ledger gap of workbench/contrib/debug; the context menu is under Variable menus. The glyph margin lifts the editor hover lockout; the hovered position is the nearer edge of the character under the mouse, a tab's middle included. Lazy rows (`presentationHint.lazy`) draw the `$(eye)` button after the name in the hover, Variables and Watch trees; a lazy watch, hover or REPL result is evaluated at once (debugModel.ts `evaluateExpression` without `keepLazyVars`). A click on an expandable row focuses and toggles it; with Alt the descendants whose children are loaded follow, the others stay collapsed (indexTreeModel.ts `_setNodeCollapseState` recursive, asyncDataTree.ts collapsing a stale node a deep expand reaches). `list.find` (Cmd+Alt+F, F3) on the focused tree opens abstractTree.ts's find widget over 30px of padding: highlight or filter mode and fuzzy or contiguous match by `workbench.list.defaultFindMode` and `defaultFindMatchType` and the widget's toggles, the filter keeps a collapsed parent of a loaded match, "No results found.", the focus to the first match from the focused row; it outlives each shown value like the tree, and Escape hides the hover and runs `list.closeFind` after it. ui-pair on `port/fixtures/debug-node` (Cmd+K Cmd+I on `numbers` and `greeting`) matches the reference's placement, tree indent and focus outline.- Call Stack selection (`workbench/debug_view.rs` `call_stack_selects_focus`; callStackView.ts `updateTreeSelection`): the view builds its tree in `renderBody` and selects the focused frame only on a focus change it sees, so a view first shown by `openOnDebugBreak` after the stop has no selected row until the next focus change. Measured with `port/tools/ref-dom` on `port/fixtures/debug-node` app.js: the first stop leaves no `.monaco-list-row.selected`; after Continue to a second breakpoint `global.main app.js 5:2` is selected; with the Run and Debug view shown before the start the first stop selects it too.+- Inline breakpoints (`workbench/inline_breakpoints.rs`; breakpointEditorContribution.ts `setDecorations`, `InlineBreakpointWidget`): a column breakpoint past the line's first column, or sharing its line, draws its icon after a `0.9em` placeholder; with `debug.showInlineBreakpointCandidates` and a focused session that `supportsBreakpointLocationsRequest`, each breakpoint line's `breakpointLocations` answer draws disabled dots (not at the first column without another breakpoint on the line, not past the last). A click adds, removes or enables; a right click shows `getContextMenuActions` at the column. Upstream asks again on every `setDecorations`; the port asks when the focused session, the debug state or a model's breakpoint lines change, keeping the previous dots until the answer (the 500 ms race has no flicker to avoid). Tests: `cargo test -p app inline_breakpoints`.- Variable menus (`workbench/variable_menu.rs`; variablesView.ts `openContextMenuForVariableTreeElement`, watchExpressionsView.ts `onContextMenu`, debugContext.ts `getContextForVariable`): a right-click on a Variables, Watch or hover row opens `DebugVariablesContext`, `DebugWatchContext` or `DebugHoverContext` over the row's keys (`variableEvaluateNamePresent`, `variableIsReadonly`, `variableType`, `watchItemType`, `debugType`), with `{ sessionId, container, variable }` for a variable and `{ watchExpressionId, name }` for a watch expression. Copy Value evaluates `evaluateName || value` again with the `clipboard` context when the debugger supports it, else `variables` or `watch`, and falls back to the shown value. Set Value, View Binary Data and the Break on Value items are left out until their requests are ported (ledger debug row); `canViewMemory` is always false.- Debug Console find (`workbench/debug_console_find.rs`; repl.ts `FindReplAction`, `openFind`): `repl.action.find` (Cmd+Alt+F, the title's `search` before the session picker and Clear Console) opens the tree find widget of the debug hover (`TreeFind`) over the console with 30px of padding; elements are found by `IReplElement.toString(true)`, an evaluation by its input or its result, filter mode drops the elements without a match, evaluation inputs and variable names highlight the matched chars, "No results found." when nothing matches, the pattern is kept for the next open. Shortcuts: the port's console has no row focus, so highlight mode moves no focus to the first match; the item in `MenuId.DebugConsoleContext` waits on that menu, which the port does not have (cargo test -p app the_find_widget_filters_the_console).- Extension host debugging (`extensionHost` launch type; rawDebugSession.ts `launchVsCode`, localProcessExtensionHost.ts `attachSession`, debugService.ts `onAttachSession`): js-debug's `launchVSCode` opens the Extension Development Host window (or reloads the one on the same extension path) with `--debugId`, `--inspect-brk-extensions` and `--extensionEnvironment`; the host it starts has the session attach to the inspector port on a new adapter. Decision: a host with an inspector port runs on Node, since Bun has no V8 inspector; a host without one stays on Bun, and there is no 5870 default port (environmentService.ts gives one to a build from source, which would put every checkout run on Node). The window closes with its current host's exit and at the end of a 'Run Without Debugging' session; a restart reloads it. Check: `cargo test -p app workbench::host::`, ui-pair `debug/extension-host.json` with `FOLDER=port/fixtures/debug-extension` (stops at the breakpoint in `activate`).