Skip to content

Visual Studio Code, rebuilt in Rust

Rust

feat(debug): Set Value and Break on Value in the variable menus

rokarturc3b1b01ecdfc
diff --git a/native/crates/app/src/debug/session.rs b/native/crates/app/src/debug/session.rs
index 296f39af675..1e3400dd1a2 100644
--- a/native/crates/app/src/debug/session.rs
+++ b/native/crates/app/src/debug/session.rs
@@ -109,6 +109,7 @@ pub struct Variable {
pub presentation_hint: Value,
pub named_variables: Option<u64>,
pub indexed_variables: Option<u64>,
+ pub memory_reference: Option<String>,
/// A scope the adapter marks `expensive` starts collapsed.
pub expensive: bool,
/// An evaluation that failed: its message shows in `debugTokenExpression.error`.
@@ -127,6 +128,7 @@ impl Variable {
presentation_hint: variable["presentationHint"].clone(),
named_variables: variable["namedVariables"].as_u64(),
indexed_variables: variable["indexedVariables"].as_u64(),
+ memory_reference: text("memoryReference"),
expensive: variable["expensive"] == true,
error: false,
}
diff --git a/native/crates/app/src/menus.rs b/native/crates/app/src/menus.rs
index 775b22d8379..adda4f3c46e 100644
--- a/native/crates/app/src/menus.rs
+++ b/native/crates/app/src/menus.rs
@@ -506,21 +506,32 @@ const WORKBENCH_MENUS: &[Row] = &[
(MenuId::ExtensionContext, None, "workbench.extensions.action.configureKeybindings", "Keyboard Shortcuts", "2_configure", 2., Some("extensionStatus == 'installed' && extensionHasKeybindings"), None),
(MenuId::ViewContainerTitle, None, "workbench.action.debug.selectandstart", "Start Additional Session", "", 10., Some("viewContainer == 'workbench.view.debug' && debugState != 'inactive' && (config.debug.toolBarLocation == 'docked' || config.debug.hideLauncherWhileDebugging)"), None),
// debug.contribution.ts `registerDebugViewMenuItem(MenuId.DebugVariablesContext/DebugHoverContext/DebugWatchContext, ...)`.
- // shortcut: Set Value, View Binary Data and Break on Value Read/Change/Access wait for their commands (ledger debug row).
+ // shortcut: the `inline` View Binary Data items wait for the rows' action bars (ledger debug row).
+ (MenuId::DebugVariablesContext, None, "debug.setVariable", "Set Value", "3_modification", 10., Some("debugSetVariableSupported || variableEvaluateNamePresent && debugSetExpressionSupported"), Some("!variableIsReadonly")),
(MenuId::DebugVariablesContext, None, "workbench.debug.viewlet.action.copyValue", "Copy Value", "5_cutcopypaste", 10., None, None),
(MenuId::DebugVariablesContext, None, "debug.copyEvaluatePath", "Copy as Expression", "5_cutcopypaste", 20., Some("variableEvaluateNamePresent"), None),
(MenuId::DebugVariablesContext, None, "debug.addToWatchExpressions", "Add to Watch", "z_commands", 100., Some("variableEvaluateNamePresent"), None),
+ (MenuId::DebugVariablesContext, None, "debug.breakWhenValueIsRead", "Break on Value Read", "z_commands", 200., Some("breakWhenValueIsReadSupported"), None),
+ (MenuId::DebugVariablesContext, None, "debug.breakWhenValueChanges", "Break on Value Change", "z_commands", 210., Some("breakWhenValueChangesSupported"), None),
+ (MenuId::DebugVariablesContext, None, "debug.breakWhenValueIsAccessed", "Break on Value Access", "z_commands", 220., Some("breakWhenValueIsAccessedSupported"), None),
(MenuId::DebugHoverContext, None, "workbench.debug.viewlet.action.copyValue", "Copy Value", "5_cutcopypaste", 10., None, None),
(MenuId::DebugHoverContext, None, "debug.copyEvaluatePath", "Copy as Expression", "5_cutcopypaste", 20., Some("variableEvaluateNamePresent"), None),
(MenuId::DebugHoverContext, None, "debug.addToWatchExpressions", "Add to Watch", "z_commands", 100., Some("variableEvaluateNamePresent"), None),
+ (MenuId::DebugHoverContext, None, "debug.breakWhenValueIsRead", "Break on Value Read", "z_commands", 200., Some("breakWhenValueIsReadSupported"), None),
+ (MenuId::DebugHoverContext, None, "debug.breakWhenValueChanges", "Break on Value Change", "z_commands", 210., Some("breakWhenValueChangesSupported"), None),
+ (MenuId::DebugHoverContext, None, "debug.breakWhenValueIsAccessed", "Break on Value Access", "z_commands", 220., Some("breakWhenValueIsAccessedSupported"), None),
(MenuId::DebugWatchContext, None, "workbench.debug.viewlet.action.addWatchExpression", "Add Expression", "3_modification", 10., None, None),
(MenuId::DebugWatchContext, None, "debug.copyWatchExpression", "Copy Expression", "3_modification", 20., Some("watchItemType == 'expression'"), Some("watchExpressionsExist")),
(MenuId::DebugWatchContext, None, "debug.renameWatchExpression", "Edit Expression", "3_modification", 20., Some("watchItemType == 'expression'"), None),
+ (MenuId::DebugWatchContext, None, "debug.setWatchExpression", "Set Value", "3_modification", 30., Some("watchItemType == 'expression' && debugSetExpressionSupported || watchItemType == 'variable' && debugSetVariableSupported"), Some("!variableIsReadonly")),
(MenuId::DebugWatchContext, None, "workbench.debug.viewlet.action.copyValue", "Copy Value", "3_modification", 40., Some("watchItemType == 'expression' || watchItemType == 'variable'"), Some("inDebugMode")),
(MenuId::DebugWatchContext, None, "workbench.debug.viewlet.action.copyAllWatchExpressions", "Copy All", "3_modification", 45., None, Some("watchExpressionsExist")),
(MenuId::DebugWatchContext, None, "debug.copyEvaluatePath", "Copy as Expression", "3_modification", 50., Some("variableEvaluateNamePresent"), Some("inDebugMode")),
(MenuId::DebugWatchContext, None, "debug.removeWatchExpression", "Remove Expression", "inline", 20., Some("watchItemType == 'expression'"), None),
(MenuId::DebugWatchContext, None, "workbench.debug.viewlet.action.removeAllWatchExpressions", "Remove All Expressions", "z_commands", 20., None, None),
+ (MenuId::DebugWatchContext, None, "debug.breakWhenValueIsRead", "Break on Value Read", "z_commands", 200., Some("breakWhenValueIsReadSupported"), None),
+ (MenuId::DebugWatchContext, None, "debug.breakWhenValueChanges", "Break on Value Change", "z_commands", 210., Some("breakWhenValueChangesSupported"), None),
+ (MenuId::DebugWatchContext, None, "debug.breakWhenValueIsAccessed", "Break on Value Access", "z_commands", 220., Some("breakWhenValueIsAccessedSupported"), None),
// output.contribution.ts and viewsService.ts `openCommandActionDescriptor.mnemonicTitle`
(MenuId::EditorContext, None, "workbench.output.action.clearOutput", "Clear Output", "", 0., Some("inOutput"), None),
// markers.contribution.ts: Problems before Output in the panel group.
diff --git a/native/crates/app/src/workbench/debug_commands.rs b/native/crates/app/src/workbench/debug_commands.rs
index 878a4d13cc6..39f0c732db5 100644
--- a/native/crates/app/src/workbench/debug_commands.rs
+++ b/native/crates/app/src/workbench/debug_commands.rs
@@ -487,7 +487,7 @@ impl Workbench {
context.insert("debugType".into(), json!(focused.map(|session| session.session_type()).unwrap_or_default()));
context.insert("focusedSessionIsAttach".into(), json!(focused.is_some_and(|session| session.configuration["request"] == "attach")));
context.insert("focusedSessionIsNoDebug".into(), json!(focused.is_some_and(|session| session.configuration["noDebug"] == true)));
- for (key, capability) in [("terminateDebuggeeSupported", "supportTerminateDebuggee"), ("suspendDebuggeeSupported", "supportSuspendDebuggee"), ("terminateThreadsSupported", "supportsTerminateThreadsRequest")] {
+ for (key, capability) in [("terminateDebuggeeSupported", "supportTerminateDebuggee"), ("suspendDebuggeeSupported", "supportSuspendDebuggee"), ("terminateThreadsSupported", "supportsTerminateThreadsRequest"), ("debugSetVariableSupported", "supportsSetVariable"), ("debugSetExpressionSupported", "supportsSetExpression")] {
context.insert(key.into(), json!(focused.is_some_and(|session| session.capabilities[capability] == true)));
}
context.insert("breakpointsExist".into(), json!(!self.debug.model.breakpoints.is_empty()));
diff --git a/native/crates/app/src/workbench/debug_service.rs b/native/crates/app/src/workbench/debug_service.rs
index de1df65a6f8..e775ada8125 100644
--- a/native/crates/app/src/workbench/debug_service.rs
+++ b/native/crates/app/src/workbench/debug_service.rs
@@ -1054,7 +1054,21 @@ impl Workbench {
if self.debug.children.contains_key(&key) {
return;
}
- self.debug.children.insert(key.clone(), Vec::new());
+ self.debug.children.insert(key, Vec::new());
+ self.request_children(session_id, reference, window, cx);
+ }
+
+ /// debugViewModel.ts `updateViews`: the shown rows and watch values fetched again, each keeping its rows until the reply.
+ pub(crate) fn update_debug_views(&mut self, window: &mut Window, cx: &mut Context<Self>) {
+ let shown: Vec<(String, i64)> = self.debug.children.keys().cloned().collect();
+ for (session_id, reference) in shown {
+ self.request_children(&session_id, reference, window, cx);
+ }
+ self.refresh_focus(window, cx);
+ }
+
+ fn request_children(&mut self, session_id: &str, reference: i64, window: &mut Window, cx: &mut Context<Self>) {
+ let key = (session_id.to_owned(), reference);
let reply = self.dap_request(session_id, "variables", json!({ "variablesReference": reference }));
let auto_expand_lazy = self.auto_expand_lazy_variables();
let session_id = session_id.to_owned();
diff --git a/native/crates/app/src/workbench/debug_view.rs b/native/crates/app/src/workbench/debug_view.rs
index 620e8918f82..5e4221fc6e3 100644
--- a/native/crates/app/src/workbench/debug_view.rs
+++ b/native/crates/app/src/workbench/debug_view.rs
@@ -26,11 +26,15 @@ pub(super) const BREAKPOINTS_VIEW: &str = "workbench.debug.breakPointsView";
pub(super) const LOADED_SCRIPTS_VIEW: &str = "workbench.debug.loadedScriptsView";
pub(super) const DEBUG_WELCOME_VIEW: &str = "workbench.debug.welcome";
-/// The inline input of the Watch or Breakpoints view.
+/// The inline input of the Variables, Watch or Breakpoints view.
#[derive(Clone, Debug, PartialEq)]
pub enum Editing {
NewWatch,
Watch(String),
+ /// A variable's value by its session, parent `variablesReference` and name; `watch` for a row under a watch expression.
+ Variable { session: String, parent_reference: i64, name: String, watch: bool },
+ /// A watch expression's value (`setSelectedExpression(expression, settingWatch: true)`).
+ WatchValue(String),
NewFunctionBreakpoint,
}
@@ -61,6 +65,12 @@ pub struct DebugView {
/// A focus change expands the first scope only when the Variables view exists by then: `renderBody` sets the
/// input it finds without expanding (variablesView.ts).
pub expand_first_scope: bool,
+ /// variablesView.ts `variableInternalContext`: the variable row of the last variable menu, which Set Value edits.
+ pub menu_variable: Option<Editing>,
+ /// debugCommands.ts `dataBreakpointInfoResponse`: the last variable menu's `dataBreakpointInfo` answer.
+ pub data_breakpoint_info: Option<serde_json::Value>,
+ /// `Variable.errorMessage`: the adapter's setVariable error, the input's validation message until it closes.
+ pub edit_error: Option<String>,
}
impl DebugView {
@@ -83,6 +93,9 @@ impl DebugView {
exception: None,
variables_view_created: false,
expand_first_scope: false,
+ menu_variable: None,
+ data_breakpoint_info: None,
+ edit_error: None,
}
}
}
@@ -332,7 +345,7 @@ impl Workbench {
let menu_return = self.context_menu.as_ref().and_then(|menu| menu.focus_to_return.as_ref());
let list_focused = list_focus.is_some_and(|focus| focus.is_focused(window) || menu_return == Some(focus));
let rows = match id {
- VARIABLES_VIEW => self.variables_rows(list_focused, cx),
+ VARIABLES_VIEW => self.variables_rows(list_focused, window, cx),
WATCH_VIEW => self.watch_rows(list_focused, window, cx),
CALL_STACK_VIEW => self.call_stack_rows(list_focused, cx),
BREAKPOINTS_VIEW => self.breakpoint_rows(list_focused, window, cx),
@@ -481,7 +494,7 @@ impl Workbench {
.into_any_element()
}
- fn variables_rows(&self, list_focused: bool, cx: &mut Context<Self>) -> Vec<gpui::AnyElement> {
+ fn variables_rows(&self, list_focused: bool, window: &Window, cx: &mut Context<Self>) -> Vec<gpui::AnyElement> {
let Some(session) = self.debug.focus.session.clone() else { return Vec::new() };
let mut rows = Vec::new();
let first_cheap = self.debug.scopes.iter().position(|scope| !scope.expensive);
@@ -498,29 +511,42 @@ impl Workbench {
.into_any_element(),
);
if expanded {
- self.variable_children(&session, reference, &key, 1, false, list_focused, &mut rows, cx);
+ self.variable_children(&session, reference, &key, 1, false, list_focused, &mut rows, window, cx);
}
}
rows
}
#[allow(clippy::too_many_arguments)]
- fn variable_children(&self, session: &str, reference: i64, parent: &str, depth: usize, in_watch: bool, list_focused: bool, rows: &mut Vec<gpui::AnyElement>, cx: &mut Context<Self>) {
+ fn variable_children(&self, session: &str, reference: i64, parent: &str, depth: usize, in_watch: bool, list_focused: bool, rows: &mut Vec<gpui::AnyElement>, window: &Window, cx: &mut Context<Self>) {
let Some(children) = self.debug.children.get(&(session.to_owned(), reference)) else { return };
for variable in children {
let key = format!("{parent}/{}", variable.name);
let expandable = variable.has_children();
let expanded = expandable && self.row_expanded(&key, false);
let (row_key, session_id, child_reference) = (key.clone(), session.to_owned(), variable.variables_reference);
+ let edit = Editing::Variable { session: session.to_owned(), parent_reference: reference, name: variable.name.clone(), watch: in_watch };
+ if self.debug_view.editing.as_ref() == Some(&edit) {
+ rows.push(self.debug_input_row(key, depth, list_focused, window, cx));
+ continue;
+ }
let lazy_button = variable.is_lazy().then(|| self.lazy_button(session, reference, variable, &key, cx));
let mut row = self.debug_row(key.clone(), depth, expandable.then_some(expanded), self.row_selected(&key), list_focused, cx).child(self.expression_label(variable, &[], lazy_button).font_family(EXPRESSION_FONT).text_size(px(EXPRESSION_FONT_SIZE)));
- if expandable {
- row = row.on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| workbench.toggle_debug_row(&row_key, expanded, &session_id, child_reference, window, cx)));
- }
+ // variablesView.ts `onMouseDblClick`: a variable that `canSetExpressionValue` opens its value's input.
+ let editable = !in_watch && self.can_set_variable_value(variable);
+ row = row.on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| {
+ if editable && event.click_count() == 2 {
+ workbench.start_debug_view_edit(edit.clone(), window, cx);
+ return;
+ }
+ if expandable {
+ workbench.toggle_debug_row(&row_key, expanded, &session_id, child_reference, window, cx);
+ }
+ }));
let (menu_session, menu_variable) = (session.to_owned(), variable.clone());
row = row.on_mouse_down(MouseButton::Right, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| {
let row = if in_watch {
- VariableMenuRow::WatchVariable(menu_variable.clone())
+ VariableMenuRow::WatchVariable { session: menu_session.clone(), parent_reference: reference, variable: menu_variable.clone() }
} else {
VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session: menu_session.clone(), parent_reference: reference, variable: menu_variable.clone() }
};
@@ -528,7 +554,7 @@ impl Workbench {
}));
rows.push(row.into_any_element());
if expanded {
- self.variable_children(session, variable.variables_reference, &key, depth + 1, in_watch, list_focused, rows, cx);
+ self.variable_children(session, variable.variables_reference, &key, depth + 1, in_watch, list_focused, rows, window, cx);
}
}
}
@@ -562,8 +588,8 @@ impl Workbench {
let session = self.debug.focus.session.clone().unwrap_or_default();
for expression in &self.debug.model.watch_expressions {
let key = format!("watch/{}", expression.id);
- if self.debug_view.editing == Some(Editing::Watch(expression.id.clone())) {
- rows.push(self.debug_input_row(key, list_focused, window, cx));
+ if [Some(Editing::Watch(expression.id.clone())), Some(Editing::WatchValue(expression.id.clone()))].contains(&self.debug_view.editing) {
+ rows.push(self.debug_input_row(key, 0, list_focused, window, cx));
continue;
}
let value = self.debug.watch_values.get(&expression.id).cloned().unwrap_or_else(|| Variable { name: expression.name.clone(), value: "not available".into(), ..Variable::default() });
@@ -587,11 +613,11 @@ impl Workbench {
}));
rows.push(row.into_any_element());
if expanded {
- self.variable_children(&session, value.variables_reference, &key, 1, true, list_focused, &mut rows, cx);
+ self.variable_children(&session, value.variables_reference, &key, 1, true, list_focused, &mut rows, window, cx);
}
}
if self.debug_view.editing == Some(Editing::NewWatch) {
- rows.push(self.debug_input_row("watch/new".into(), list_focused, window, cx));
+ rows.push(self.debug_input_row("watch/new".into(), 0, list_focused, window, cx));
}
rows
}
@@ -747,7 +773,7 @@ impl Workbench {
);
}
if self.debug_view.editing == Some(Editing::NewFunctionBreakpoint) {
- rows.push(self.debug_input_row("function/new".into(), list_focused, window, cx));
+ rows.push(self.debug_input_row("function/new".into(), 0, list_focused, window, cx));
}
for breakpoint in &model.breakpoints {
let id = breakpoint.id().to_owned();
@@ -842,10 +868,14 @@ impl Workbench {
pub(super) fn start_debug_view_edit(&mut self, editing: Editing, window: &mut Window, cx: &mut Context<Self>) {
let mut input = InputBox::default();
- if let Editing::Watch(id) = &editing
- && let Some(expression) = self.debug.model.watch_expressions.iter().find(|expression| expression.id == *id)
- {
- input.set_value(expression.name.clone());
+ let initial_value = match &editing {
+ Editing::Watch(id) => self.debug.model.watch_expressions.iter().find(|expression| expression.id == *id).map(|expression| expression.name.clone()),
+ Editing::WatchValue(id) => self.debug.watch_values.get(id).map(|value| value.value.clone()),
+ Editing::Variable { session, parent_reference, name, .. } => self.debug.children.get(&(session.clone(), *parent_reference)).and_then(|children| children.iter().find(|child| child.name == *name)).map(|variable| variable.value.clone()),
+ Editing::NewWatch | Editing::NewFunctionBreakpoint => None,
+ };
+ if let Some(value) = initial_value {
+ input.set_value(value);
input.select_all();
}
self.debug_view.input = input;
@@ -854,14 +884,34 @@ impl Workbench {
cx.notify();
}
- /// The inline input of the Watch and Breakpoints views: Enter accepts, Escape cancels, as the trees'
- /// `renderInputBox` does.
- fn debug_input_row(&self, key: String, list_focused: bool, window: &Window, cx: &mut Context<Self>) -> gpui::AnyElement {
+ /// The inline input of the Variables, Watch and Breakpoints views: Enter accepts, Escape cancels, as the trees'
+ /// `renderInputBox` does; a failed setVariable's message shows under it (inputBox.css `.monaco-inputbox-message`).
+ fn debug_input_row(&self, key: String, depth: usize, list_focused: bool, window: &Window, cx: &mut Context<Self>) -> gpui::AnyElement {
let focused = self.debug_view.input_focus.is_focused(window);
- let border = self.color("focusBorder");
- self.debug_row(key, 0, None, false, list_focused, cx)
+ let error = self.debug_view.edit_error.as_ref().filter(|_| matches!(self.debug_view.editing, Some(Editing::Variable { .. })));
+ let border = self.color(if error.is_some() { "inputValidation.errorBorder" } else { "focusBorder" });
+ let message = error.map(|message| {
+ // Deferred, so it paints over the rows below as the reference's context view does.
+ gpui::deferred(
+ div()
+ .absolute()
+ .top(px(21.))
+ .left_0()
+ .right_0()
+ .p(px(4.8))
+ .text_size(px(12.))
+ .line_height(px(17.))
+ .bg(self.color("inputValidation.errorBackground"))
+ .text_color(self.foreground_or("inputValidation.errorForeground"))
+ .border_1()
+ .border_color(border)
+ .child(message.clone()),
+ )
+ });
+ self.debug_row(key, depth, None, false, list_focused, cx)
.child(
div()
+ .relative()
.flex_1()
.h(px(20.))
.mr(px(4.))
@@ -874,16 +924,19 @@ impl Workbench {
"enter" => workbench.accept_debug_view_input(window, cx),
"escape" => {
workbench.debug_view.editing = None;
+ workbench.debug_view.edit_error = None;
cx.notify();
}
_ => {}
}))
- .child(self.input_text(InputId::DebugView, InputLook { password: false, placeholder: None, focused }, cx)),
+ .child(self.input_text(InputId::DebugView, InputLook { password: false, placeholder: None, focused }, cx))
+ .children(message),
)
.into_any_element()
}
fn accept_debug_view_input(&mut self, window: &mut Window, cx: &mut Context<Self>) {
+ self.debug_view.edit_error = None;
let value = self.debug_view.input.value.trim().to_owned();
match self.debug_view.editing.take() {
Some(Editing::NewWatch) if !value.is_empty() => _ = self.debug.model.add_watch_expression(&value),
@@ -893,6 +946,10 @@ impl Workbench {
let change = self.debug.model.add_function_breakpoint(&value, &json!({}), None);
self.breakpoints_changed(change, true, cx);
}
+ Some(target @ (Editing::Variable { .. } | Editing::WatchValue(_))) => {
+ let value = self.debug_view.input.value.clone();
+ return self.set_variable_value(target, value, window, cx);
+ }
_ => {}
}
self.store_debug_model();
diff --git a/native/crates/app/src/workbench/variable_menu.rs b/native/crates/app/src/workbench/variable_menu.rs
index e52b7c192c4..fd082434a6b 100644
--- a/native/crates/app/src/workbench/variable_menu.rs
+++ b/native/crates/app/src/workbench/variable_menu.rs
@@ -8,7 +8,10 @@ use gpui::{Bounds, ClipboardItem, Context, Pixels, Window};
use serde_json::{Value, json};
use super::Workbench;
+use super::debug_service::answer;
+use super::debug_view::Editing;
use crate::commands::Outcome;
+use crate::debug::DataBreakpoint;
use crate::debug::session::Variable;
use crate::menus::{MenuId, menu_group_actions};
@@ -18,35 +21,91 @@ pub(super) enum VariableMenuRow {
Variable { menu: MenuId, session: String, parent_reference: i64, variable: Variable },
/// A Watch view root: the watch expression's id and name.
WatchExpression { id: String, name: String },
- /// A Watch view row under an expression.
- WatchVariable(Variable),
+ /// A Watch view row under an expression: its session, the parent's `variablesReference` and the variable.
+ WatchVariable { session: String, parent_reference: i64, variable: Variable },
}
impl Workbench {
+ /// variablesView.ts `openContextMenuForVariableTreeElement` and watchExpressionsView.ts `onContextMenu`: a session
+ /// that `supportsDataBreakpoints` answers `dataBreakpointInfo` first, which sets the Break on Value items' keys.
pub(super) fn show_variable_menu(&mut self, row: VariableMenuRow, anchor: Bounds<Pixels>, window: &mut Window, cx: &mut Context<Self>) {
+ if let VariableMenuRow::Variable { variable, .. } = &row
+ && variable.value.is_empty()
+ {
+ return;
+ }
+ self.debug_view.menu_variable = match &row {
+ VariableMenuRow::Variable { session, parent_reference, variable, .. } => Some(Editing::Variable { session: session.clone(), parent_reference: *parent_reference, name: variable.name.clone(), watch: false }),
+ VariableMenuRow::WatchVariable { session, parent_reference, variable } => Some(Editing::Variable { session: session.clone(), parent_reference: *parent_reference, name: variable.name.clone(), watch: true }),
+ VariableMenuRow::WatchExpression { .. } => None,
+ };
+ let Some((session_id, arguments)) = self.data_breakpoint_info_arguments(&row) else {
+ return self.open_variable_menu(&row, None, anchor, window, cx);
+ };
+ let reply = self.dap_request(&session_id, "dataBreakpointInfo", arguments);
+ cx.spawn_in(window, async move |workbench, cx| {
+ let info = match answer(reply).await {
+ Ok(info) => info,
+ // The Variables view's menu does not open on a failed request; the Watch view's opens without the items.
+ Err(_) if matches!(row, VariableMenuRow::Variable { .. }) => return,
+ Err(_) => Value::Null,
+ };
+ let _ = workbench.update_in(cx, |workbench, window, cx| {
+ workbench.debug_view.data_breakpoint_info = Some(info.clone());
+ workbench.open_variable_menu(&row, Some(&info), anchor, window, cx);
+ });
+ })
+ .detach();
+ }
+
+ fn open_variable_menu(&mut self, row: &VariableMenuRow, data_breakpoint_info: Option<&Value>, anchor: Bounds<Pixels>, window: &mut Window, cx: &mut Context<Self>) {
let mut context = self.key_context(window);
- let Some((menu, args)) = self.variable_menu_context(&row, &mut context) else { return };
+ if let Some(info) = data_breakpoint_info {
+ insert_data_breakpoint_keys(info, &mut context);
+ }
+ let (menu, args) = self.variable_menu_context(row, &mut context);
let actions = menu_group_actions(&self.menus, menu, &context, |group| group != "inline");
self.show_context_menu_actions(actions, &context, anchor, args, window, cx);
}
+ /// variablesView.ts `getContextForVariableMenuWithDataAccess` and watchExpressionsView.ts
+ /// `getContextForWatchExpressionMenuWithDataAccess`: the `dataBreakpointInfo` request of the row's session.
+ fn data_breakpoint_info_arguments(&self, row: &VariableMenuRow) -> Option<(String, Value)> {
+ let session = match row {
+ VariableMenuRow::Variable { session, .. } | VariableMenuRow::WatchVariable { session, .. } => self.debug.session(session),
+ VariableMenuRow::WatchExpression { .. } => self.debug.focused_session(),
+ }?;
+ if session.capabilities["supportsDataBreakpoints"] != true {
+ return None;
+ }
+ let mut arguments = match row {
+ VariableMenuRow::Variable { parent_reference, variable, .. } => return Some((session.id.clone(), json!({ "name": variable.name, "variablesReference": parent_reference }))),
+ VariableMenuRow::WatchExpression { name, .. } => json!({ "name": name }),
+ VariableMenuRow::WatchVariable { variable, .. } if variable.evaluate_name.as_deref().is_some_and(|name| !name.is_empty()) => json!({ "name": variable.evaluate_name }),
+ VariableMenuRow::WatchVariable { parent_reference, variable, .. } => json!({ "name": variable.name, "variablesReference": parent_reference }),
+ };
+ if let Some(frame) = self.debug.focus.frame {
+ arguments["frameId"] = json!(frame);
+ }
+ Some((session.id.clone(), arguments))
+ }
+
/// debugContext.ts `getContextForVariable` or watchExpressionsView.ts `getContextForWatchExpressionMenu` into
/// `context`, and the menu with its command argument.
- // shortcut: no `dataBreakpointInfo` request, so the Break on Value items' keys stay unset (ledger debug row).
- pub(super) fn variable_menu_context(&self, row: &VariableMenuRow, context: &mut HashMap<String, Value>) -> Option<(MenuId, Vec<Value>)> {
+ pub(super) fn variable_menu_context(&self, row: &VariableMenuRow, context: &mut HashMap<String, Value>) -> (MenuId, Vec<Value>) {
let session = match row {
VariableMenuRow::Variable { session, .. } => self.debug.session(session),
_ => self.debug.focused_session(),
};
context.insert("debugType".into(), session.map_or(Value::Null, |session| session.configuration["type"].clone()));
- // shortcut: variables keep no `memoryReference`, so View Binary Data never shows (ledger debug row).
- context.insert("canViewMemory".into(), json!(false));
let (variable, evaluate_name_present) = match row {
VariableMenuRow::Variable { variable, .. } => (Some(variable), variable.evaluate_name.is_some()),
// `'evaluateName' in expression`: a Variable always declares the field, an Expression never.
- VariableMenuRow::WatchVariable(variable) => (Some(variable), true),
- VariableMenuRow::WatchExpression { .. } => (None, false),
+ VariableMenuRow::WatchVariable { variable, .. } => (Some(variable), true),
+ VariableMenuRow::WatchExpression { id, .. } => (self.debug.watch_values.get(id), false),
};
+ let supports_read_memory = session.is_some_and(|session| session.capabilities["supportsReadMemoryRequest"] == true);
+ context.insert("canViewMemory".into(), json!(supports_read_memory && variable.is_some_and(|variable| variable.memory_reference.is_some())));
context.insert("variableEvaluateNamePresent".into(), json!(evaluate_name_present));
if let Some(variable) = variable {
let hint = &variable.presentation_hint;
@@ -56,27 +115,127 @@ impl Workbench {
}
match row {
VariableMenuRow::Variable { menu, session, parent_reference, variable } => {
- // `openContextMenuForVariableTreeElement` skips a variable without a value.
- if variable.value.is_empty() {
- return None;
- }
context.insert("debugProtocolVariableMenuContext".into(), json!(""));
// `getVariablesContext`; shortcut: the container is its `variablesReference` only, not the scope's or variable's protocol object.
let args = json!({ "sessionId": session, "container": { "variablesReference": parent_reference }, "variable": protocol_variable(variable) });
- Some((*menu, vec![args]))
+ (*menu, vec![args])
}
VariableMenuRow::WatchExpression { id, name } => {
context.insert("watchItemType".into(), json!("expression"));
- Some((MenuId::DebugWatchContext, vec![json!({ "watchExpressionId": id, "name": name })]))
+ (MenuId::DebugWatchContext, vec![json!({ "watchExpressionId": id, "name": name })])
}
- VariableMenuRow::WatchVariable(variable) => {
+ VariableMenuRow::WatchVariable { variable, .. } => {
context.insert("watchItemType".into(), json!("variable"));
- Some((MenuId::DebugWatchContext, vec![protocol_variable(variable)]))
+ (MenuId::DebugWatchContext, vec![protocol_variable(variable)])
}
}
}
+ /// variablesView.ts `canSetExpressionValue`.
+ pub(super) fn can_set_variable_value(&self, variable: &Variable) -> bool {
+ let Some(session) = self.debug.focused_session() else { return false };
+ if session.capabilities["supportsSetVariable"] != true && session.capabilities["supportsSetExpression"] != true {
+ return false;
+ }
+ let hint = &variable.presentation_hint;
+ !hint["attributes"].as_array().is_some_and(|attributes| attributes.iter().any(|attribute| attribute == "readOnly")) && hint["lazy"] != true
+ }
+
+ /// The input's `onFinish`: variablesView.ts `VariablesRenderer` runs debugModel.ts `Variable.setVariable` on a
+ /// changed value, watchExpressionsView.ts `setExpression` on a non-empty one; then `updateViews`.
+ pub(super) fn set_variable_value(&mut self, target: Editing, value: String, window: &mut Window, cx: &mut Context<Self>) {
+ let (Some(focused), Some(frame)) = (self.debug.focused_session(), self.debug.focus.frame) else { return };
+ let (supports_set_variable, supports_set_expression, focused_id) = (focused.capabilities["supportsSetVariable"] == true, focused.capabilities["supportsSetExpression"] == true, focused.id.clone());
+ let (session_id, command, arguments, edited) = match &target {
+ Editing::WatchValue(id) => {
+ let Some(expression) = self.debug.model.watch_expressions.iter().find(|expression| expression.id == *id) else { return };
+ if value.is_empty() {
+ return;
+ }
+ (focused_id, "setExpression", json!({ "expression": expression.name, "value": value, "frameId": frame }), None)
+ }
+ Editing::Variable { session, parent_reference, name, watch } => {
+ let key = (session.clone(), *parent_reference);
+ let Some(variable) = self.debug.children.get(&key).and_then(|children| children.iter().find(|child| child.name == *name)) else { return };
+ let evaluate_name = variable.evaluate_name.clone().filter(|name| !name.is_empty());
+ let set_expression = *watch || (supports_set_expression && !supports_set_variable && evaluate_name.is_some());
+ if (*watch && value.is_empty()) || (!*watch && variable.value == value) {
+ return;
+ }
+ match (set_expression, evaluate_name) {
+ (true, None) => return,
+ (true, Some(expression)) => (session.clone(), "setExpression", json!({ "expression": expression, "value": value, "frameId": frame }), Some((key, name.clone()))),
+ (false, _) => (session.clone(), "setVariable", json!({ "variablesReference": parent_reference, "name": name, "value": value }), Some((key, name.clone()))),
+ }
+ }
+ _ => return,
+ };
+ let reply = self.dap_request(&session_id, command, arguments);
+ cx.spawn_in(window, async move |workbench, cx| {
+ let result = answer(reply).await;
+ // `setVariable` keeps the adapter's error as `errorMessage`; a failed `setExpression` rejects and nothing updates.
+ if result.is_err() && command == "setExpression" {
+ return;
+ }
+ let _ = workbench.update_in(cx, |workbench, window, cx| {
+ match (result, edited) {
+ (Ok(body), Some((key, name))) => {
+ if let Some(variable) = workbench.debug.children.get_mut(&key).and_then(|children| children.iter_mut().find(|child| child.name == name)) {
+ apply_set_response(variable, &body);
+ }
+ }
+ (Ok(_), None) => {}
+ (Err(message), _) => {
+ workbench.start_debug_view_edit(target, window, cx);
+ workbench.debug_view.edit_error = Some(message);
+ }
+ }
+ workbench.update_debug_views(window, cx);
+ });
+ })
+ .detach();
+ }
+
pub(super) fn register_variable_menu_commands(&mut self) {
+ // variablesView.ts SET_VARIABLE_ID on `variableInternalContext`, the row the menu opened on.
+ // shortcut: without an argument (Enter in the Variables view) it does nothing; the views keep no list focus.
+ self.commands.register("debug.setVariable", |workbench, args, window, cx| {
+ if args.is_empty() {
+ return Outcome::done();
+ }
+ if let Some(target) = workbench.debug_view.menu_variable.clone() {
+ workbench.start_debug_view_edit(target, window, cx);
+ }
+ Outcome::done()
+ });
+ // debugCommands.ts SET_EXPRESSION_COMMAND_ID: the value of the watch expression or of the Watch row under it.
+ self.commands.register("debug.setWatchExpression", |workbench, args, window, cx| {
+ let target = match args.first().and_then(|arg| arg["watchExpressionId"].as_str()) {
+ Some(id) => Some(Editing::WatchValue(id.to_owned())),
+ None => workbench.debug_view.menu_variable.clone(),
+ };
+ if let Some(target) = target {
+ workbench.start_debug_view_edit(target, window, cx);
+ }
+ Outcome::done()
+ });
+ // debugCommands.ts BREAK_WHEN_VALUE_IS_READ_ID, BREAK_WHEN_VALUE_CHANGES_ID and BREAK_WHEN_VALUE_IS_ACCESSED_ID.
+ for (id, access_type) in [("debug.breakWhenValueIsRead", "read"), ("debug.breakWhenValueChanges", "write"), ("debug.breakWhenValueIsAccessed", "readWrite")] {
+ self.commands.register(id, move |workbench, _, _, cx| {
+ let Some(info) = workbench.debug_view.data_breakpoint_info.clone().filter(|info| !info.is_null()) else { return Outcome::done() };
+ let breakpoint = DataBreakpoint {
+ base: crate::debug::base_breakpoint(crate::debug::generate_uuid(), &json!({})),
+ description: info["description"].as_str().unwrap_or_default().to_owned(),
+ data_id: info["dataId"].as_str().unwrap_or_default().to_owned(),
+ can_persist: info["canPersist"] == true,
+ access_type: access_type.to_owned(),
+ access_types: Some(info["accessTypes"].clone()).filter(|types| !types.is_null()),
+ };
+ let change = workbench.debug.model.add_data_breakpoint(breakpoint);
+ workbench.breakpoints_changed(change, true, cx);
+ Outcome::done()
+ });
+ }
// variablesView.ts COPY_VALUE_ID: the expression's or variable's value evaluated again, else the shown value.
// shortcut: without an argument (Cmd+C in the views) it copies nothing; the views keep no tree selection to read.
self.commands.register("workbench.debug.viewlet.action.copyValue", |workbench, args, window, cx| {
@@ -159,9 +318,40 @@ fn protocol_variable(variable: &Variable) -> Value {
"presentationHint": variable.presentation_hint,
"namedVariables": variable.named_variables,
"indexedVariables": variable.indexed_variables,
+ "memoryReference": variable.memory_reference,
})
}
+/// debugModel.ts `handleSetResponse`.
+fn apply_set_response(variable: &mut Variable, body: &Value) {
+ variable.value = body["value"].as_str().unwrap_or_default().to_owned();
+ if let Some(type_name) = body["type"].as_str() {
+ variable.type_name = Some(type_name.to_owned());
+ }
+ variable.variables_reference = body["variablesReference"].as_i64().unwrap_or(0);
+ variable.named_variables = body["namedVariables"].as_u64();
+ variable.indexed_variables = body["indexedVariables"].as_u64();
+ variable.memory_reference = body["memoryReference"].as_str().map(str::to_owned);
+}
+
+/// The Break on Value keys of a `dataBreakpointInfo` answer: Change alone without `accessTypes`.
+fn insert_data_breakpoint_keys(info: &Value, context: &mut HashMap<String, Value>) {
+ let supported = json!(info["dataId"].is_string());
+ let Some(access_types) = info["accessTypes"].as_array() else {
+ context.insert("breakWhenValueChangesSupported".into(), supported);
+ return;
+ };
+ for access_type in access_types {
+ let key = match access_type.as_str() {
+ Some("read") => "breakWhenValueIsReadSupported",
+ Some("write") => "breakWhenValueChangesSupported",
+ Some("readWrite") => "breakWhenValueIsAccessedSupported",
+ _ => continue,
+ };
+ context.insert(key.into(), supported.clone());
+ }
+}
+
/// COPY_VALUE_ID's `element.evaluateName || element.value`.
fn evaluate_name_or_value(variable: &Value) -> Value {
match variable["evaluateName"].as_str() {
@@ -189,37 +379,17 @@ mod tests {
/// `getContextForVariable` and `getContextForWatchExpressionMenu`, and variablesView.ts's commands on the row.
#[gpui::test]
fn a_variable_row_menu_shows_its_items_and_runs_them_on_the_row(cx: &mut TestAppContext) {
- let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
- let themes = exthost::scan::scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
- let theme = crate::theme::load_theme(&[themes], "Dark Modern").unwrap();
- let (sender, host) = std::sync::mpsc::channel::<HostMessage>();
- let (workbench, cx) = cx.add_window_view(|_, cx| Workbench::new(theme, app_root.clone(), None, crate::languages::Languages::new(&[]), crate::default_settings(), crate::host_sync::HostSync::new(sender), cx));
- workbench.update_in(cx, |workbench, _, _| {
- let mut session = crate::debug::session::Session::new("s".into(), 1, json!({ "name": "s", "type": "node", "request": "launch" }), json!({}), None, json!({}));
- session.initialized = true;
- session.capabilities = json!({ "supportsClipboardContext": true });
- workbench.debug.sessions.push(session);
- workbench.debug.focus = super::super::debug_service::DebugFocus { session: Some("s".into()), thread: Some(1), frame: Some(9) };
- });
- let titles = |row: VariableMenuRow, cx: &mut gpui::VisualTestContext| {
- workbench.update_in(cx, |workbench, window, cx| {
- workbench.show_variable_menu(row, Bounds::default(), window, cx);
- let Some(menu) = workbench.context_menu.take() else { return Vec::new() };
- menu.levels[0].actions.iter().map(|action| match action {
- MenuAction::Command { title, .. } => title.clone(),
- _ => "-".to_owned(),
- }).collect::<Vec<_>>()
- })
- };
+ let (workbench, cx, host) = stopped_session(cx, json!({ "supportsClipboardContext": true }));
+ let titles = |row: VariableMenuRow, cx: &mut gpui::VisualTestContext| menu_titles(&workbench, row, cx);
let row = |menu: MenuId, variable: Variable| VariableMenuRow::Variable { menu, session: "s".into(), parent_reference: 4, variable };
assert_eq!(titles(row(MenuId::DebugVariablesContext, variable("x", "1", Some("obj.x"))), cx), ["Copy Value", "Copy as Expression", "-", "Add to Watch"]);
assert_eq!(titles(row(MenuId::DebugVariablesContext, variable("x", "1", None)), cx), ["Copy Value"]);
assert_eq!(titles(row(MenuId::DebugHoverContext, variable("x", "1", Some("obj.x"))), cx), ["Copy Value", "Copy as Expression", "-", "Add to Watch"]);
assert!(titles(row(MenuId::DebugVariablesContext, variable("x", "", Some("obj.x"))), cx).is_empty(), "a variable without a value has no menu");
assert_eq!(titles(VariableMenuRow::WatchExpression { id: "w".into(), name: "a + b".into() }, cx), ["Add Expression", "Copy Expression", "Edit Expression", "Copy Value", "Copy All", "-", "Remove All Expressions"]);
- assert_eq!(titles(VariableMenuRow::WatchVariable(variable("x", "1", None)), cx), ["Add Expression", "Copy Value", "Copy All", "Copy as Expression", "-", "Remove All Expressions"]);
+ assert_eq!(titles(VariableMenuRow::WatchVariable { session: "s".into(), parent_reference: 5, variable: variable("x", "1", None) }, cx), ["Add Expression", "Copy Value", "Copy All", "Copy as Expression", "-", "Remove All Expressions"]);
- let args = |row: VariableMenuRow, cx: &mut gpui::VisualTestContext| workbench.read_with(cx, |workbench, _| workbench.variable_menu_context(&row, &mut HashMap::new()).unwrap().1);
+ let args = |row: VariableMenuRow, cx: &mut gpui::VisualTestContext| workbench.read_with(cx, |workbench, _| workbench.variable_menu_context(&row, &mut HashMap::new()).1);
let variable_args = args(row(MenuId::DebugVariablesContext, variable("x", "1", Some("obj.x"))), cx);
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("debug.copyEvaluatePath", variable_args.clone(), window, cx)));
assert_eq!(cx.read_from_clipboard().and_then(|item| item.text()).as_deref(), Some("obj.x"));
@@ -234,12 +404,9 @@ mod tests {
host.try_iter().for_each(drop);
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.debug.viewlet.action.copyValue", variable_args, window, cx)));
cx.run_until_parked();
- let request = host.try_iter().filter(|message| message.method == "$sendDAMessage").map(|message| message.args[1].clone()).find(|request| request["command"] == "evaluate").expect("an evaluate request");
+ let request = sent_request(&host, "evaluate");
assert_eq!(request["arguments"], json!({ "expression": "obj.x", "frameId": 9, "context": "clipboard" }));
- let response = json!({ "type": "response", "seq": 0, "request_seq": request["seq"], "success": true, "command": "evaluate", "body": { "result": "{ x: 1 }", "variablesReference": 0 } });
- let accept = ForwardedRequest { req: 1, proxy: "MainThreadDebugService", method: "$acceptDAMessage".into(), args: vec![json!(1), response] };
- workbench.update_in(cx, |workbench, window, cx| drop(workbench.handle_debug_request(accept, window, cx)));
- cx.run_until_parked();
+ respond(&workbench, cx, &request, true, json!({ "result": "{ x: 1 }", "variablesReference": 0 }));
assert_eq!(cx.read_from_clipboard().and_then(|item| item.text()).as_deref(), Some("{ x: 1 }"));
assert_eq!(args(VariableMenuRow::WatchExpression { id: "w".into(), name: "a + b".into() }, cx), [json!({ "watchExpressionId": "w", "name": "a + b" })]);
@@ -247,4 +414,122 @@ mod tests {
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("debug.removeWatchExpression", vec![json!({ "watchExpressionId": id, "name": "obj.x" })], window, cx)));
assert!(workbench.read_with(cx, |workbench, _| workbench.debug.model.watch_expressions.is_empty()));
}
+
+ /// variablesView.ts SET_VARIABLE_ID and `VariablesRenderer.getInputBoxOptions`: Set Value opens the row's input, which
+ /// sends `setVariable` and takes the answer, or keeps the adapter's error as the input's message.
+ #[gpui::test]
+ fn set_value_edits_a_variable_through_set_variable(cx: &mut TestAppContext) {
+ let (workbench, cx, host) = stopped_session(cx, json!({ "supportsSetVariable": true }));
+ workbench.update_in(cx, |workbench, _, _| drop(workbench.debug.children.insert(("s".into(), 4), vec![variable("x", "1", Some("obj.x"))])));
+ let row = || VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session: "s".into(), parent_reference: 4, variable: variable("x", "1", Some("obj.x")) };
+ assert_eq!(menu_titles(&workbench, row(), cx), ["Set Value", "-", "Copy Value", "Copy as Expression", "-", "Add to Watch"]);
+
+ let args = workbench.read_with(cx, |workbench, _| workbench.variable_menu_context(&row(), &mut HashMap::new()).1);
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("debug.setVariable", args, window, cx)));
+ let edit = Editing::Variable { session: "s".into(), parent_reference: 4, name: "x".into(), watch: false };
+ assert_eq!(workbench.read_with(cx, |workbench, _| (workbench.debug_view.editing.clone(), workbench.debug_view.input.value.clone())), (Some(edit.clone()), "1".to_owned()));
+
+ cx.run_until_parked();
+ host.try_iter().for_each(drop);
+ workbench.update_in(cx, |workbench, window, cx| workbench.set_variable_value(edit.clone(), "2".into(), window, cx));
+ cx.run_until_parked();
+ let request = sent_request(&host, "setVariable");
+ assert_eq!(request["arguments"], json!({ "variablesReference": 4, "name": "x", "value": "2" }));
+ respond(&workbench, cx, &request, true, json!({ "value": "2", "type": "number" }));
+ let x = workbench.read_with(cx, |workbench, _| workbench.debug.children[&("s".to_owned(), 4)][0].clone());
+ assert_eq!((x.value.as_str(), x.type_name.as_deref()), ("2", Some("number")));
+
+ workbench.update_in(cx, |workbench, window, cx| workbench.set_variable_value(edit.clone(), "nope".into(), window, cx));
+ cx.run_until_parked();
+ let request = sent_request(&host, "setVariable");
+ respond(&workbench, cx, &request, false, json!({ "error": { "id": 1, "format": "Invalid value" } }));
+ assert_eq!(workbench.read_with(cx, |workbench, _| (workbench.debug_view.editing.clone(), workbench.debug_view.edit_error.is_some())), (Some(edit), true));
+ }
+
+ /// debugCommands.ts SET_EXPRESSION_COMMAND_ID and watchExpressionsView.ts's `settingValue` input: `setExpression` on
+ /// the watch expression in the focused frame.
+ #[gpui::test]
+ fn set_value_of_a_watch_expression_sends_set_expression(cx: &mut TestAppContext) {
+ let (workbench, cx, host) = stopped_session(cx, json!({ "supportsSetExpression": true }));
+ let id = workbench.update_in(cx, |workbench, _, _| {
+ workbench.debug.model.add_watch_expression("a");
+ workbench.debug.model.watch_expressions[0].id.clone()
+ });
+ let row = VariableMenuRow::WatchExpression { id: id.clone(), name: "a".into() };
+ assert!(menu_titles(&workbench, row, cx).contains(&"Set Value".to_owned()));
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("debug.setWatchExpression", vec![json!({ "watchExpressionId": id, "name": "a" })], window, cx)));
+ let editing = workbench.read_with(cx, |workbench, _| workbench.debug_view.editing.clone());
+ assert_eq!(editing, Some(Editing::WatchValue(id)));
+
+ cx.run_until_parked();
+ host.try_iter().for_each(drop);
+ workbench.update_in(cx, |workbench, window, cx| workbench.set_variable_value(editing.unwrap(), "3".into(), window, cx));
+ cx.run_until_parked();
+ assert_eq!(sent_request(&host, "setExpression")["arguments"], json!({ "expression": "a", "value": "3", "frameId": 9 }));
+ }
+
+ /// variablesView.ts `getContextForVariableMenuWithDataAccess`: the `dataBreakpointInfo` answer's access types show
+ /// their Break on Value items, which add a data breakpoint of that access type.
+ #[gpui::test]
+ fn break_on_value_items_follow_data_breakpoint_info(cx: &mut TestAppContext) {
+ let (workbench, cx, host) = stopped_session(cx, json!({ "supportsDataBreakpoints": true }));
+ cx.run_until_parked();
+ host.try_iter().for_each(drop);
+ let row = VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session: "s".into(), parent_reference: 4, variable: variable("x", "1", None) };
+ workbench.update_in(cx, |workbench, window, cx| workbench.show_variable_menu(row, Bounds::default(), window, cx));
+ cx.run_until_parked();
+ let request = sent_request(&host, "dataBreakpointInfo");
+ assert_eq!(request["arguments"], json!({ "name": "x", "variablesReference": 4 }));
+ respond(&workbench, cx, &request, true, json!({ "dataId": "d1", "description": "x", "accessTypes": ["read", "write"], "canPersist": false }));
+ let titles = workbench.update_in(cx, |workbench, _, _| {
+ let menu = workbench.context_menu.take().expect("the menu opens after the answer");
+ menu.levels[0].actions.iter().filter_map(|action| match action {
+ MenuAction::Command { title, .. } => Some(title.clone()),
+ _ => None,
+ }).collect::<Vec<_>>()
+ });
+ assert_eq!(titles, ["Copy Value", "Break on Value Read", "Break on Value Change"]);
+
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("debug.breakWhenValueChanges", Vec::new(), window, cx)));
+ let added = workbench.read_with(cx, |workbench, _| workbench.debug.model.data_breakpoints.iter().map(|breakpoint| (breakpoint.data_id.clone(), breakpoint.access_type.clone(), breakpoint.description.clone())).collect::<Vec<_>>());
+ assert_eq!(added, [("d1".to_owned(), "write".to_owned(), "x".to_owned())]);
+ }
+
+ fn stopped_session(cx: &mut TestAppContext, capabilities: Value) -> (gpui::Entity<Workbench>, &mut gpui::VisualTestContext, std::sync::mpsc::Receiver<HostMessage>) {
+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
+ let themes = exthost::scan::scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
+ let theme = crate::theme::load_theme(&[themes], "Dark Modern").unwrap();
+ let (sender, host) = std::sync::mpsc::channel::<HostMessage>();
+ let (workbench, cx) = cx.add_window_view(|_, cx| Workbench::new(theme, app_root.clone(), None, crate::languages::Languages::new(&[]), crate::default_settings(), crate::host_sync::HostSync::new(sender), cx));
+ workbench.update_in(cx, |workbench, _, _| {
+ let mut session = crate::debug::session::Session::new("s".into(), 1, json!({ "name": "s", "type": "node", "request": "launch" }), json!({}), None, json!({}));
+ session.initialized = true;
+ session.capabilities = capabilities;
+ workbench.debug.sessions.push(session);
+ workbench.debug.focus = super::super::debug_service::DebugFocus { session: Some("s".into()), thread: Some(1), frame: Some(9) };
+ });
+ (workbench, cx, host)
+ }
+
+ fn menu_titles(workbench: &gpui::Entity<Workbench>, row: VariableMenuRow, cx: &mut gpui::VisualTestContext) -> Vec<String> {
+ workbench.update_in(cx, |workbench, window, cx| {
+ workbench.show_variable_menu(row, Bounds::default(), window, cx);
+ let Some(menu) = workbench.context_menu.take() else { return Vec::new() };
+ menu.levels[0].actions.iter().map(|action| match action {
+ MenuAction::Command { title, .. } => title.clone(),
+ _ => "-".to_owned(),
+ }).collect()
+ })
+ }
+
+ fn sent_request(host: &std::sync::mpsc::Receiver<HostMessage>, command: &str) -> Value {
+ host.try_iter().filter(|message| message.method == "$sendDAMessage").map(|message| message.args[1].clone()).find(|request| request["command"] == command).unwrap_or_else(|| panic!("a {command} request"))
+ }
+
+ fn respond(workbench: &gpui::Entity<Workbench>, cx: &mut gpui::VisualTestContext, request: &Value, success: bool, body: Value) {
+ let response = json!({ "type": "response", "seq": 0, "request_seq": request["seq"], "success": success, "command": request["command"], "message": body["error"]["format"], "body": body });
+ let accept = ForwardedRequest { req: 1, proxy: "MainThreadDebugService", method: "$acceptDAMessage".into(), args: vec![json!(1), response] };
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.handle_debug_request(accept, window, cx)));
+ cx.run_until_parked();
+ }
}
diff --git a/port/ledger.md b/port/ledger.md
index 76104a2edcd..4e111ff554a 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -475,7 +475,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 | ported | [3 M] comment_thread_widget.rs: no commentThreadAdditionalActions.ts (`comments/commentThread/additionalActions`): the separator and secondary button bar under the body, submenus as ButtonWithDropdown, at most 4, counted in the zone height and the floating widths <br> [3 S] comment_node.rs: with a comment in edit, its reactions row sits about 3px left of the reference's (port/results/language-features.md, `steps-comment-menus.json` shot `editing`) | Done: a reply and an edit form per thread and comment, open together (commentReply.ts per CommentThreadWidget): cargo test -p app two_threads_keep_their_reply_forms_open_together; a zone sized by the drawn comment bodies: cargo test -p app a_wrapped_comment_body_grows_its_zone; next/previous thread and Focus Comment on Current Line focus the thread's comments (`commentFocused`, Up/Down between comments, Escape collapses and selects the range): cargo test -p app the_reached_thread_takes_the_focus. Done in diff editors: glyphs, commenting ranges (asked for every side of every multi diff file), range highlights and zones on both sides of the diff editor and of each multi diff file, the other side aligned by a diagonal fill (workbench/editor_view/diff_editor_view.rs, multi_diff_editor_view.rs, diff_editor.rs `additional_heights`): cargo test -p app diff comment; ui-pair `portComments.openDiff` modified, original and multi. Floating widgets on a diff's original side and on both sides of each multi diff file (comment_thread_floating.rs `FloatingHost`, multi_diff_editor_view.rs `multi_diff_floating_hosts`), with `FloatingWidgetRoom` growing a file below its last line (commentThreadFloatingWidgetRoom.ts, `FileDiff.room`): cargo test -p app floating room multi_diff; ui-pair `portComments.openDiff` original and multi with the floating style. Range decorations (commentThreadRangeDecorator.ts and the floating empty-range line, workbench/comment_thread_widget.rs `comment_range_highlights`): cargo test -p app comment_thread_floating. The floating thread style (`comments.thread.experimental.style: floating`; workbench/comment_thread_floating_layout.rs with commentThreadFloatingWidget.test.ts ported, workbench/comment_thread_floating.rs: placement beside the code or its lines in code order, the outline and connector, title drag, edge resize, double-click reset, the layout kept per thread, wheel to the editor): cargo test -p app comment_thread_floating, ui-pair steps-comment-floating.json (port/results/language-features.md Floating comment threads). Done: the Comments panel (workbench/comments_view.rs: resources, threads with author, relative time, first line, range and replies, the unresolved badge, a markdown preview's images as "Image: {alt}" (cargo test -p app a_markdown_comment_previews_its_first_rendered_block), the filter box with Show Resolved/Unresolved and Sort By, its history in the memento's `filterHistory`, Escape and Cmd+Down while `commentsFilterFocus` (cargo test -p app the_filter_keeps_its_history_and_escape_clears_it; no match highlights, as commentsTreeViewer.ts's renderers ignore the filter data), Collapse/Expand All, row selection and keys; hideIfEmpty; a thread row's `commentsView/commentThread/context` inline actions and context menu with the built-in Reply, which reveals the thread with its zone expanded and reply open: cargo test -p app the_thread_menu_replies_to_the_thread), the gutter glyph that toggles the thread (workbench/editor_view/comment_glyph.rs) and the thread widget (workbench/comment_thread_widget.rs: zone, state colors, head with `comments/commentThread/title` actions and Collapse, markdown comments with `code` spans on no `textCodeBlock.background` (cargo test -p app a_comment_s_code_span_draws_no_code_block_background), reply form with `comments/commentThread/context` buttons and Cmd+Enter), each comment (workbench/comment_node.rs: `comments/comment/title` actions, edit mode with `comments/comment/context` buttons, reactions and their picker), commenting ranges with the add glyph, Add Comment and template threads (workbench/commenting_ranges.rs), the comment commands (workbench/comment_navigation.rs: Collapse/Expand All, Expand Unresolved, Toggle Editor Commenting, Focus Comment on Current Line, Dismiss Comment, next/previous thread, commented range and commenting range, reached at the provider's columns unless it holds the cursor: cargo test -p app a_commenting_range_is_reached_at_its_columns_unless_it_holds_the_cursor) and the comments accessibility help: cargo test -p app comment; ui-pair port/results/language-features.md (Comments, Comment editing and commands); Escape keeps a new template open as the reference does (ui-pair steps-comment-escape-typed.json, cargo test -p app dismissing_a_new_template_keeps_it_open). The reply and edit inputs are code editors (simpleCommentEditor.ts: a `comment`-scheme markdown model, word wrap, no glyph margin, line numbers or folding, `scrollBeyondLastLine` false, 5 to 25 lines by `calculateEditorHeight`) that take the focus with `commentEditorFocused`, Cmd+Enter submits and Escape hides; the host gets the input's document and no text editor (workbench/comment_thread_widget.rs `open_comment_editor`, workbench/editor.rs `comment_editor`): cargo test -p app an_expanded_thread_shows_a_zone_and_replies_run_the_form_actions a_comment_switched_to_editing_runs_the_edit_actions; ui-pair steps-comment-reply-editor.json (reply-empty, reply-lines, reply-grown). Comments panel rows: 4px pane inset, 4px radius and the tree's indent guides as the Problems tree (cargo test -p app rows_sit_in_the_pane_s_inset_with_the_tree_s_indent_and_guides; ui-pair steps-comments.json: chevron, name and thread line at the reference's x and y) |
| workbench/contrib/customEditor | workbench contribution | M17 | verified | | Each editor of a custom text editor's resource, the one opened in another group and a split's copy, has a webview of its own (customEditorInput.ts: cargo test -p app each_group_s_custom_text_editor_has_its_own_webview); Opening a custom text editor with `options.selection` reveals it in the panel and leaves the text model's cursor (cargo test -p app a_custom_text_editor_s_navigation_drives_the_outline); A custom document open in another group moves to the active one, or with `supportsMultipleEditorsPerDocument` gets a second editor there (editorResolverService.ts `moveExistingEditorForResource`: cargo test -p app 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); `workbench.editorAssociations` merged as editorResolverService.ts `getAllUserAssociationsForSetting`: the workspace's globs before the default's and user's (cargo test -p app a_workspace_association_wins_over_a_user_one_of_the_same_length); Reopen Editor With puts a closed custom or notebook editor's replacement in its place, pinned (editorGroupView.ts `replaceEditors`: cargo test -p app a_reopened_preview_keeps_its_tab_position); Two default editors for one resource warn once and remember the choice per extension glob (editorResolverService.ts `doHandleConflictingDefaults`: cargo test -p app two_default_editors_for_a_resource_ask_once_which_to_keep); the memento's custom editors until the extensions register (cargo test -p app markdown_editor_files_offer); editor resolution by `workbench.editorAssociations` and contributed selectors (editorResolverService.ts ranks), Reopen Editor With picker (`reopenActiveEditorWith`, `workbench.action.reopenWithEditor`), `_workbench.open`, `_workbench.openWith`; `FIXTURE=custom-editor-tests port/tools/webview-check` 8/8; cargo test -p app custom_editors |
-| workbench/contrib/debug | workbench contribution | M16 | ported | [3 S] breakpoint_widget.rs:246: a breakpoint on the stopped line draws the full breakpoint circle inside the stack frame outline where debug.contribution.css's `--vscode-icon-debug-stackframe-dot` overlay draws a small dot (ui-pair `debug/call-stack-menu.json` stopped.png, line 5) <br> [3 S] debug: the Run and Debug activity item shows no badge while stopped where the reference shows "1" (ui-pair `debug/call-stack-menu.json` stopped.png; its source not traced) <br> [3 M] variable_menu.rs: Set Value (Variables and Watch), View Binary Data and Break on Value Read/Change/Access are not in the variable menus: no `setVariable`/`setExpression` edit, no `memoryReference` kept on a variable, no `dataBreakpointInfo` request (ui-pair `debug/variables-menu.json` shows Set Value in the reference's Watch menu) <br> [3 S] variable_menu.rs: Copy Value, Copy Expression, Edit Expression and Remove Expression from their keys (Cmd+C, Cmd+Alt+C, Enter, Cmd+Backspace in the views) do nothing: the views keep no tree selection to act on <br> [3 S] variable_menu.rs: a Variables row's menu passes `container` as `{ variablesReference }` only, where variablesView.ts `getVariablesContext` passes the scope's or parent variable's protocol object <br> [3 L] debug visualizers: debugVisualizers.ts, `VisualizedExpression` rows in the Variables view and the hover not ported <br> [3 S] lazy variables: the port's side of ui-pair `debug/lazy-variable.json` eye-hover.png, the eye button's "Click to expand" hover over the debug hover, not yet taken (the Studio's GUI lane stopped at a system prompt); a gpui test covers it <br> [3 S] debug_hover.rs: the hover's find widget starts about 20px right of the reference's and is narrower, and a name matching the find draws on a red box where the reference only recolors it (ui-pair `debug/hover-find.json` hover-find.png) <br> [3 S] debug_view.rs: the Run and Debug container title reads "Run and De..." where the reference reads "Run And D..." (ui-pair `menus/view-container-title.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] view_visibility.rs: the Run and Debug container's `...` menu has no "Debug Console" item and separator above the view toggles, and its button shows no pressed background while the menu is open (ui-pair `menus/view-container-title.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 M] debug_toolbar.rs: debugToolBar.ts's Focus Session select box (`FocusSessionActionViewItem`, `multiSessionDebug`), the Stop button's `MenuId.DebugToolBarStop` dropdown, Alt over Stop or Disconnect showing its alt command, the docked toolbar in the Run and Debug title (`debug.toolBarLocation` docked) and the Command Center's Debug submenu (`commandCenter`) are not drawn <br> [3 S] debug_service.rs: `guess_debugger`'s Select Debugger picker has no "More {0} options..." picks of the dynamic configuration providers (debugAdapterManager.ts `getDynamicProviders`), which the port does not have <br> [3 S] debugQuickAccess.ts: the picker has no dynamic configuration providers' `{label}...` picks with the `contributed` description, where the reference lists `Node.js...` (ui-pair `debug/quick-access.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] debug_service.rs: a stop opens the Run and Debug view for any reason, where debugSession.ts opens it only for `reason === 'breakpoint'`: at the `debugger;` of port/fixtures/debug-node/lazy.js the reference stays on the Explorer (ui-pair `debug/lazy-variable.json`) <br> [3 S] debug_view.rs: scope rows (`Local: main`, `Global`) draw in the regular weight where debugViewlet.css `.debug-pane .scope` sets bold (ui-pair `debug/variables-menu.json`) <br> [3 M] debug_editor: the stopped line has no `debug-top-stack-frame-column` inline arrow before the frame's column (callStackEditorContribution.ts `makeStackFrameColumnDecoration`) and no inline breakpoint candidate dots (breakpointEditorContribution.ts, `breakpointLocations` request), and the glyph of a breakpoint the frame stops on draws a red filled shape where the reference draws the yellow outlined stack frame with a small red dot (ui-pair `debug/variables-menu.json`, line 5 of app.js) <br> [3 S] debug_toolbar.rs: the floating toolbar draws at the window's top over the title bar where the reference's sits below it over the editor tabs (ui-pair `debug/variables-menu.json`) | ui-pair port/fixtures/debug-node: gutter breakpoint, F5 stops at it, Variables (Local: main), Call Stack with folded deemphasized frames, Breakpoints, Debug Console REPL, toolbar, status bar entry; cargo test -p app debug; the launch picker shrinks to an ellipsis beside a `flex: 1` title (cargo test -p app launch_picker_shrinks; ui-pair menus/view-container-title.json); the container's `...` menu opens below the button, left aligned in a left side bar (cargo test -p app the_debug_container_more_actions); Select Debugger groups the Suggested debuggers and ends with Install, and a file without a debugger offers to find one (cargo test -p app debug_service); own getters come as lazy rows whose `$(eye)` button matches the reference's (ui-pair `debug/lazy-variable.json` hover.png), and the workbench hover draws over the debug hover (cargo test -p app a_workbench_hover_draws_over_the_debug_hover); a complex hover's tree height counts the editor's top in its group, six rows above line 3 of app.js as the reference (cargo test -p app the_tree_height_keeps_an_above_hover_off_the_hovered_line; ui-pair `debug/hover-find.json`); Call Stack frame names, Variables, Watch and hover rows' expression labels in 11px Menlo (cargo test -p app watch_expression_labels_use_the_monospace_font; ui-pair `debug/call-stack-menu.json` stopped.png); Breakpoints header `$(warning)` hint for the debugger's `strings.unverifiedBreakpoints` after breakpointsView.ts's 4s `hintDelayer`, restarted by every breakpoint change (cargo test -p app debug_view; ui-pair port/fixtures/ui-pair/debug/unverified-breakpoints.json with js-debug's unbound math.test.js breakpoint); preLaunchTask, postDebugTask, compound preLaunchTask and the restart tasks through debugTaskRunner.ts's runner with `debug.onTaskErrors`, the remembered task error choice and the slow task notification (cargo test -p app debug_task_runner); Run to Cursor's temporary breakpoint with debugService.ts `runTo`'s 2s verification wait, thread choice from the sessions that verified it, and removal at the next stop or session end (cargo test -p app debug_commands); Debug Console output styled by its SGR sequences with the theme's ANSI colors at contrast 4 (cargo test -p app debug_console debug::ansi); Debug Console filter box (replFilter.ts terms, "Showing N of M" badge, Cmd+F `repl.action.filter`, value and history in workspace storage) and session picker (consoles of the sessions with `hasSeparateRepl`, `mergeWithParent` children in the parent's, selection focuses the session or its stopped child), input history in workspace storage (`debug.repl.history`) (cargo test -p app debug_console); ended sessions stay inactive in the console picker with their output until Clear Console or a start of the same configuration (debugModel.ts `addSession`, repl.ts `sessionsToIgnore`; cargo test -p app an_ended_session_stays_in_the_picker_until_cleared_or_started_again); debugUtils.ts `saveAllBeforeDebugStart` before a start (not for a child session or with `suppressSaveBeforeStart`) and a restart, by `debug.saveBeforeStart` (cargo test -p app a_start_or_restart_saves_the_dirty_editors); triggered breakpoints: debugSession.ts `enableDependentBreakpoints` by `hitBreakpointIds` or the top frame's position sets `sessionsDidTrigger` and sends the files again, continue and the steps wait for it up to 1.5 s (`waitForTriggeredBreakpoints`), a restart clears it (cargo test -p app a_hit_breakpoint_enables_its_dependents); `debug.inlineValues` after the focused frame's lines: the `InlineValuesProvider`s' values (`$provideInlineValues`) or the most specific scopes' variables named on each line, their `formatHoverContent` hover, the 100ms removal on continue (cargo test -p app debug_inline_values); debugHover.ts in place of the editor hover while a frame is focused in the file: the `$provideEvaluatableExpression` range or the dotted path under the mouse, `hover` evaluation or the scopes' variable, Cmd+K Cmd+I focused, Alt for the editor hover, the tree's list keys, Alt+click and Alt+Space toggling the loaded subtree (abstractTree.ts `onSpace`: cargo test -p app alt_click_toggles_the_loaded_subtree), a row click's tree focus, selection and twistie toggle (abstractTree.ts `onViewPointer`: cargo test -p app a_click_on_a_hover_row_focuses_the_tree) and `layoutTree` height, the glyph margin's lockout release, the caret edge nearer the mouse, lazy rows' `$(eye)` button (baseDebugView.ts `lazyButton`, `debug.autoExpandLazyVariables`; cargo test -p app a_lazy_row_takes_its_value_from_the_eye_button), the tree's find widget (abstractTree.ts `FindController`: cargo test -p app the_find_widget_filters_the_hover_tree; ui-pair port/fixtures/ui-pair/debug/hover-find.json) (cargo test -p app debug_hover; ui-pair port/fixtures/debug-node `greeting` and `numbers` hovers); disassemblyView.ts: the `disassemble` requests around the focused frame's instruction pointer, the glyph click's instruction breakpoint (`setInstructionBreakpoints`), the Breakpoints view's instruction rows, `instruction` stepping granularity while the view is active, the table's focus on reload, the list keys' focus, selection and clear, Page Up/Down over the rows' own heights, the hover column border (cargo test -p app disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints); Call Stack: js-debug's compact child session merged into its parent's row with modernUI's capitalized state label, the folded frames' common source `origin` (callStackView.ts `CallStackCompressionDelegate`, `ShowMoreRenderer`: cargo test -p app debug_view), the frame's `line:column` count badge and the trees' list focus a right click moves to them (cargo test -p app a_right_clicked_call_stack_row_takes_the_list_focus); the floating toolbar from `MenuId.DebugToolBar` with the extensions' `debug/toolBar` items, and `debug/createConfiguration` items in Select Debugger (cargo test -p app the_debug_toolbar_and_create_configuration_menus_take_contributed_items; ui-pair port/fixtures/ui-pair/debug/call-stack-menu.json); Variables, Watch and hover row context menus (debug.contribution.ts `DebugVariablesContext`, `DebugWatchContext`, `DebugHoverContext`, watchExpressionsView.ts Copy Expression and Copy All: cargo test -p app variable_menu; ui-pair port/fixtures/ui-pair/debug/variables-menu.json); a stop reveals its line centered only when outside the view, after the editor's first layout (debugSource.ts `openInEditor` `CenterIfOutsideViewport`: cargo test -p app a_stop_on_a_line_in_view_keeps_the_scroll; ui-pair port/fixtures/ui-pair/debug/lazy-variable.json); debugQuickAccess.ts `debug ` picks: the launch configurations by folder with Most Recent, their gear to launch.json, Add Configuration..., and Debug: Select and Start Debugging opening it (cargo test -p app the_debug_picker_lists_and_starts_the_launch_configurations; ui-pair port/fixtures/ui-pair/debug/quick-access.json); the first cheap scope expands on a focus change only once the Variables view has shown, as variablesView.ts `renderBody` sets its first input unexpanded (cargo test -p app the_first_scope_expands_only_once_the_variables_view_exists; ui-pair port/fixtures/ui-pair/debug/variables-menu.json `Local: main` collapsed in both); shortcuts in port/notes.md |
+| workbench/contrib/debug | workbench contribution | M16 | ported | [3 S] breakpoint_widget.rs:246: a breakpoint on the stopped line draws the full breakpoint circle inside the stack frame outline where debug.contribution.css's `--vscode-icon-debug-stackframe-dot` overlay draws a small dot (ui-pair `debug/call-stack-menu.json` stopped.png, line 5) <br> [3 S] debug: the Run and Debug activity item shows no badge while stopped where the reference shows "1" (ui-pair `debug/call-stack-menu.json` stopped.png; its source not traced) <br> [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 S] debug status bar: the debug entry reads "Launch server.js" where the reference reads "Launch server.js (debug-node)" (ui-pair `debug/variables-menu.json` watch-menu.png; its source not traced) <br> [3 S] debug: while stopped the panel shows a Problems tab beside Debug Console where the reference shows Debug Console alone (ui-pair `debug/variables-menu.json` watch-menu.png; its source not traced) <br> [3 S] variable_menu.rs: Copy Value, Copy Expression, Edit Expression and Remove Expression from their keys (Cmd+C, Cmd+Alt+C, Enter, Cmd+Backspace in the views) do nothing: the views keep no tree selection to act on <br> [3 S] variable_menu.rs: a Variables row's menu passes `container` as `{ variablesReference }` only, where variablesView.ts `getVariablesContext` passes the scope's or parent variable's protocol object <br> [3 L] debug visualizers: debugVisualizers.ts, `VisualizedExpression` rows in the Variables view and the hover not ported <br> [3 S] lazy variables: the port's side of ui-pair `debug/lazy-variable.json` eye-hover.png, the eye button's "Click to expand" hover over the debug hover, not yet taken (the Studio's GUI lane stopped at a system prompt); a gpui test covers it <br> [3 S] debug_hover.rs: the hover's find widget starts about 20px right of the reference's and is narrower, and a name matching the find draws on a red box where the reference only recolors it (ui-pair `debug/hover-find.json` hover-find.png) <br> [3 S] debug_view.rs: the Run and Debug container title reads "Run and De..." where the reference reads "Run And D..." (ui-pair `menus/view-container-title.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] view_visibility.rs: the Run and Debug container's `...` menu has no "Debug Console" item and separator above the view toggles, and its button shows no pressed background while the menu is open (ui-pair `menus/view-container-title.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 M] debug_toolbar.rs: debugToolBar.ts's Focus Session select box (`FocusSessionActionViewItem`, `multiSessionDebug`), the Stop button's `MenuId.DebugToolBarStop` dropdown, Alt over Stop or Disconnect showing its alt command, the docked toolbar in the Run and Debug title (`debug.toolBarLocation` docked) and the Command Center's Debug submenu (`commandCenter`) are not drawn <br> [3 S] debug_service.rs: `guess_debugger`'s Select Debugger picker has no "More {0} options..." picks of the dynamic configuration providers (debugAdapterManager.ts `getDynamicProviders`), which the port does not have <br> [3 S] debugQuickAccess.ts: the picker has no dynamic configuration providers' `{label}...` picks with the `contributed` description, where the reference lists `Node.js...` (ui-pair `debug/quick-access.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] debug_service.rs: a stop opens the Run and Debug view for any reason, where debugSession.ts opens it only for `reason === 'breakpoint'`: at the `debugger;` of port/fixtures/debug-node/lazy.js the reference stays on the Explorer (ui-pair `debug/lazy-variable.json`) <br> [3 S] debug_view.rs: scope rows (`Local: main`, `Global`) draw in the regular weight where debugViewlet.css `.debug-pane .scope` sets bold (ui-pair `debug/variables-menu.json`) <br> [3 M] debug_editor: the stopped line has no `debug-top-stack-frame-column` inline arrow before the frame's column (callStackEditorContribution.ts `makeStackFrameColumnDecoration`) and no inline breakpoint candidate dots (breakpointEditorContribution.ts, `breakpointLocations` request), and the glyph of a breakpoint the frame stops on draws a red filled shape where the reference draws the yellow outlined stack frame with a small red dot (ui-pair `debug/variables-menu.json`, line 5 of app.js) <br> [3 S] debug_toolbar.rs: the floating toolbar draws at the window's top over the title bar where the reference's sits below it over the editor tabs (ui-pair `debug/variables-menu.json`) | ui-pair port/fixtures/debug-node: gutter breakpoint, F5 stops at it, Variables (Local: main), Call Stack with folded deemphasized frames, Breakpoints, Debug Console REPL, toolbar, status bar entry; cargo test -p app debug; the launch picker shrinks to an ellipsis beside a `flex: 1` title (cargo test -p app launch_picker_shrinks; ui-pair menus/view-container-title.json); the container's `...` menu opens below the button, left aligned in a left side bar (cargo test -p app the_debug_container_more_actions); Select Debugger groups the Suggested debuggers and ends with Install, and a file without a debugger offers to find one (cargo test -p app debug_service); own getters come as lazy rows whose `$(eye)` button matches the reference's (ui-pair `debug/lazy-variable.json` hover.png), and the workbench hover draws over the debug hover (cargo test -p app a_workbench_hover_draws_over_the_debug_hover); a complex hover's tree height counts the editor's top in its group, six rows above line 3 of app.js as the reference (cargo test -p app the_tree_height_keeps_an_above_hover_off_the_hovered_line; ui-pair `debug/hover-find.json`); Call Stack frame names, Variables, Watch and hover rows' expression labels in 11px Menlo (cargo test -p app watch_expression_labels_use_the_monospace_font; ui-pair `debug/call-stack-menu.json` stopped.png); Breakpoints header `$(warning)` hint for the debugger's `strings.unverifiedBreakpoints` after breakpointsView.ts's 4s `hintDelayer`, restarted by every breakpoint change (cargo test -p app debug_view; ui-pair port/fixtures/ui-pair/debug/unverified-breakpoints.json with js-debug's unbound math.test.js breakpoint); preLaunchTask, postDebugTask, compound preLaunchTask and the restart tasks through debugTaskRunner.ts's runner with `debug.onTaskErrors`, the remembered task error choice and the slow task notification (cargo test -p app debug_task_runner); Run to Cursor's temporary breakpoint with debugService.ts `runTo`'s 2s verification wait, thread choice from the sessions that verified it, and removal at the next stop or session end (cargo test -p app debug_commands); Debug Console output styled by its SGR sequences with the theme's ANSI colors at contrast 4 (cargo test -p app debug_console debug::ansi); Debug Console filter box (replFilter.ts terms, "Showing N of M" badge, Cmd+F `repl.action.filter`, value and history in workspace storage) and session picker (consoles of the sessions with `hasSeparateRepl`, `mergeWithParent` children in the parent's, selection focuses the session or its stopped child), input history in workspace storage (`debug.repl.history`) (cargo test -p app debug_console); ended sessions stay inactive in the console picker with their output until Clear Console or a start of the same configuration (debugModel.ts `addSession`, repl.ts `sessionsToIgnore`; cargo test -p app an_ended_session_stays_in_the_picker_until_cleared_or_started_again); debugUtils.ts `saveAllBeforeDebugStart` before a start (not for a child session or with `suppressSaveBeforeStart`) and a restart, by `debug.saveBeforeStart` (cargo test -p app a_start_or_restart_saves_the_dirty_editors); triggered breakpoints: debugSession.ts `enableDependentBreakpoints` by `hitBreakpointIds` or the top frame's position sets `sessionsDidTrigger` and sends the files again, continue and the steps wait for it up to 1.5 s (`waitForTriggeredBreakpoints`), a restart clears it (cargo test -p app a_hit_breakpoint_enables_its_dependents); `debug.inlineValues` after the focused frame's lines: the `InlineValuesProvider`s' values (`$provideInlineValues`) or the most specific scopes' variables named on each line, their `formatHoverContent` hover, the 100ms removal on continue (cargo test -p app debug_inline_values); debugHover.ts in place of the editor hover while a frame is focused in the file: the `$provideEvaluatableExpression` range or the dotted path under the mouse, `hover` evaluation or the scopes' variable, Cmd+K Cmd+I focused, Alt for the editor hover, the tree's list keys, Alt+click and Alt+Space toggling the loaded subtree (abstractTree.ts `onSpace`: cargo test -p app alt_click_toggles_the_loaded_subtree), a row click's tree focus, selection and twistie toggle (abstractTree.ts `onViewPointer`: cargo test -p app a_click_on_a_hover_row_focuses_the_tree) and `layoutTree` height, the glyph margin's lockout release, the caret edge nearer the mouse, lazy rows' `$(eye)` button (baseDebugView.ts `lazyButton`, `debug.autoExpandLazyVariables`; cargo test -p app a_lazy_row_takes_its_value_from_the_eye_button), the tree's find widget (abstractTree.ts `FindController`: cargo test -p app the_find_widget_filters_the_hover_tree; ui-pair port/fixtures/ui-pair/debug/hover-find.json) (cargo test -p app debug_hover; ui-pair port/fixtures/debug-node `greeting` and `numbers` hovers); disassemblyView.ts: the `disassemble` requests around the focused frame's instruction pointer, the glyph click's instruction breakpoint (`setInstructionBreakpoints`), the Breakpoints view's instruction rows, `instruction` stepping granularity while the view is active, the table's focus on reload, the list keys' focus, selection and clear, Page Up/Down over the rows' own heights, the hover column border (cargo test -p app disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints); Call Stack: js-debug's compact child session merged into its parent's row with modernUI's capitalized state label, the folded frames' common source `origin` (callStackView.ts `CallStackCompressionDelegate`, `ShowMoreRenderer`: cargo test -p app debug_view), the frame's `line:column` count badge and the trees' list focus a right click moves to them (cargo test -p app a_right_clicked_call_stack_row_takes_the_list_focus); the floating toolbar from `MenuId.DebugToolBar` with the extensions' `debug/toolBar` items, and `debug/createConfiguration` items in Select Debugger (cargo test -p app the_debug_toolbar_and_create_configuration_menus_take_contributed_items; ui-pair port/fixtures/ui-pair/debug/call-stack-menu.json); Variables, Watch and hover row context menus (debug.contribution.ts `DebugVariablesContext`, `DebugWatchContext`, `DebugHoverContext`, watchExpressionsView.ts Copy Expression and Copy All, Set Value through `setVariable` or `setExpression` with the adapter's error under the input, Break on Value Read/Change/Access from the `dataBreakpointInfo` answer: cargo test -p app variable_menu; ui-pair port/fixtures/ui-pair/debug/variables-menu.json); a stop reveals its line centered only when outside the view, after the editor's first layout (debugSource.ts `openInEditor` `CenterIfOutsideViewport`: cargo test -p app a_stop_on_a_line_in_view_keeps_the_scroll; ui-pair port/fixtures/ui-pair/debug/lazy-variable.json); debugQuickAccess.ts `debug ` picks: the launch configurations by folder with Most Recent, their gear to launch.json, Add Configuration..., and Debug: Select and Start Debugging opening it (cargo test -p app the_debug_picker_lists_and_starts_the_launch_configurations; ui-pair port/fixtures/ui-pair/debug/quick-access.json); the first cheap scope expands on a focus change only once the Variables view has shown, as variablesView.ts `renderBody` sets its first input unexpanded (cargo test -p app the_first_scope_expands_only_once_the_variables_view_exists; ui-pair port/fixtures/ui-pair/debug/variables-menu.json `Local: main` collapsed in both); 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 |