Visual Studio Code, rebuilt in Rust
Rust
feat(debug): add the Call Stack view context menu
rokartur99c8d8b19060
diff --git a/native/crates/app/src/menus.rs b/native/crates/app/src/menus.rsindex f8cb9e8ccdc..488636c02ac 100644--- a/native/crates/app/src/menus.rs+++ b/native/crates/app/src/menus.rs@@ -119,6 +119,8 @@ pub enum MenuId {TimelineItemContext,/// `MenuId.TestItem`: a test row's inline actions and context menu in the Testing view.TestItem,+ /// `MenuId.DebugCallStackContext`: a Call Stack row's context menu.+ DebugCallStackContext,/// timeline.contribution.ts "Filter Timeline": a toggle per timeline source.TimelineFilterSubMenu,ViewTitle,@@ -434,6 +436,20 @@ const WORKBENCH_MENUS: &[Row] = &[// debugEditorActions.ts `OpenDisassemblyViewAction`.(MenuId::EditorContext, None, "debug.action.openDisassemblyView", "Open Disassembly View", "debug", 5., Some("inDebugMode && !panelFocus && debugState == 'stopped' && editorTextFocus && disassembleRequestSupported && languageSupportsDisassembleRequest"), Some("focusedStackFrameHasInstructionReference")),(MenuId::EditorContext, None, "workbench.action.showCommands", "Command Palette...", "z_commands", 1., Some("!editorSimpleInput"), None),+ // debug.contribution.ts `registerDebugViewMenuItem(MenuId.DebugCallStackContext, ...)`, then OpenDisassemblyViewAction.+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.restart", "Restart", "3_modification", 10., Some("callStackItemType == 'session'"), None),+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.disconnect", "Disconnect", "3_modification", 20., Some("callStackItemType == 'session'"), None),+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.disconnectAndSuspend", "Disconnect and Suspend", "3_modification", 21., Some("callStackItemType == 'session' && suspendDebuggeeSupported && terminateDebuggeeSupported"), None),+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.stop", "Stop", "3_modification", 30., Some("callStackItemType == 'session'"), None),+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.pause", "Pause", "navigation", 10., Some("callStackItemType == 'thread' && debugState == 'running' && !focusedSessionIsNoDebug"), None),+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.continue", "Continue", "navigation", 10., Some("callStackItemType == 'thread' && debugState == 'stopped'"), None),+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.stepOver", "Step Over", "navigation", 20., Some("callStackItemType == 'thread'"), Some("debugState == 'stopped'")),+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.stepInto", "Step Into", "navigation", 30., Some("callStackItemType == 'thread'"), Some("debugState == 'stopped'")),+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.stepOut", "Step Out", "navigation", 40., Some("callStackItemType == 'thread'"), Some("debugState == 'stopped' && threadHasMultipleStackFrames")),+ (MenuId::DebugCallStackContext, None, "workbench.action.debug.terminateThread", "Terminate Thread", "termination", 10., Some("callStackItemType == 'thread'"), Some("terminateThreadsSupported")),+ (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")),// 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.@@ -858,7 +874,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); 41] = [+const API_MENUS: [(&str, MenuId); 42] = [("file/newFile", MenuId::NewFile),("editor/context", MenuId::EditorContext),("explorer/context", MenuId::ExplorerContext),@@ -886,6 +902,7 @@ const API_MENUS: [(&str, MenuId); 41] = [("timeline/title", MenuId::TimelineTitle),("timeline/item/context", MenuId::TimelineItemContext),("testing/item/context", MenuId::TestItem),+ ("debug/callstack/context", MenuId::DebugCallStackContext),("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.rsindex ed7bf3d95c5..5b71f40c2c2 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -22,6 +22,7 @@ mod history_actions;mod configuration_resolver;mod context_menu;pub mod custom_editors;+mod call_stack_menu;mod debug_commands;mod debug_console;mod problems_quick_fix;diff --git a/native/crates/app/src/workbench/call_stack_menu.rs b/native/crates/app/src/workbench/call_stack_menu.rsnew file mode 100644index 00000000000..514f318be40--- /dev/null+++ b/native/crates/app/src/workbench/call_stack_menu.rs@@ -0,0 +1,210 @@+//! callStackView.ts `onContextMenu`: a Call Stack row's context menu (`MenuId.DebugCallStackContext`), and the+//! debugCommands.ts `CallStackContext` its commands run on.++use std::collections::HashMap;+use std::path::Path;++use gpui::{Bounds, Context, Pixels, Window};+use serde_json::{Value, json};++use super::Workbench;+use crate::debug::session::{Session, StackFrame, State, Thread};+use crate::menus::{MenuId, menu_group_actions};++/// A Call Stack row: a session, a thread, or a frame by its index in the thread's call stack.+#[derive(Clone)]+pub(super) enum CallStackItem {+ Session(String),+ Thread(String, i64),+ Frame(String, i64, usize),+}++impl Workbench {+ /// `onContextMenu`: the menu but its `inline` group over the row's context keys, run with+ /// `getContextForContributedActions` and `getContext`.+ pub(super) fn show_call_stack_menu(&mut self, item: &CallStackItem, anchor: Bounds<Pixels>, window: &mut Window, cx: &mut Context<Self>) {+ let mut context = self.key_context(window);+ let Some(args) = self.call_stack_item_context(item, &mut context) else { return };+ let actions = menu_group_actions(&self.menus, MenuId::DebugCallStackContext, &context, |group| group != "inline");+ self.show_context_menu_actions(actions, &context, anchor, args, window, cx);+ }++ /// `getSessionContextOverlay`, `getThreadContextOverlay` or `getStackFrameContextOverlay` into `context`, and the+ /// row's command arguments.+ pub(super) fn call_stack_item_context(&self, item: &CallStackItem, context: &mut HashMap<String, Value>) -> Option<Vec<Value>> {+ let (session_id, thread_id, frame_index) = match item {+ CallStackItem::Session(session) => (session, None, None),+ CallStackItem::Thread(session, thread) => (session, Some(*thread), None),+ CallStackItem::Frame(session, thread, index) => (session, Some(*thread), Some(*index)),+ };+ let session = self.debug.session(session_id)?;+ let session_context = json!({ "sessionId": session.id });+ let Some(thread_id) = thread_id else {+ let one_thread = (session.threads.len() == 1).then(|| &session.threads[0]);+ context.insert("callStackItemType".into(), json!("session"));+ context.insert("callStackSessionIsAttach".into(), json!(self.is_session_attach(session)));+ context.insert("callStackItemStopped".into(), json!(session.state(None) == State::Stopped));+ context.insert("callStackSessionHasOneThread".into(), json!(one_thread.is_some()));+ context.insert("threadHasMultipleStackFrames".into(), json!(one_thread.is_some_and(has_multiple_stack_frames)));+ return Some(vec![json!(session.id), session_context]);+ };+ let thread = session.thread(thread_id)?;+ let thread_context = json!({ "sessionId": session.id, "threadId": thread_context_id(session, thread) });+ let Some(index) = frame_index else {+ context.insert("callStackItemType".into(), json!("thread"));+ context.insert("callStackItemStopped".into(), json!(thread.stopped));+ context.insert("threadHasMultipleStackFrames".into(), json!(has_multiple_stack_frames(thread)));+ return Some(vec![json!(thread.id), thread_context]);+ };+ let frame = thread.frames.get(index)?;+ context.insert("callStackItemType".into(), json!("stackFrame"));+ context.insert("stackFrameSupportsRestart".into(), json!(frame.can_restart));+ let range = json!({ "startLineNumber": frame.line, "startColumn": frame.column, "endLineNumber": frame.end_line, "endColumn": frame.end_column });+ let frame_context = json!({+ "sessionId": session.id,+ "threadId": thread_context["threadId"],+ "frameId": frame_context_id(session, thread, index, frame),+ "frameName": frame.name,+ "frameLocation": { "range": range, "source": frame.source },+ });+ // `getContextForContributedActions`: an in-memory source's path, reference or name, else its uri.+ let contributed = match frame.path() {+ Some(path) => json!(crate::editor_history::file_uri_string(Path::new(path))),+ None => [&frame.source["path"], &frame.source["sourceReference"], &frame.source["name"]].into_iter().find(|value| !value.is_null()).cloned().unwrap_or(Value::Null),+ };+ Some(vec![contributed, frame_context])+ }++ /// debugUtils.ts `isSessionAttach`: an attach outside an extension host debug session, its parents too.+ fn is_session_attach(&self, session: &Session) -> bool {+ session.configuration["request"] == "attach"+ && self.extension_host_debug_session(&session.id).is_none()+ && session.parent.as_deref().and_then(|parent| self.debug.session(parent)).is_none_or(|parent| self.is_session_attach(parent))+ }++ /// debugCommands.ts `isSessionContext`: the context's session, else the focused one.+ pub(super) fn context_session(&self, args: &[Value]) -> Option<String> {+ match args.get(1).and_then(|context| context["sessionId"].as_str()) {+ Some(session) => Some(session.to_owned()),+ None => self.debug.focus.session.clone(),+ }+ }++ /// debugCommands.ts `getThreadAndRun`'s thread: the context's, a session context's first, else the focused+ /// thread or the focused session's first.+ pub(super) fn context_thread(&self, args: &[Value]) -> Option<(String, i64)> {+ let context = args.get(1).unwrap_or(&Value::Null);+ if let Some(session) = context["sessionId"].as_str().and_then(|id| self.debug.session(id)) {+ let thread = match context["threadId"].as_str() {+ Some(id) => session.threads.iter().find(|thread| thread_context_id(session, thread) == id),+ None => session.threads.first(),+ };+ if let Some(thread) = thread {+ return Some((session.id.clone(), thread.id));+ }+ }+ let session = self.debug.focused_session()?;+ let thread = self.debug.focus.thread.or_else(|| session.threads.first().map(|thread| thread.id))?;+ Some((session.id.clone(), thread))+ }++ /// debugCommands.ts `getFrame`: the context's frame, else (without a frame context) the focused one.+ pub(super) fn context_frame(&self, args: &[Value]) -> Option<(&Session, &Thread, &StackFrame)> {+ let context = args.get(1).unwrap_or(&Value::Null);+ if let (Some(session), Some(thread), Some(frame)) = (context["sessionId"].as_str(), context["threadId"].as_str(), context["frameId"].as_str()) {+ let session = self.debug.session(session)?;+ let thread = session.threads.iter().find(|candidate| thread_context_id(session, candidate) == thread)?;+ let index = thread.frames.iter().enumerate().position(|(index, candidate)| frame_context_id(session, thread, index, candidate) == frame)?;+ return Some((session, thread, &thread.frames[index]));+ }+ let session = self.debug.focused_session()?;+ let thread = session.thread(self.debug.focus.thread?)?;+ let frame = thread.frames.iter().find(|frame| Some(frame.id) == self.debug.focus.frame)?;+ Some((session, thread, frame))+ }+}++/// callStackView.ts `hasMultipleStackFrames`.+pub(super) fn has_multiple_stack_frames(thread: &Thread) -> bool {+ thread.frames.len() > 1 || thread.total_frames.is_some()+}++/// debugModel.ts `StackFrame.toString`: the name and its file or in-memory source's name with the line.+pub(super) fn stack_frame_label(frame: &StackFrame) -> String {+ let source = frame.path().map(str::to_owned).unwrap_or_else(|| frame.source_name());+ match source.as_str() {+ "Unknown Source" => frame.name.clone(),+ _ => format!("{} ({source}:{})", frame.name, frame.line),+ }+}++/// debugModel.ts `Thread.getId`.+fn thread_context_id(session: &Session, thread: &Thread) -> String {+ format!("thread:{}:{}", session.id, thread.id)+}++/// debugModel.ts `StackFrame.getId`.+fn frame_context_id(session: &Session, thread: &Thread, index: usize, frame: &StackFrame) -> String {+ format!("stackframe:{}:{index}:{}", thread_context_id(session, thread), frame.source_name())+}+#[cfg(test)]+mod tests {+ use gpui::TestAppContext;++ use super::*;+ use crate::menus::MenuAction;++ fn frame(id: i64, name: &str, line: u32) -> StackFrame {+ StackFrame { id, name: name.into(), source: json!({ "name": "a.js", "path": "/tmp/a.js" }), line, column: 1, end_line: line, end_column: 1, can_restart: true, instruction_pointer_reference: Some("0x1".into()), ..Default::default() }+ }++ /// callStackView.ts `onContextMenu` with debug.contribution.ts's `DebugCallStackContext` items, and the+ /// debugCommands.ts handlers on the row's `CallStackContext` rather than the focused thread.+ #[gpui::test]+ fn a_call_stack_row_menu_shows_its_kind_of_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();+ 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));+ let titles = |item: CallStackItem, cx: &mut gpui::VisualTestContext| {+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.show_call_stack_menu(&item, Bounds::default(), window, cx);+ let menu = workbench.context_menu.take().expect("a context menu shows");+ menu.levels[0].actions.iter().map(|action| match action {+ MenuAction::Command { title, enabled, .. } => format!("{title}{}", if *enabled { "" } else { " (disabled)" }),+ _ => "-".to_owned(),+ }).collect::<Vec<_>>()+ })+ };+ workbench.update_in(cx, |workbench, _, _| {+ let mut session = Session::new("s".into(), 1, json!({ "name": "s", "type": "node", "request": "launch" }), json!({}), None, json!({}));+ session.initialized = true;+ session.capabilities = json!({ "supportsRestartFrame": true, "supportTerminateDebuggee": true, "supportSuspendDebuggee": true, "supportsDisassembleRequest": true });+ session.set_threads(&[json!({ "id": 1, "name": "main" }), json!({ "id": 2, "name": "worker" })]);+ session.stop_threads(&json!({ "reason": "pause", "allThreadsStopped": true }));+ session.threads[0].frames = vec![frame(10, "main", 3)];+ session.threads[1].frames = vec![frame(20, "work", 7), frame(21, "run", 9)];+ workbench.debug.sessions.push(session);+ workbench.debug.focus = super::super::debug_service::DebugFocus { session: Some("s".into()), thread: Some(1), frame: Some(10) };+ });+ assert_eq!(titles(CallStackItem::Session("s".into()), cx), ["Restart", "Disconnect", "Disconnect and Suspend", "Stop"]);+ assert_eq!(titles(CallStackItem::Thread("s".into(), 2), cx), ["Continue", "Step Over", "Step Into", "Step Out", "-", "Terminate Thread (disabled)"]);+ assert_eq!(titles(CallStackItem::Frame("s".into(), 2, 0), cx), ["Restart Frame", "-", "Copy Call Stack", "-", "Open Disassembly View"]);++ let run = |command: &str, item: CallStackItem, cx: &mut gpui::VisualTestContext| {+ workbench.update_in(cx, |workbench, window, cx| {+ let args = workbench.call_stack_item_context(&item, &mut HashMap::new()).unwrap();+ drop(workbench.execute_command(command, args, window, cx));+ });+ cx.run_until_parked();+ let request = host.try_iter().filter(|message| message.method == "$sendDAMessage").map(|message| message.args[1].clone()).last();+ request.map(|request| (request["command"].clone(), request["arguments"].clone()))+ };+ assert_eq!(run("debug.copyStackTrace", CallStackItem::Frame("s".into(), 2, 1), cx), None);+ assert_eq!(cx.read_from_clipboard().and_then(|item| item.text()).as_deref(), Some("work (/tmp/a.js:7)\nrun (/tmp/a.js:9)"));+ assert_eq!(run("workbench.action.debug.restartFrame", CallStackItem::Frame("s".into(), 2, 1), cx), Some((json!("restartFrame"), json!({ "frameId": 21 }))));+ assert_eq!(run("workbench.action.debug.stepOver", CallStackItem::Thread("s".into(), 2), cx), Some((json!("next"), json!({ "threadId": 2 }))), "the row's thread, not the focused one");+ assert_eq!(run("workbench.action.debug.disconnectAndSuspend", CallStackItem::Session("s".into()), cx), Some((json!("disconnect"), json!({ "restart": false, "terminateDebuggee": false, "suspendDebuggee": true }))));+ }+}diff --git a/native/crates/app/src/workbench/debug_commands.rs b/native/crates/app/src/workbench/debug_commands.rsindex e3a1dada361..b7a5d5f9ea6 100644--- a/native/crates/app/src/workbench/debug_commands.rs+++ b/native/crates/app/src/workbench/debug_commands.rs@@ -42,17 +42,15 @@ impl Workbench {workbench.show_debug_view(cx);Outcome::done()});- // debugCommands.ts STOP_ID: the focused session, the root of a child its parent manages; with none, all.- self.commands.register("workbench.action.debug.stop", |workbench, _, window, cx| {- let session = workbench.debug.focus.session.clone();- Outcome::Pending(workbench.stop_session(session, false, window, cx))- });- self.commands.register("workbench.action.debug.disconnect", |workbench, _, window, cx| {- let session = workbench.debug.focus.session.clone();- Outcome::Pending(workbench.stop_session(session, true, window, cx))- });+ // debugCommands.ts `stopHandler`: the context's or the focused session, the root of a child its parent manages; with none, all.+ for (id, disconnect, suspend) in [("workbench.action.debug.stop", false, false), ("workbench.action.debug.disconnect", true, false), ("workbench.action.debug.disconnectAndSuspend", true, true)] {+ self.commands.register(id, move |workbench, args, window, cx| {+ let session = workbench.context_session(&args);+ Outcome::Pending(workbench.stop_session(session, disconnect, suspend, window, cx))+ });+ }self.commands.register("workbench.action.debug.restart", move |workbench, args, window, cx| {- let Some(mut session_id) = workbench.debug.focus.session.clone() else { return start(false)(workbench, args, window, cx) };+ let Some(mut session_id) = workbench.context_session(&args) else { return start(false)(workbench, args, window, cx) };// The restart goes to the root parent unless the toolbar shows sub-sessions.let show_sub_sessions = workbench.setting("debug.showSubSessionsInToolBar") == true;while !show_sub_sessions@@ -73,16 +71,32 @@ impl Workbench {("workbench.action.debug.stepBack", "stepBack", true),("workbench.action.debug.reverseContinue", "reverseContinue", false),] {- self.commands.register(id, move |workbench, _, window, cx| workbench.run_thread_command(command, step, window, cx));+ self.commands.register(id, move |workbench, args, _, cx| {+ let Some((session, thread)) = workbench.context_thread(&args) else { return Outcome::done() };+ workbench.thread_command(&session, thread, command, step, cx)+ });}- self.commands.register("workbench.action.debug.pause", |workbench, _, window, cx| {- let (Some(session), thread) = (workbench.debug.focus.session.clone(), workbench.debug.focus.thread) else { return Outcome::done() };- let thread = thread.or_else(|| workbench.debug.session(&session).and_then(|session| session.threads.first()).map(|thread| thread.id));+ self.commands.register("workbench.action.debug.pause", |workbench, args, _, cx| {+ let Some((session, thread)) = workbench.context_thread(&args) else { return Outcome::done() };let reply = workbench.dap_request(&session, "pause", json!({ "threadId": thread }));- let _ = window;cx.notify();Outcome::Pending(reply)});+ // debugModel.ts `Thread.terminate`.+ self.commands.register("workbench.action.debug.terminateThread", |workbench, args, _, _| {+ let Some((session, thread)) = workbench.context_thread(&args) else { return Outcome::done() };+ Outcome::Pending(workbench.dap_request(&session, "terminateThreads", json!({ "threadIds": [thread] })))+ });+ self.commands.register("workbench.action.debug.restartFrame", |workbench, args, _, cx| {+ let Some((session, thread, frame)) = workbench.context_frame(&args).map(|(session, thread, frame)| (session.id.clone(), thread.id, frame.id)) else { return Outcome::done() };+ workbench.resume_thread(&session, thread, "restartFrame", json!({ "frameId": frame }), cx)+ });+ self.commands.register("debug.copyStackTrace", |workbench, args, _, cx| {+ let Some((_, thread, _)) = workbench.context_frame(&args) else { return Outcome::done() };+ let text = thread.frames.iter().map(super::call_stack_menu::stack_frame_label).collect::<Vec<_>>().join("\n");+ cx.write_to_clipboard(gpui::ClipboardItem::new_string(text));+ Outcome::done()+ });self.commands.register("editor.debug.action.toggleBreakpoint", |workbench, _, _, cx| {let Some(editor) = workbench.editors.active() else { return Outcome::done() };let mut lines: Vec<u32> = editor.selections.iter().map(|selection| selection.head.line as u32 + 1).collect();@@ -231,13 +245,7 @@ impl Workbench {(folders.first().cloned(), None)}- /// Continue and the step commands on the focused thread (debugSession.ts `next`, `stepIn`, `stepOut`):- /// the thread runs again at once, before the adapter's `continued` event.- fn run_thread_command(&mut self, command: &str, step: bool, _window: &mut Window, cx: &mut Context<Self>) -> Outcome {- let (Some(session_id), Some(thread)) = (self.debug.focus.session.clone(), self.debug.focus.thread) else { return Outcome::done() };- self.thread_command(&session_id, thread, command, step, cx)- }-+ /// Continue and the step commands (debugSession.ts `next`, `stepIn`, `stepOut`).fn thread_command(&mut self, session_id: &str, thread: i64, command: &str, step: bool, cx: &mut Context<Self>) -> Outcome {let mut arguments = json!({ "threadId": thread });// debugCommands.ts: a step from the disassembly view steps one instruction.@@ -250,6 +258,11 @@ impl Workbench {{thread.last_stepping_granularity = granularity;}+ self.resume_thread(session_id, thread, command, arguments, cx)+ }++ /// A request that runs the thread on: it runs again at once, before the adapter's `continued` event.+ fn resume_thread(&mut self, session_id: &str, thread: i64, command: &str, arguments: Value, cx: &mut Context<Self>) -> Outcome {let wait = self.debug.session(session_id).and_then(|session| session.wait_to_resume.clone());let reply = match wait {None => self.dap_request(session_id, command, arguments),@@ -485,13 +498,17 @@ impl Workbench {context.insert("debuggersAvailable".into(), json!(!self.debug.debuggers.is_empty()));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")] {+ 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()));context.insert("watchExpressionsExist".into(), json!(!self.debug.model.watch_expressions.is_empty()));context.insert("loadedScriptsSupported".into(), json!(focused.is_some_and(|session| session.capabilities["supportsLoadedSourcesRequest"] == true)));context.insert("stepBackSupported".into(), json!(focused.is_some_and(|session| session.capabilities["supportsStepBack"] == true)));context.insert("restartFrameSupported".into(), json!(focused.is_some_and(|session| session.capabilities["supportsRestartFrame"] == true)));let thread = focused.zip(self.debug.focus.thread).and_then(|(session, id)| session.thread(id));- context.insert("threadHasMultipleStackFrames".into(), json!(thread.is_some_and(|thread| thread.frames.len() > 1 || thread.total_frames.is_some())));+ context.insert("threadHasMultipleStackFrames".into(), json!(thread.is_some_and(super::call_stack_menu::has_multiple_stack_frames)));context.insert("disassembleRequestSupported".into(), json!(focused.is_some_and(|session| session.capabilities["supportsDisassembleRequest"] == true)));context.insert("focusedStackFrameHasInstructionReference".into(), json!(self.debug.focused_frame().is_some_and(|frame| frame.instruction_pointer_reference.is_some())));context.insert("disassemblyViewFocus".into(), json!(self.disassembly_view_active()));@@ -650,7 +667,7 @@ mod tests {let sent = requests(&host);let set = sent.iter().find(|request| request["command"] == "setBreakpoints").expect("the file is sent again").clone();assert_eq!(set["arguments"]["lines"], json!([2, 5]));- workbench.update_in(cx, |workbench, window, cx| drop(workbench.run_thread_command("continue", false, window, cx)));+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.debug.continue", Vec::new(), window, cx)));cx.run_until_parked();assert!(!requests(&host).iter().any(|request| request["command"] == "continue"), "continue waits for the dependent breakpoints");workbench.update_in(cx, |workbench, window, cx| drop(workbench.handle_debug_request(respond(&set, json!({ "breakpoints": [] })), window, cx)));@@ -692,7 +709,7 @@ mod tests {workbench.debug.focus.thread = Some(1);});let step = |cx: &mut gpui::VisualTestContext| {- workbench.update_in(cx, |workbench, window, cx| drop(workbench.run_thread_command("next", true, window, cx)));+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.debug.stepOver", Vec::new(), window, cx)));cx.run_until_parked();host.try_iter().filter(|message| message.method == "$sendDAMessage").map(|message| message.args[1].clone()).find(|request| request["command"] == "next").unwrap()["arguments"]["granularity"].clone()};diff --git a/native/crates/app/src/workbench/debug_service.rs b/native/crates/app/src/workbench/debug_service.rsindex cc2f8c5191f..659314a4fae 100644--- a/native/crates/app/src/workbench/debug_service.rs+++ b/native/crates/app/src/workbench/debug_service.rs@@ -23,6 +23,14 @@ use crate::quick_input::{Entry, Event, Item, Kind, QuickInput};type Reply = oneshot::Receiver<Result<Value, Value>>;+/// The DAP `disconnect` request's `terminateDebuggee` and `suspendDebuggee`.+#[derive(Clone, Copy, PartialEq)]+enum Debuggee {+ Terminate,+ Keep,+ Suspend,+}+/// debugStorage.ts `DEBUG_CHOSEN_ENVIRONMENTS_KEY`, and debugConfigurationManager.ts's selected launch.const CHOSEN_ENVIRONMENTS_KEY: &str = "debug.chosenenvironment";const SELECTED_CONFIG_KEY: &str = "debug.selectedconfigname";@@ -229,7 +237,7 @@ impl Workbench {}return Outcome::Pending(self.start_debugging(folder, arg(1), options, DebugTasks::PreLaunch, window, cx));}- "$stopDebugging" => return Outcome::Pending(self.stop_session(arg(0).as_str().map(str::to_owned), false, window, cx)),+ "$stopDebugging" => return Outcome::Pending(self.stop_session(arg(0).as_str().map(str::to_owned), false, false, window, cx)),"$setDebugSessionName" => {let id = arg(0).as_str().unwrap_or_default().to_owned();let name = arg(1).as_str().unwrap_or_default().to_owned();@@ -517,7 +525,7 @@ impl Workbench {drop(self.restart_session(session_id.to_owned(), Some(body["restart"].clone()), window, cx));} else {// debugSession.ts `onDidTerminateDebugee`: the session disconnects itself, whoever manages its lifecycle.- drop(self.raw_disconnect(session_id.to_owned(), false, false, window, cx));+ drop(self.raw_disconnect(session_id.to_owned(), false, Debuggee::Keep, window, cx));}}"loadedSource" => {@@ -1052,7 +1060,7 @@ impl Workbench {}/// debugService.ts `stopSession`: terminate one session, or all.- pub(crate) fn stop_session(&mut self, session_id: Option<String>, disconnect: bool, window: &mut Window, cx: &mut Context<Self>) -> Reply {+ pub(crate) fn stop_session(&mut self, session_id: Option<String>, disconnect: bool, suspend: bool, window: &mut Window, cx: &mut Context<Self>) -> Reply {let ids: Vec<String> = match session_id {Some(id) => vec![id],None => self.debug.sessions.iter().map(|session| session.id.clone()).collect(),@@ -1061,7 +1069,7 @@ impl Workbench {self.cancel_debug_tasks();}let (sender, receiver) = oneshot::channel();- let stops: Vec<Reply> = ids.into_iter().map(|id| if disconnect { self.disconnect_session(id, false, false, window, cx) } else { self.terminate_session(id, false, window, cx) }).collect();+ let stops: Vec<Reply> = ids.into_iter().map(|id| if disconnect { self.disconnect_session(id, false, if suspend { Debuggee::Suspend } else { Debuggee::Keep }, window, cx) } else { self.terminate_session(id, false, window, cx) }).collect();cx.background_executor().spawn(async move {for stop in stops {@@ -1086,7 +1094,7 @@ impl Workbench {}let terminate = session.capabilities["supportsTerminateRequest"] == true && session.configuration["request"] == "launch" && !session.terminated;if !terminate {- return self.disconnect_session(session_id, restart, true, window, cx);+ return self.disconnect_session(session_id, restart, Debuggee::Terminate, window, cx);}if let Some(session) = self.debug.session_mut(&session_id) {session.terminated = true;@@ -1096,7 +1104,7 @@ impl Workbench {cx.spawn_in(window, async move |this, cx| {// rawDebugSession.ts `terminate`: a failed terminate falls back to disconnect.if answer(reply).await.is_err() {- let disconnect = on_workbench(&this, cx, |workbench, window, cx| workbench.disconnect_session(session_id, restart, true, window, cx));+ let disconnect = on_workbench(&this, cx, |workbench, window, cx| workbench.disconnect_session(session_id, restart, Debuggee::Terminate, window, cx));if let Ok(disconnect) = disconnect {let _ = disconnect.await;}@@ -1108,20 +1116,24 @@ impl Workbench {}/// rawDebugSession.ts `disconnect` then `stopAdapter`: the adapter has 2 s to answer, then it is stopped.- fn disconnect_session(&mut self, session_id: String, restart: bool, terminate_debuggee: bool, window: &mut Window, cx: &mut Context<Self>) -> Reply {+ fn disconnect_session(&mut self, session_id: String, restart: bool, debuggee: Debuggee, window: &mut Window, cx: &mut Context<Self>) -> Reply {let Some(session) = self.debug.session(&session_id) else { return ready(Value::Null) };if session.options["lifecycleManagedByParent"] == true && let Some(parent) = session.parent.clone() {- return self.disconnect_session(parent, restart, terminate_debuggee, window, cx);+ return self.disconnect_session(parent, restart, debuggee, window, cx);}- self.raw_disconnect(session_id, restart, terminate_debuggee, window, cx)+ self.raw_disconnect(session_id, restart, debuggee, window, cx)}/// rawDebugSession.ts `disconnect`, then the adapter stops and the session ends.- fn raw_disconnect(&mut self, session_id: String, restart: bool, terminate_debuggee: bool, window: &mut Window, cx: &mut Context<Self>) -> Reply {+ fn raw_disconnect(&mut self, session_id: String, restart: bool, debuggee: Debuggee, window: &mut Window, cx: &mut Context<Self>) -> Reply {let Some(session) = self.debug.session_mut(&session_id) else { return ready(Value::Null) };session.terminated = true;let handle = session.handle;- let reply = self.dap_request(&session_id, "disconnect", json!({ "restart": restart, "terminateDebuggee": terminate_debuggee }));+ let mut arguments = json!({ "restart": restart, "terminateDebuggee": debuggee == Debuggee::Terminate });+ if debuggee == Debuggee::Suspend {+ arguments["suspendDebuggee"] = json!(true);+ }+ let reply = self.dap_request(&session_id, "disconnect", arguments);let (sender, receiver) = oneshot::channel();cx.spawn_in(window, async move |this, cx| {let timer = cx.background_executor().timer(std::time::Duration::from_secs(2));@@ -1160,7 +1172,7 @@ impl Workbench {}/// debugUtils.ts `getExtensionHostDebugSession`: the session or its nearest parent that debugs an extension host.- fn extension_host_debug_session(&self, session_id: &str) -> Option<&Session> {+ pub(super) fn extension_host_debug_session(&self, session_id: &str) -> Option<&Session> {let mut session = self.debug.session(session_id)?;loop {let debug_type = session.configuration["type"].as_str()?;@@ -1208,7 +1220,7 @@ impl Workbench {cx.spawn_in(window, async move |this, cx| {let Err((message, show_user)) = launch_or_attach(&this, cx, &session_id).await else { return };let _ = on_workbench(&this, cx, |workbench, window, cx| {- drop(workbench.disconnect_session(session_id, false, true, window, cx));+ drop(workbench.disconnect_session(session_id, false, Debuggee::Terminate, window, cx));if show_user {workbench.notify_error(message);}@@ -1698,7 +1710,7 @@ async fn finish_session(this: &WeakEntity<Workbench>, cx: &mut AsyncWindowContex}Err(error) => {on_workbench(this, cx, |workbench, window, cx| {- drop(workbench.disconnect_session(session_id.clone(), false, true, window, cx));+ drop(workbench.disconnect_session(session_id.clone(), false, Debuggee::Terminate, window, cx));if error.1 {workbench.notify_error(error.0);}@@ -1785,7 +1797,7 @@ async fn restart_flow(this: &WeakEntity<Workbench>, cx: &mut AsyncWindowContext,let should_focus = on_workbench(this, cx, |workbench, _, _| workbench.debug.focus.session.as_deref() == Some(session_id))?;// #55064: an automatic restart disconnects, a restart by the user terminates.let stop = on_workbench(this, cx, |workbench, window, cx| match restart_data {- Some(_) => workbench.disconnect_session(session_id.to_owned(), true, false, window, cx),+ Some(_) => workbench.disconnect_session(session_id.to_owned(), true, Debuggee::Keep, window, cx),None => workbench.terminate_session(session_id.to_owned(), true, window, cx),})?;let _ = stop.await;@@ -1796,7 +1808,7 @@ async fn restart_flow(this: &WeakEntity<Workbench>, cx: &mut AsyncWindowContext,on_workbench(this, cx, |workbench, window, cx| workbench.relaunch_session(session_id, window, cx))?;if let Err((message, show_user)) = launch_or_attach(this, cx, session_id).await {return on_workbench(this, cx, |workbench, window, cx| {- drop(workbench.disconnect_session(session_id.to_owned(), false, true, window, cx));+ drop(workbench.disconnect_session(session_id.to_owned(), false, Debuggee::Terminate, window, cx));if show_user {workbench.notify_error(message);}diff --git a/native/crates/app/src/workbench/debug_view.rs b/native/crates/app/src/workbench/debug_view.rsindex e7bc156bda8..642e24a2b7c 100644--- a/native/crates/app/src/workbench/debug_view.rs+++ b/native/crates/app/src/workbench/debug_view.rs@@ -9,6 +9,7 @@ use gpui::{ClickEvent, Context, Div, KeyDownEvent, MouseButton, MouseDownEvent,use serde_json::{Value, json};use super::Workbench;+use super::call_stack_menu::CallStackItem;use super::hover::{HoverContent, HoverOptions};use super::input_box_view::{InputId, InputLook};use crate::debug::session::{State, Variable};@@ -491,6 +492,7 @@ impl Workbench {fn call_stack_rows(&self, cx: &mut Context<Self>) -> Vec<gpui::AnyElement> {let mut rows = Vec::new();+ let call_stack_menu = |item: CallStackItem| cx.listener(move |workbench, event: &MouseDownEvent, window, cx| workbench.show_call_stack_menu(&item, gpui::Bounds::new(event.position, Default::default()), window, cx));let several = self.debug.sessions.iter().filter(|session| session.parent.is_none() || session.options["compact"] != true).count() > 1;let label_background = self.color("debugView.stateLabelBackground");let label_foreground = self.color("debugView.stateLabelForeground");@@ -505,13 +507,15 @@ impl Workbench {State::Initializing => "Initializing".into(),State::Inactive => String::new(),};- rows.push(self.debug_row(format!("session/{}", session.id), 0, Some(true)).child(self.icon("debug-alt-small", 16., 16., self.foreground_or("icon.foreground"))).child(session.name.clone()).child(state_label(state)).into_any_element());+ let item = CallStackItem::Session(session.id.clone());+ rows.push(self.debug_row(format!("session/{}", session.id), 0, Some(true)).child(self.icon("debug-alt-small", 16., 16., self.foreground_or("icon.foreground"))).child(session.name.clone()).child(state_label(state)).on_mouse_down(MouseButton::Right, call_stack_menu(item)).into_any_element());}for thread in &session.threads {let thread_key = format!("thread/{}/{}", session.id, thread.id);let show_thread = session.threads.len() > 1 || several;if show_thread {- rows.push(self.debug_row(thread_key.clone(), depth, Some(true)).child(thread.name.clone()).child(state_label(thread.state_label())).into_any_element());+ let item = CallStackItem::Thread(session.id.clone(), thread.id);+ rows.push(self.debug_row(thread_key.clone(), depth, Some(true)).child(thread.name.clone()).child(state_label(thread.state_label())).on_mouse_down(MouseButton::Right, call_stack_menu(item)).into_any_element());}let frame_depth = depth + usize::from(show_thread);let frames = &thread.frames;@@ -538,8 +542,9 @@ impl Workbench {index += run - 1;continue;}+ let frame_menu = call_stack_menu(CallStackItem::Frame(session.id.clone(), thread.id, index - 1));if frame.presentation_hint.as_deref() == Some("label") {- rows.push(self.debug_row(format!("frame/{}/{}", session.id, frame.id), frame_depth, None).justify_center().italic().text_color(self.color("descriptionForeground")).child(frame.name.clone()).into_any_element());+ rows.push(self.debug_row(format!("frame/{}/{}", session.id, frame.id), frame_depth, None).justify_center().italic().text_color(self.color("descriptionForeground")).child(frame.name.clone()).on_mouse_down(MouseButton::Right, frame_menu).into_any_element());continue;}let focused = self.debug.focus.session.as_deref() == Some(session.id.as_str()) && self.debug.focus.frame == Some(frame.id);@@ -551,6 +556,7 @@ impl Workbench {.when(frame.deemphasized(), |row| row.opacity(0.7)).child(div().flex_1().min_w_0().overflow_hidden().whitespace_nowrap().text_ellipsis().child(frame.name.clone())).child(div().flex_none().mr(px(8.)).text_size(px(11.)).text_color(description).child(file))+ .on_mouse_down(MouseButton::Right, frame_menu).on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {let focus = super::debug_service::DebugFocus { session: Some(session_id.clone()), thread: Some(thread_id), frame: Some(frame_id) };workbench.set_debug_focus(focus, super::debug_service::Reveal::PreservingFocus, window, cx);diff --git a/port/fixtures/ui-pair/debug/call-stack-menu.json b/port/fixtures/ui-pair/debug/call-stack-menu.jsonnew file mode 100644index 00000000000..b9fdc615343--- /dev/null+++ b/port/fixtures/ui-pair/debug/call-stack-menu.json@@ -0,0 +1,85 @@+[+ {+ "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": [+ 110,+ 403+ ],+ "foreground": true+ },+ {+ "wait": 1000+ },+ {+ "shot": "frame-menu"+ }+]diff --git a/port/ledger.md b/port/ledger.mdindex e55f3838654..fa992ab2a16 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 | 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] disassembly_view.rs: the instruction table has no keyboard focus, selection or column sash (disassemblyView.ts WorkbenchTable) <br> [3 M] debug_view.rs: the Call Stack view has no context menu (DebugCallStackContext: the session and thread commands, Restart Frame, Copy Call Stack, Open Disassembly View) <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 M] lazy variables: `presentationHint.lazy` rows and their reveal button (baseDebugView.ts `lazyButton`) not ported in the hover, Variables or Watch <br> [3 M] debug_hover.rs: Alt+click on an expandable hover row (abstractTree.ts `toggleCollapsed(location, recursive)`) expands one level, not the whole subtree <br> [3 M] debug_hover.rs: the hover tree has no find widget (abstractTree.ts `FindController`, `list.find`) | 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 (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 (cargo test -p app disassembly a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints); shortcuts in port/notes.md |+| workbench/contrib/debug | workbench contribution | M16 | ported | [3 M] disassembly_view.rs: the instruction table has no keyboard focus, selection or column sash (disassemblyView.ts WorkbenchTable) <br> [3 M] debug_view.rs: against the reference with js-debug (ui-pair `debug/call-stack-menu.json`, `FOLDER=port/fixtures/debug-node`) the Call Stack has no row for the child session `app.js` with its `Paused On Breakpoint` label, the folded frames read `Show 7 More Stack Frames` instead of `Show 7 More: Skipped by skipFiles`, and a right-clicked row gets no focus outline <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 M] lazy variables: `presentationHint.lazy` rows and their reveal button (baseDebugView.ts `lazyButton`) not ported in the hover, Variables or Watch <br> [3 M] debug_hover.rs: Alt+click on an expandable hover row (abstractTree.ts `toggleCollapsed(location, recursive)`) expands one level, not the whole subtree <br> [3 M] debug_hover.rs: the hover tree has no find widget (abstractTree.ts `FindController`, `list.find`) | 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 (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 (cargo test -p app disassembly a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints); 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 |