Skip to content

Visual Studio Code, rebuilt in Rust

Rust

feat(debug): add the Variables, Watch and hover row context menus

rokartur02bc9d80ceec
diff --git a/native/crates/app/src/menus.rs b/native/crates/app/src/menus.rs
index 488636c02ac..1e038717636 100644
--- a/native/crates/app/src/menus.rs
+++ b/native/crates/app/src/menus.rs
@@ -121,6 +121,12 @@ pub enum MenuId {
TestItem,
/// `MenuId.DebugCallStackContext`: a Call Stack row's context menu.
DebugCallStackContext,
+ /// `MenuId.DebugVariablesContext`: a Variables row's context menu.
+ DebugVariablesContext,
+ /// `MenuId.DebugWatchContext`: a Watch row's context menu.
+ DebugWatchContext,
+ /// `MenuId.DebugHoverContext`: a debug hover tree row's context menu.
+ DebugHoverContext,
/// timeline.contribution.ts "Filter Timeline": a toggle per timeline source.
TimelineFilterSubMenu,
ViewTitle,
@@ -450,6 +456,22 @@ const WORKBENCH_MENUS: &[Row] = &[
(MenuId::DebugCallStackContext, None, "workbench.action.debug.restartFrame", "Restart Frame", "navigation", 10., Some("callStackItemType == 'stackFrame' && restartFrameSupported"), Some("stackFrameSupportsRestart")),
(MenuId::DebugCallStackContext, None, "debug.copyStackTrace", "Copy Call Stack", "3_modification", 20., Some("callStackItemType == 'stackFrame'"), None),
(MenuId::DebugCallStackContext, None, "debug.action.openDisassemblyView", "Open Disassembly View", "z_commands", 50., Some("inDebugMode && debugState == 'stopped' && callStackItemType == 'stackFrame' && disassembleRequestSupported"), Some("focusedStackFrameHasInstructionReference")),
+ // 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).
+ (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::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::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, "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),
// 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.
@@ -874,7 +896,7 @@ pub fn workbench_menus() -> Vec<MenuItem> {
/// menusExtensionPoint.ts `apiMenus`: the `contributes.menus` keys of the menus the port shows. `commandPalette`
/// is read by `command_palette::menu`.
-const API_MENUS: [(&str, MenuId); 42] = [
+const API_MENUS: [(&str, MenuId); 44] = [
("file/newFile", MenuId::NewFile),
("editor/context", MenuId::EditorContext),
("explorer/context", MenuId::ExplorerContext),
@@ -903,6 +925,8 @@ const API_MENUS: [(&str, MenuId); 42] = [
("timeline/item/context", MenuId::TimelineItemContext),
("testing/item/context", MenuId::TestItem),
("debug/callstack/context", MenuId::DebugCallStackContext),
+ ("debug/variables/context", MenuId::DebugVariablesContext),
+ ("debug/watch/context", MenuId::DebugWatchContext),
("view/title", MenuId::ViewTitle),
("view/item/context", MenuId::ViewItemContext),
("editor/context/copy", MenuId::EditorContextCopy),
diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rs
index 3938ac3df90..890ae980ab3 100644
--- a/native/crates/app/src/workbench.rs
+++ b/native/crates/app/src/workbench.rs
@@ -23,6 +23,7 @@ mod configuration_resolver;
mod context_menu;
pub mod custom_editors;
mod call_stack_menu;
+mod variable_menu;
mod debug_commands;
mod debug_console;
mod problems_quick_fix;
diff --git a/native/crates/app/src/workbench/debug_commands.rs b/native/crates/app/src/workbench/debug_commands.rs
index 650f0deaeac..4072d03134c 100644
--- a/native/crates/app/src/workbench/debug_commands.rs
+++ b/native/crates/app/src/workbench/debug_commands.rs
@@ -21,6 +21,7 @@ pub const VIEWLET_ID: &str = "workbench.view.debug";
impl Workbench {
pub(super) fn register_debug_commands(&mut self) {
+ self.register_variable_menu_commands();
let start = |no_debug: bool| {
move |workbench: &mut Workbench, _: Vec<Value>, window: &mut Window, cx: &mut Context<Workbench>| {
let (folder, name) = workbench.selected_launch();
diff --git a/native/crates/app/src/workbench/debug_hover.rs b/native/crates/app/src/workbench/debug_hover.rs
index 829f187e877..34aedfb58b6 100644
--- a/native/crates/app/src/workbench/debug_hover.rs
+++ b/native/crates/app/src/workbench/debug_hover.rs
@@ -9,7 +9,7 @@ use std::sync::LazyLock;
use std::time::Duration;
use gpui::{
- Animation, AnimationExt, AnyElement, AsyncWindowContext, Bounds, BoxShadow, ClickEvent, Context, Div, FocusHandle, Keystroke, Modifiers, MouseDownEvent, MouseMoveEvent, Point, ScrollHandle, Size, Task, WeakEntity, Window,
+ Animation, AnimationExt, AnyElement, AsyncWindowContext, Bounds, BoxShadow, ClickEvent, Context, Div, FocusHandle, Keystroke, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, Point, ScrollHandle, Size, Task, WeakEntity, Window,
canvas, deferred, div, point, prelude::*, px, rgba,
};
use regex::Regex;
@@ -21,11 +21,13 @@ use super::debug_service::{answer, evaluate_lazy, on_workbench};
use super::explorer_find::{TreeFindLook, label_matches};
use super::find_widget::HISTORY_LIMIT;
use super::input_box_view::{InputId, InputView};
+use super::variable_menu::VariableMenuRow;
use crate::history::HistoryNavigator;
use crate::input_box::InputBox;
use crate::debug::session::{State, Variable};
use crate::editor::{LINE_HEIGHT, OpenEditor, Position, column_x, utf16_column};
use crate::language_features::Candidate;
+use crate::menus::MenuId;
#[cfg(test)]
mod tests;
@@ -684,6 +686,11 @@ impl Workbench {
let (key, session, reference, expanded) = (row.key.clone(), session.to_owned(), row.variable.variables_reference, row.expanded);
element = element.on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| workbench.toggle_debug_hover_row(&key, &session, reference, !expanded, event.modifiers().alt, window, cx)));
}
+ let (menu_session, parent_reference, variable) = (session.to_owned(), row.parent_reference, row.variable.clone());
+ element = element.on_mouse_down(MouseButton::Right, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| {
+ let row = VariableMenuRow::Variable { menu: MenuId::DebugHoverContext, session: menu_session.clone(), parent_reference, variable: variable.clone() };
+ workbench.show_variable_menu(row, Bounds::new(event.position, Default::default()), window, cx);
+ }));
let focused = self.debug_hover.focused.as_ref() == Some(&row.key);
let selected = self.debug_hover.selected.as_ref() == Some(&row.key);
// debugHover.css takes the hover background off the rows.
diff --git a/native/crates/app/src/workbench/debug_view.rs b/native/crates/app/src/workbench/debug_view.rs
index 7c6396dea0f..4e620f241d5 100644
--- a/native/crates/app/src/workbench/debug_view.rs
+++ b/native/crates/app/src/workbench/debug_view.rs
@@ -12,8 +12,10 @@ use super::Workbench;
use super::call_stack_menu::CallStackItem;
use super::hover::{HoverContent, HoverOptions};
use super::input_box_view::{InputId, InputLook};
+use super::variable_menu::VariableMenuRow;
use crate::debug::session::{Session, StackFrame, State, Variable};
use crate::input_box::InputBox;
+use crate::menus::MenuId;
pub(super) const DEBUG_CONTAINER: &str = "workbench.view.debug";
/// debug.ts view ids and welcomeView.ts `WelcomeView.ID`.
@@ -432,13 +434,13 @@ impl Workbench {
.into_any_element(),
);
if expanded {
- self.variable_children(&session, reference, &key, 1, &mut rows, cx);
+ self.variable_children(&session, reference, &key, 1, false, &mut rows, cx);
}
}
rows
}
- fn variable_children(&self, session: &str, reference: i64, parent: &str, depth: usize, rows: &mut Vec<gpui::AnyElement>, cx: &mut Context<Self>) {
+ fn variable_children(&self, session: &str, reference: i64, parent: &str, depth: usize, in_watch: bool, rows: &mut Vec<gpui::AnyElement>, 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);
@@ -450,9 +452,18 @@ impl Workbench {
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)));
}
+ 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())
+ } else {
+ VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session: menu_session.clone(), parent_reference: reference, variable: menu_variable.clone() }
+ };
+ workbench.show_variable_menu(row, gpui::Bounds::new(event.position, Default::default()), window, cx);
+ }));
rows.push(row.into_any_element());
if expanded {
- self.variable_children(session, variable.variables_reference, &key, depth + 1, rows, cx);
+ self.variable_children(session, variable.variables_reference, &key, depth + 1, in_watch, rows, cx);
}
}
}
@@ -500,9 +511,14 @@ impl Workbench {
workbench.toggle_debug_row(&row_key, expanded, &session_id, reference, window, cx);
}
}));
+ let (menu_id, menu_name) = (expression.id.clone(), expression.name.clone());
+ row = row.on_mouse_down(MouseButton::Right, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| {
+ let row = VariableMenuRow::WatchExpression { id: menu_id.clone(), name: menu_name.clone() };
+ workbench.show_variable_menu(row, gpui::Bounds::new(event.position, Default::default()), window, cx);
+ }));
rows.push(row.into_any_element());
if expanded {
- self.variable_children(&session, value.variables_reference, &key, 1, &mut rows, cx);
+ self.variable_children(&session, value.variables_reference, &key, 1, true, &mut rows, cx);
}
}
if self.debug_view.editing == Some(Editing::NewWatch) {
@@ -729,7 +745,7 @@ impl Workbench {
})))
}
- fn start_debug_view_edit(&mut self, editing: Editing, window: &mut Window, cx: &mut Context<Self>) {
+ 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)
diff --git a/native/crates/app/src/workbench/variable_menu.rs b/native/crates/app/src/workbench/variable_menu.rs
new file mode 100644
index 00000000000..e52b7c192c4
--- /dev/null
+++ b/native/crates/app/src/workbench/variable_menu.rs
@@ -0,0 +1,250 @@
+//! variablesView.ts `openContextMenuForVariableTreeElement` (`MenuId.DebugVariablesContext`, debugHover.ts's
+//! `MenuId.DebugHoverContext`) and watchExpressionsView.ts `onContextMenu` (`MenuId.DebugWatchContext`), and the
+//! commands those menus run on their row's context.
+
+use std::collections::HashMap;
+
+use gpui::{Bounds, ClipboardItem, Context, Pixels, Window};
+use serde_json::{Value, json};
+
+use super::Workbench;
+use crate::commands::Outcome;
+use crate::debug::session::Variable;
+use crate::menus::{MenuId, menu_group_actions};
+
+/// A row a variable menu opens on.
+pub(super) enum VariableMenuRow {
+ /// A Variables view or hover row: its session, the parent's `variablesReference` and the variable.
+ 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),
+}
+
+impl Workbench {
+ pub(super) fn show_variable_menu(&mut self, row: VariableMenuRow, 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 };
+ let actions = menu_group_actions(&self.menus, menu, &context, |group| group != "inline");
+ self.show_context_menu_actions(actions, &context, anchor, args, window, cx);
+ }
+
+ /// 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>)> {
+ 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),
+ };
+ context.insert("variableEvaluateNamePresent".into(), json!(evaluate_name_present));
+ if let Some(variable) = variable {
+ let hint = &variable.presentation_hint;
+ let read_only = hint["attributes"].as_array().is_some_and(|attributes| attributes.iter().any(|attribute| attribute == "readOnly")) || hint["lazy"] == true;
+ context.insert("variableIsReadonly".into(), json!(read_only));
+ context.insert("variableType".into(), json!(variable.type_name));
+ }
+ 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]))
+ }
+ VariableMenuRow::WatchExpression { id, name } => {
+ context.insert("watchItemType".into(), json!("expression"));
+ Some((MenuId::DebugWatchContext, vec![json!({ "watchExpressionId": id, "name": name })]))
+ }
+ VariableMenuRow::WatchVariable(variable) => {
+ context.insert("watchItemType".into(), json!("variable"));
+ Some((MenuId::DebugWatchContext, vec![protocol_variable(variable)]))
+ }
+ }
+ }
+
+ pub(super) fn register_variable_menu_commands(&mut self) {
+ // 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| {
+ let Some(arg) = args.first() else { return Outcome::done() };
+ let (element_context, expression, value) = match arg.get("variable") {
+ Some(variable) => ("variables", evaluate_name_or_value(variable), variable["value"].clone()),
+ None if arg.get("watchExpressionId").is_some() => {
+ let id = arg["watchExpressionId"].as_str().unwrap_or_default();
+ let value = workbench.debug.watch_values.get(id).map_or(Value::Null, |variable| json!(variable.value));
+ ("watch", arg["name"].clone(), value)
+ }
+ None => ("watch", evaluate_name_or_value(arg), arg["value"].clone()),
+ };
+ let (Some(session), Some(frame)) = (workbench.debug.focused_session(), workbench.debug.focus.frame) else { return Outcome::done() };
+ let eval_context = if session.capabilities["supportsClipboardContext"] == true { "clipboard" } else { element_context };
+ let session_id = session.id.clone();
+ let reply = workbench.dap_request(&session_id, "evaluate", json!({ "expression": expression, "frameId": frame, "context": eval_context }));
+ cx.spawn_in(window, async move |_, cx| {
+ let text = match reply.await {
+ Ok(Ok(body)) => body["result"].clone(),
+ _ => value,
+ };
+ let _ = cx.update(|_, cx| cx.write_to_clipboard(ClipboardItem::new_string(text.as_str().unwrap_or_default().to_owned())));
+ })
+ .detach();
+ Outcome::done()
+ });
+ self.commands.register("debug.copyEvaluatePath", |_, args, _, cx| {
+ let Some(arg) = args.first() else { return Outcome::done() };
+ let variable = arg.get("variable").unwrap_or(arg);
+ cx.write_to_clipboard(ClipboardItem::new_string(variable["evaluateName"].as_str().unwrap_or_default().to_owned()));
+ Outcome::done()
+ });
+ self.commands.register("debug.addToWatchExpressions", |workbench, args, window, cx| {
+ let Some(name) = args.first().and_then(|arg| arg["variable"]["evaluateName"].as_str()) else { return Outcome::done() };
+ workbench.debug.model.add_watch_expression(name);
+ workbench.store_debug_model();
+ workbench.refresh_focus(window, cx);
+ Outcome::done()
+ });
+ // watchExpressionsView.ts CopyExpression and CopyAllWatchExpressions.
+ self.commands.register("debug.copyWatchExpression", |_, args, _, cx| {
+ let Some(name) = args.first().and_then(|arg| arg["name"].as_str()) else { return Outcome::done() };
+ cx.write_to_clipboard(ClipboardItem::new_string(name.to_owned()));
+ Outcome::done()
+ });
+ self.commands.register("workbench.debug.viewlet.action.copyAllWatchExpressions", |workbench, _, _, cx| {
+ let lines: Vec<String> = workbench.debug.model.watch_expressions.iter().map(|expression| {
+ let value = workbench.debug.watch_values.get(&expression.id).map_or("", |variable| variable.value.as_str());
+ format!("{}: {value}", expression.name)
+ }).collect();
+ cx.write_to_clipboard(ClipboardItem::new_string(lines.join("\n")));
+ Outcome::done()
+ });
+ // debugCommands.ts EDIT_EXPRESSION_COMMAND_ID and REMOVE_EXPRESSION_COMMAND_ID on the row's expression.
+ // shortcut: without an argument (F2, Enter, Cmd+Backspace) they do nothing; the views keep no list focus.
+ self.commands.register("debug.renameWatchExpression", |workbench, args, window, cx| {
+ let Some(id) = args.first().and_then(|arg| arg["watchExpressionId"].as_str()) else { return Outcome::done() };
+ workbench.start_debug_view_edit(super::debug_view::Editing::Watch(id.to_owned()), window, cx);
+ Outcome::done()
+ });
+ self.commands.register("debug.removeWatchExpression", |workbench, args, window, cx| {
+ let Some(id) = args.first().and_then(|arg| arg["watchExpressionId"].as_str()) else { return Outcome::done() };
+ workbench.debug.model.remove_watch_expressions(Some(id));
+ workbench.store_debug_model();
+ workbench.refresh_focus(window, cx);
+ Outcome::done()
+ });
+ }
+}
+
+/// debugModel.ts `Variable.toDebugProtocolObject`.
+fn protocol_variable(variable: &Variable) -> Value {
+ json!({
+ "name": variable.name,
+ "value": variable.value,
+ "type": variable.type_name,
+ "variablesReference": variable.variables_reference,
+ "evaluateName": variable.evaluate_name,
+ "presentationHint": variable.presentation_hint,
+ "namedVariables": variable.named_variables,
+ "indexedVariables": variable.indexed_variables,
+ })
+}
+
+/// COPY_VALUE_ID's `element.evaluateName || element.value`.
+fn evaluate_name_or_value(variable: &Value) -> Value {
+ match variable["evaluateName"].as_str() {
+ Some(name) if !name.is_empty() => json!(name),
+ _ => variable["value"].clone(),
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use std::path::Path;
+
+ use exthost::session::ForwardedRequest;
+ use gpui::TestAppContext;
+
+ use super::*;
+ use crate::host_sync::HostMessage;
+ use crate::menus::MenuAction;
+
+ fn variable(name: &str, value: &str, evaluate_name: Option<&str>) -> Variable {
+ Variable { name: name.into(), value: value.into(), evaluate_name: evaluate_name.map(str::to_owned), ..Variable::default() }
+ }
+
+ /// debug.contribution.ts's `DebugVariablesContext`, `DebugHoverContext` and `DebugWatchContext` items over
+ /// `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 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"]);
+
+ let args = |row: VariableMenuRow, cx: &mut gpui::VisualTestContext| workbench.read_with(cx, |workbench, _| workbench.variable_menu_context(&row, &mut HashMap::new()).unwrap().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"));
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("debug.addToWatchExpressions", variable_args.clone(), window, cx)));
+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.debug.model.watch_expressions.iter().map(|expression| expression.name.clone()).collect::<Vec<_>>()), ["obj.x"]);
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.debug.viewlet.action.copyAllWatchExpressions", Vec::new(), window, cx)));
+ assert_eq!(cx.read_from_clipboard().and_then(|item| item.text()).as_deref(), Some("obj.x: "));
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("debug.copyWatchExpression", vec![json!({ "watchExpressionId": "w", "name": "a + b" })], window, cx)));
+ assert_eq!(cx.read_from_clipboard().and_then(|item| item.text()).as_deref(), Some("a + b"));
+
+ cx.run_until_parked();
+ 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");
+ 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();
+ 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" })]);
+ let id = workbench.read_with(cx, |workbench, _| workbench.debug.model.watch_expressions[0].id.clone());
+ 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()));
+ }
+}
diff --git a/port/fixtures/ui-pair/debug/variables-menu.json b/port/fixtures/ui-pair/debug/variables-menu.json
new file mode 100644
index 00000000000..5066b10bc13
--- /dev/null
+++ b/port/fixtures/ui-pair/debug/variables-menu.json
@@ -0,0 +1,151 @@
+[
+ {
+ "wait": 25000
+ },
+ {
+ "key": "f9",
+ "foreground": true
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "shot": "f9"
+ },
+ {
+ "hotkey": [
+ "cmd",
+ "p"
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "type": "app.js"
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "key": "return",
+ "foreground": true
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "hotkey": [
+ "ctrl",
+ "g"
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 500
+ },
+ {
+ "type": "5"
+ },
+ {
+ "key": "return",
+ "foreground": true
+ },
+ {
+ "wait": 500
+ },
+ {
+ "key": "f9",
+ "foreground": true
+ },
+ {
+ "key": "f5",
+ "foreground": true
+ },
+ {
+ "wait": 9000
+ },
+ {
+ "shot": "stopped"
+ },
+ {
+ "rightClick": [
+ 60,
+ 129
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "shot": "variables-menu"
+ },
+ {
+ "key": "escape",
+ "foreground": true
+ },
+ {
+ "wait": 500
+ },
+ {
+ "click": [
+ 60,
+ 82
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 500
+ },
+ {
+ "doubleClick": [
+ 475,
+ 135
+ ]
+ },
+ {
+ "wait": 500
+ },
+ {
+ "hotkey": [
+ "cmd",
+ "shift",
+ "p"
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "type": "Debug: Add to Watch"
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "key": "return",
+ "foreground": true
+ },
+ {
+ "wait": 1500
+ },
+ {
+ "shot": "watch"
+ },
+ {
+ "rightClick": [
+ 60,
+ 126
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "shot": "watch-menu"
+ }
+]
diff --git a/port/ledger.md b/port/ledger.md
index 1364b2ed6c6..613798339ee 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -365,7 +365,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| workbench/parts/views | workbench part | M11 | verified | | Explorer views as panes (view_panes.rs): collapse by mouse and keys, sashes, header drag to reorder with drop overlay, state in workbench.explorer.views.state; no view actions, view menus or hidden views; cargo test -p app view_panes, ui-pair port/results/layout.md; pane headers drawn statically (workbench.rs section_header): no collapse, resize or view actions; verified: ui-pair port/results/references-view.md and every pair of port/results/windows.md (milestone 11 verification): the Explorer panes and contributed views as the reference; Explorer and Source Control views as panes of a ViewPaneContainer (view_panes.rs `PaneContainer`): collapse by mouse and keys, sashes, header drag to reorder with drop overlay, single view merged into the container, header actions, state in the container's storageId; cargo test -p app view_panes scm_container, ui-pair port/results/layout.md and port/fixtures/ui-pair/m11/scm-panes.json (port/notes.md View panes); verified: ui-pair port/results/references-view.md and every pair of port/results/windows.md (milestone 11 verification): the Explorer panes and contributed views as the reference; Run and Debug, Extensions and webview containers still draw section_header rows: no collapse, resize or view actions; welcome buttons draw their `$(icon)`s (cargo test -p app a_welcome_button_draws_its_label_icons; ui-pair port/fixtures/ui-pair/icons/scm-welcome.json: github's Publish to GitHub button with the github codicon as the reference); wrapped text stacks unsnapped 18.2px lines as Chromium (vendor gpui elements/text.rs; cargo test -p app wrapped_lines_keep_their_fractional_line_height): scm-welcome's Publish button 0.5pt from the reference, was 2.5pt; left: the port wraps "Git" of "To learn more about how to use Git" to the next line; a merged view's "..." puts the Views submenu, a separator and the view's own actions (panecomposite.ts `getSecondaryActions`; cargo test -p app a_merged_changes_view_shows_the_views_submenu_in_its_more_actions a_merged_view_without_actions_lists_the_view_toggles_flat) |
| workbench/services/accessibility | workbench service | M19 | verified | | electron-browser accessibilityService.ts over GPUI: screen reader attach follows Electron's `isAccessibilitySupportEnabled` on macOS (VoiceOver, or an assistive app setting AXManualAccessibility or AXEnhancedUserInterface, as cua-driver does; ui-pair screen-reader-detection.json with accessibility support auto shows the prompt in both), the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib; electron-browser accessibilityService.ts over GPUI: screen reader attach follows is_a11y_active, the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib |
| workbench/services/accounts | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported |
-| workbench/services/actions | workbench service | M9 | ported | [3 L] contributes.menus: about 34 unmapped ids: debug/*, terminal/*, testing/*, viewContainer/title, webview/context, extension/context, editor/title/run, modalEditor/editorTitle, notebook/cell/execute, notebook/kernelSource, mergeEditor/result/title, comments peek, issue/reporter; chat/*, agents/*, ports/*, statusBar/remoteIndicator class 4; touchBar class 2 | contributes.menus and contributes.submenus for editor/context, explorer/context, editor/title/context (menus::extension_menus): cargo test -p app menus explorer_actions; ui-pair README.md Explorer menu (port/results/contextmenu.md); other menu ids wait for their views |
+| workbench/services/actions | workbench service | M9 | ported | [3 L] contributes.menus: about 32 unmapped ids: debug/toolBar (debug_toolbar.rs draws a fixed action list), debug/createConfiguration, terminal/*, testing/*, viewContainer/title, webview/context, extension/context, editor/title/run, modalEditor/editorTitle, notebook/cell/execute, notebook/kernelSource, mergeEditor/result/title, comments peek, issue/reporter; chat/*, agents/*, ports/*, statusBar/remoteIndicator class 4; touchBar class 2 | contributes.menus and contributes.submenus for editor/context, explorer/context, editor/title/context, debug/callstack/context, debug/variables/context, debug/watch/context (menus::extension_menus): cargo test -p app menus explorer_actions; ui-pair README.md Explorer menu (port/results/contextmenu.md); other menu ids wait for their views |
| workbench/services/activity | workbench service | M11 | verified | | activity badges of view containers: view `$setBadge` values, the SCM and Extensions counts and `withProgress` progress badges (300 ms delay, kept 300 ms), numbers summed and shortened as compositeBarActions.ts (workbench/activity.rs; cargo test -p app -- activity progress_at_a_view_container_badges_its_activity_bar_item); `withCompositeProgress` progress bars of a container (side bar or panel title bottom) and of a view (pane header, merged title): `options.delay`, discrete worked of total, infinite, gone on done (progress_at_a_view_container_shows_its_progress_bar_under_the_title); ui-pair `activity-badge.json` on a git folder with two changes: the Source Control badge matches the reference (AE 1808 over the window, port/results/layout.md) |
| workbench/services/agentEditorComments | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported |
| workbench/services/agentHost | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported |
@@ -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 | verified | | 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 M] debug_view.rs: against the reference with js-debug (ui-pair `debug/call-stack-menu.json`, `FOLDER=port/fixtures/debug-node`) the debug views' lists have no list focus, so a right-clicked Call Stack row gets no `list.focusOutline` outline and a selected row keeps the inactive selection color, and a frame row shows its line as `app.js 5:2` text where the reference has `app.js` with a `5:2` badge <br> [3 L] variable context menus: DebugVariablesContext, DebugWatchContext and DebugHoverContext (Copy Value, Copy as Expression, Add to Watch, Set Value, Break When Value Is Read/Changes/Is Accessed, View Binary Data) not ported <br> [3 L] debug visualizers: debugVisualizers.ts, `VisualizedExpression` rows in the Variables view and the hover not ported <br> [3 S] lazy variables: the `$(eye)` button's look and hover not compared against the reference with js-debug (a getter in port/fixtures/debug-node) <br> [3 S] debug_hover.rs: Alt+Space on the focused hover row (abstractTree.ts `onSpace`, `setCollapsed(location, undefined, recursive)`) toggles one level, not the loaded subtree as Alt+click does <br> [3 S] debug_hover.rs: `tree_height` takes the hovered line's top relative to the editor where debugHover.ts `layoutTreeAndContainer` adds the editor's page top, so a complex hover above line 3 of port/fixtures/debug-node/app.js shows one row where the reference shows six (ui-pair `debug/hover-find.json`), and with the find widget open the rows draw past the tree's box <br> [3 S] debug_hover.rs: a click on a hover tree row does not focus the tree (DOM focus in the reference), so Cmd+Alt+F after the click opens the editor's find widget instead of the tree's | 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; 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 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; ui-pair port/fixtures/ui-pair/debug/call-stack-menu.json); shortcuts in port/notes.md |
+| workbench/contrib/debug | workbench contribution | M16 | ported | [3 M] debug_view.rs: against the reference with js-debug (ui-pair `debug/call-stack-menu.json`, `FOLDER=port/fixtures/debug-node`) the debug views' lists have no list focus, so a right-clicked Call Stack row gets no `list.focusOutline` outline and a selected row keeps the inactive selection color, and a frame row shows its line as `app.js 5:2` text where the reference has `app.js` with a `5:2` badge <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 S] debug_view.rs: stopped at port/fixtures/debug-node/app.js line 5 the reference shows `Local: main` collapsed (ui-pair `debug/variables-menu.json`; variablesView.ts auto-expands the first scope only when `tree.hasNode` wins its race) where the port expands it; which one to match is not decided <br> [3 L] debug visualizers: debugVisualizers.ts, `VisualizedExpression` rows in the Variables view and the hover not ported <br> [3 S] lazy variables: the `$(eye)` button's look and hover not compared against the reference with js-debug (a getter in port/fixtures/debug-node) <br> [3 S] debug_hover.rs: Alt+Space on the focused hover row (abstractTree.ts `onSpace`, `setCollapsed(location, undefined, recursive)`) toggles one level, not the loaded subtree as Alt+click does <br> [3 S] debug_hover.rs: `tree_height` takes the hovered line's top relative to the editor where debugHover.ts `layoutTreeAndContainer` adds the editor's page top, so a complex hover above line 3 of port/fixtures/debug-node/app.js shows one row where the reference shows six (ui-pair `debug/hover-find.json`), and with the find widget open the rows draw past the tree's box <br> [3 S] debug_hover.rs: a click on a hover tree row does not focus the tree (DOM focus in the reference), so Cmd+Alt+F after the click opens the editor's find widget instead of the tree's | 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; 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 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; 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); 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.md
index a55c4638a6d..e0b501fb108 100644
--- a/port/notes.md
+++ b/port/notes.md
@@ -940,7 +940,8 @@ Scope as in the M19 Work row of port/ledger.md.
- Testing (`testing.rs`, `workbench/testing_service.rs`, `testing_view.rs`): MainThreadTesting with the test collection diffs, run profiles, live results (`$runControllerTests`, `$startedExtensionTestRun`, `$applyTestRunUpdates`, `$publishTestResults`), the Testing view (shows once a controller registers), run glyphs in the editor gutter and the Test Results editor. VSBuffer arguments of forwarded requests now reach the workbench as byte arrays (`exthost::session::arg_value`).
- Continuous run (`workbench/testing_continuous.rs`): the view title's dropdown of `getContinuousRunDropdown` runs plain actions upstream; the port's context menu runs commands, so each profile item is an internal `_testing.toggleContinuousRunProfile.<controller>.<profile>` command registered when the menu shows. testingExplorerView.ts re-sorts a parent when a continuous run changes, but `TreeSorter` has no continuous run criterion in 1.147.0, so the order does not change; the port draws rows from the run state each frame and needs no re-sort. The unattended restart participant `testing.continuousRun` waits on the unattended restart service (ledger row workbench/services/lifecycle).
- 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 context menu and visualizers are ledger gaps of workbench/contrib/debug. 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.
+- 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.
+- 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.
- 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`).
- Checks: `cargo test -p app debug` and `cargo test -p app testing::`; api-tests `MOCHA_GREP="vscode API - debug"`; `port/fixtures/debug-node` (app.js with launch.json, math.test.js) with `port/fixtures/extensions/tests-provider` through `port/tools/ui-pair`.