Visual Studio Code, rebuilt in Rust
Rust
feat(debug): open a variable's memory in the hex editor
rokartur4c2d5148a749
diff --git a/native/crates/app/src/main_thread_commands.rs b/native/crates/app/src/main_thread_commands.rsindex 0ebc8bfc3e9..11b04e8bd05 100644--- a/native/crates/app/src/main_thread_commands.rs+++ b/native/crates/app/src/main_thread_commands.rs@@ -117,6 +117,7 @@ impl Workbench {("MainThreadWorkspace", "$requestWorkspaceTrust") => self.request_workspace_trust(&arg(0), window, cx),("MainThreadWorkspace", "$isResourceTrusted") => self.is_resource_trusted(&arg(0)),("MainThreadWorkspace", "$resolveDecoding" | "$validateDetectedEncoding" | "$resolveEncoding") => Outcome::Ready(Ok(self.resolve_text_file_encoding(&request.method, &arg(0), &arg(1), &arg(2)))),+ ("workbench", "debugMemory") => self.debug_memory_request(&request.args, cx),("workbench", "defaultSettingsContent") => Outcome::Ready(Ok(self.default_settings_content(&arg(0)))),("MainThreadWorkspace", "$loadCertificates") => self.load_certificates(cx),("MainThreadWorkspace", "$lookupAuthorization") => self.lookup_authorization(&arg(0), window, cx),diff --git a/native/crates/app/src/menus.rs b/native/crates/app/src/menus.rsindex a9c595fedd1..d588f715eb2 100644--- a/native/crates/app/src/menus.rs+++ b/native/crates/app/src/menus.rs@@ -556,7 +556,9 @@ const WORKBENCH_MENUS: &[Row] = &[(MenuId::ExtensionContext, None, "workbench.extensions.action.removeExtensionFromWorkspaceRecommendations", "Remove from Workspace Recommendations", "3_recommendations", 2., Some("workbenchState != 'empty' && !isBuiltinExtension && isExtensionWorkspaceRecommended"), None),(MenuId::ViewContainerTitle, None, "workbench.action.debug.selectandstart", "Start Additional Session", "", 10., Some("viewContainer == 'workbench.view.debug' && debugState != 'inactive' && (config.debug.toolBarLocation == 'docked' || config.debug.hideLauncherWhileDebugging)"), None),// debug.contribution.ts `registerDebugViewMenuItem(MenuId.DebugVariablesContext/DebugHoverContext/DebugWatchContext, ...)`.- // shortcut: the `inline` View Binary Data items wait for the rows' action bars (ledger debug row).+ (MenuId::DebugVariablesContext, None, "workbench.debug.viewlet.action.viewMemory", "View Binary Data", "inline", 15., Some("canViewMemory"), Some("inDebugMode")),+ (MenuId::DebugHoverContext, None, "workbench.debug.viewlet.action.viewMemory", "View Binary Data", "inline", 15., Some("canViewMemory"), Some("inDebugMode")),+ (MenuId::DebugWatchContext, None, "workbench.debug.viewlet.action.viewMemory", "View Binary Data", "inline", 10., Some("canViewMemory"), None),(MenuId::DebugVariablesContext, None, "debug.setVariable", "Set Value", "3_modification", 10., Some("debugSetVariableSupported || variableEvaluateNamePresent && debugSetExpressionSupported"), Some("!variableIsReadonly")),(MenuId::DebugVariablesContext, None, "workbench.debug.viewlet.action.copyValue", "Copy Value", "5_cutcopypaste", 10., None, None),(MenuId::NotebookVariablesContext, None, "workbench.debug.viewlet.action.copyWorkspaceVariableValue", "Copy Value", "navigation", 20., Some("variableValue"), None),@@ -1122,6 +1124,8 @@ pub fn command_icons(extensions: &[ScannedExtension]) -> std::collections::HashMlet mut icons = crate::workbench::scm_actions::command_icons();// toggleWordWrap.ts: the editor title items' `Codicon.wordWrap`.icons.insert("editor.action.toggleWordWrap".to_string(), CommandIcon::Codicon("word-wrap".into()));+ // debugIcons.ts `debugInspectMemory`.+ icons.insert("workbench.debug.viewlet.action.viewMemory".to_string(), CommandIcon::Codicon("debug-inspect-memory".into()));// localHistory.ts `LOCAL_HISTORY_ICON_RESTORE`.icons.insert("workbench.action.localHistory.restoreViaEditor".to_string(), CommandIcon::Codicon("check".into()));icons.insert("workbench.files.action.acceptLocalChanges".to_string(), CommandIcon::Codicon("check".into()));diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rsindex e8da000fcc4..444f3f23374 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -27,6 +27,7 @@ mod call_stack_menu;mod variable_menu;mod debug_commands;mod debug_console;+mod debug_memory;mod problems_quick_fix;mod problems_table;pub(crate) mod modal_editor_group;diff --git a/native/crates/app/src/workbench/debug_commands.rs b/native/crates/app/src/workbench/debug_commands.rsindex f4fdf59374c..8c857694d78 100644--- a/native/crates/app/src/workbench/debug_commands.rs+++ b/native/crates/app/src/workbench/debug_commands.rs@@ -22,6 +22,7 @@ pub const VIEWLET_ID: &str = "workbench.view.debug";impl Workbench {pub(super) fn register_debug_commands(&mut self) {self.register_variable_menu_commands();+ self.register_debug_memory_commands();let start = |no_debug: bool| {move |workbench: &mut Workbench, _: Vec<Value>, window: &mut Window, cx: &mut Context<Workbench>| {if let Some((folder, name, debug_type)) = workbench.selected_dynamic() {diff --git a/native/crates/app/src/workbench/debug_hover.rs b/native/crates/app/src/workbench/debug_hover.rsindex f061c4bc110..949f293d744 100644--- a/native/crates/app/src/workbench/debug_hover.rs+++ b/native/crates/app/src/workbench/debug_hover.rs@@ -65,6 +65,8 @@ pub(super) struct DebugHover {/// The tree's focused and selected rows by their path.focused: Option<String>,selected: Option<String>,+ /// The row under the mouse, whose action bar shows.+ hovered: Option<String>,tree_scroll: ScrollHandle,focus_on_show: bool,/// Restarts the fade-in of each new value.@@ -123,6 +125,7 @@ impl DebugHover {expanded: HashSet::new(),focused: None,selected: None,+ hovered: None,tree_scroll: ScrollHandle::new(),focus_on_show: false,shows: 0,@@ -530,7 +533,7 @@ impl Workbench {let padding = if find_open { FIND_PADDING } else { 0. };let height = tree_height(editor_height, editor_top, tree_rows.len(), padding, hovered_line_top);let tree_focused = self.debug_hover_focus.is_focused(window);- let rows = tree_rows.into_iter().map(|row| self.debug_hover_row(row, &shown.session_id, tree_focused, cx));+ let rows = tree_rows.into_iter().map(|row| self.debug_hover_row(row, &shown.session_id, tree_focused, window, cx));let rows = div().id("debug-hover-tree").debug_selector(|| "debug-hover-tree".into())@@ -737,7 +740,7 @@ impl Workbench {}/// A `VariablesRenderer` row; a click toggles an expandable one without focusing the tree (`mouseSupport: false`).- fn debug_hover_row(&self, row: TreeRow<'_>, session: &str, tree_focused: bool, cx: &mut Context<Self>) -> AnyElement {+ fn debug_hover_row(&self, row: TreeRow<'_>, session: &str, tree_focused: bool, window: &Window, cx: &mut Context<Self>) -> AnyElement {let expandable = !matches!(row.children, HoverChildren::None);let foreground = self.foreground_or("icon.foreground");// tree.css `.monaco-tl-twistie`: 16px wide, `padding-right: 6px`, the chevron moved 3px right.@@ -756,15 +759,23 @@ impl Workbench {// abstractTree.ts `TreeRenderer.DefaultIndent` (8px) plus `workbench.tree.indent` per level.let indent = 8. + INDENT * row.depth as f32;let lazy_button = row.variable.is_lazy().then(|| self.lazy_button(session, row.parent_reference, &row.variable, &row.key, cx));- let focused = self.debug_hover.focused.as_ref() == Some(&row.key);- let group = gpui::SharedString::from(row.key.clone());- let actions = match &row.source {- RowSource::Variable => self.visualizer_actions(&(session.to_owned(), row.parent_reference, row.variable.name.clone()), &group, focused, cx),- RowSource::Visualized { original: Some(original) } => Some(self.remove_visualizer_action(&row.key, original.clone(), &group, focused, cx)),- RowSource::Visualized { original: None } => None,+ let shows_actions = [&self.debug_hover.focused, &self.debug_hover.hovered].contains(&&Some(row.key.clone()));+ let menu_row = matches!(row.source, RowSource::Variable).then(|| VariableMenuRow::Variable { menu: MenuId::DebugHoverContext, session: session.to_owned(), parent_reference: row.parent_reference, variable: row.variable.clone().into_owned() });+ let actions = match (&row.source, &menu_row) {+ (RowSource::Variable, Some(menu_row)) => {+ let visualizers = self.visualizer_actions(&(session.to_owned(), row.parent_reference, row.variable.name.clone()), cx);+ Some(self.row_action_bar(shows_actions).child(self.variable_inline_actions(menu_row, window, cx)).children(visualizers).into_any_element())+ }+ (RowSource::Visualized { original: Some(original) }, _) => Some(self.remove_visualizer_action(&row.key, original.clone(), shows_actions, cx)),+ _ => None,};let label = self.expression_label(&row.variable, &row.highlights, lazy_button).font_family(super::debug_view::EXPRESSION_FONT).text_size(px(super::debug_view::EXPRESSION_FONT_SIZE));- let mut element = div().id(group.clone()).group(group).h(px(ROW_HEIGHT)).flex().items_center().pl(px(indent)).child(twistie).child(label).children(actions);+ let hovered = row.key.clone();+ let mut element = div().id(gpui::SharedString::from(row.key.clone())).h(px(ROW_HEIGHT)).flex().items_center().pl(px(indent)).child(twistie).child(label).children(actions);+ element = element.on_hover(cx.listener(move |workbench, entered: &bool, _, cx| {+ super::debug_view::set_hovered(&mut workbench.debug_hover.hovered, &hovered, *entered);+ cx.notify();+ }));element = element.on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| {if expandable {workbench.toggle_debug_hover_row(&key, &session_id, &children, !expanded, event.modifiers().alt, window, cx);@@ -773,13 +784,12 @@ impl Workbench {workbench.debug_hover.selected = Some(key.clone());cx.notify();}));- if let RowSource::Variable = row.source {- let (menu_session, parent_reference, variable) = (session.to_owned(), row.parent_reference, row.variable.clone().into_owned());+ if let Some(menu_row) = menu_row {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);+ workbench.show_variable_menu(menu_row.clone(), 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.if focused || selected {diff --git a/native/crates/app/src/workbench/debug_memory.rs b/native/crates/app/src/workbench/debug_memory.rsnew file mode 100644index 00000000000..15e67248125--- /dev/null+++ b/native/crates/app/src/workbench/debug_memory.rs@@ -0,0 +1,205 @@+//! debugMemory.ts `DebugMemoryFileSystemProvider` over debugModel.ts `MemoryRegion`, which the extension host's+//! `workspace.fs` reaches through `main_thread_files.rs`, and variablesView.ts VIEW_MEMORY_ID, which opens a+//! variable's memory in the hex editor.++use std::sync::LazyLock;++use base64::Engine;+use exthost::main_thread_files::DEBUG_MEMORY_SCHEME;+use futures::channel::oneshot;+use gpui::{Context, Window};+use regex::Regex;+use serde_json::{Value, json};++use super::Workbench;+use super::debug_service::{answer, on_workbench};+use crate::commands::Outcome;+use crate::debug::session::State;++pub(super) const VIEW_MEMORY_ID: &str = "workbench.debug.viewlet.action.viewMemory";+const HEX_EDITOR_EXTENSION_ID: &str = "ms-vscode.hexeditor";+const HEX_EDITOR_EDITOR_ID: &str = "hexEditor.hexedit";++/// The most bytes one read or write moves: the hex editor asks for 4 KB pages, a larger range comes from no adapter.+const MAX_RANGE: u64 = 1 << 24;+/// `Number.MAX_SAFE_INTEGER`: the DAP offset is a JavaScript number.+const MAX_OFFSET: u64 = (1 << 53) - 1;++static RANGE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"range=([0-9]+):([0-9]+)").unwrap());++/// A `vscode-debug-memory` resource: its session, memory reference and `range=from:to` query.+#[derive(Debug, PartialEq)]+struct MemoryResource {+ session_id: String,+ memory_reference: String,+ range: Option<(u64, u64)>,+}++/// debugModel.ts `getUriForDebugMemory` without a range.+pub(super) fn memory_uri(session_id: &str, memory_reference: &str) -> Value {+ let path = format!("/{}/memory.bin", super::content_hover::encode_uri_component(memory_reference));+ json!({ "$mid": 1, "scheme": DEBUG_MEMORY_SCHEME, "authority": session_id, "path": path, "query": "" })+}++/// debugMemory.ts `parseUri`. The range comes from an extension: it must be in order, a JavaScript integer, and at most+/// `MAX_RANGE` long.+fn parse_memory_uri(uri: &Value) -> Result<MemoryResource, Value> {+ let scheme = uri["scheme"].as_str().unwrap_or_default();+ if scheme != DEBUG_MEMORY_SCHEME {+ return Err(provider_error(files::FILE_NOT_FOUND, format!("Cannot open file with scheme {scheme}")));+ }+ let memory_reference = uri["path"].as_str().unwrap_or_default().split('/').nth(1).map(crate::uri::percent_decode).unwrap_or_default();+ if memory_reference.is_empty() {+ return Err(provider_error(files::FILE_NOT_FOUND, "Memory reference not found"));+ }+ let range = match RANGE.captures(uri["query"].as_str().unwrap_or_default()) {+ None => None,+ Some(captures) => {+ let (from, to) = (captures[1].parse::<u64>(), captures[2].parse::<u64>());+ match (from, to) {+ (Ok(from), Ok(to)) if from <= to && to <= MAX_OFFSET && to - from <= MAX_RANGE => Some((from, to)),+ _ => return Err(provider_error(files::FILE_NOT_FOUND, format!("Invalid memory range {}", &captures[0]))),+ }+ }+ };+ Ok(MemoryResource { session_id: uri["authority"].as_str().unwrap_or_default().to_owned(), memory_reference, range })+}++fn provider_error(code: &str, message: impl Into<String>) -> Value {+ let error = files::provider_error(code, message);+ json!({ "name": error.name, "message": error.message })+}++/// `readFile` over `MemoryRegion.read`: the file service reads the provider with `read` (it has no `FileReadWrite`),+/// which stops at the first unreadable byte. The readable part is the adapter's data, zero padded or cut to length.+fn memory_bytes(body: &Value, length: usize) -> Result<Vec<u8>, String> {+ let data = body["data"].as_str().unwrap_or_default();+ if data.is_empty() {+ return Ok(Vec::new());+ }+ let mut bytes = base64::engine::general_purpose::STANDARD.decode(data).map_err(|_| "Invalid base64 data from debug adapter".to_owned())?;+ let unreadable = usize::try_from(body["unreadableBytes"].as_u64().unwrap_or_default()).unwrap_or(usize::MAX);+ bytes.resize(length.saturating_sub(unreadable), 0);+ Ok(bytes)+}++impl Workbench {+ pub(super) fn register_debug_memory_commands(&mut self) {+ self.commands.register(VIEW_MEMORY_ID, |workbench, args, window, cx| workbench.view_memory(args.first().unwrap_or(&Value::Null), window, cx));+ }++ /// VIEW_MEMORY_ID on a Variables or hover row's `IVariablesContext`, or a Watch row's expression: the memory in the+ /// hex editor beside the active group, once the extension is installed.+ fn view_memory(&mut self, arg: &Value, window: &mut Window, cx: &mut Context<Self>) -> Outcome {+ let target = match arg["sessionId"].as_str() {+ Some(session_id) => arg["variable"]["memoryReference"].as_str().map(|reference| (session_id.to_owned(), reference.to_owned())),+ None => {+ let reference = match arg["watchExpressionId"].as_str() {+ Some(id) => self.debug.watch_values.get(id).and_then(|value| value.memory_reference.clone()),+ None => arg["memoryReference"].as_str().map(str::to_owned),+ };+ reference.zip(self.debug.focus.session.clone()).map(|(reference, session_id)| (session_id, reference))+ }+ };+ let Some((session_id, memory_reference)) = target.filter(|(session_id, reference)| !session_id.is_empty() && !reference.is_empty()) else { return Outcome::done() };+ let resource = memory_uri(&session_id, &memory_reference);+ if self.extensions.iter().any(|extension| extension.id.eq_ignore_ascii_case(HEX_EDITOR_EXTENSION_ID)) {+ return self.open_memory(resource, window, cx);+ }+ // `tryInstallHexEditor`: the install shows its own errors, a refused prompt opens nothing.+ let justification = json!("Inspecting binary data requires this extension.");+ let Outcome::Pending(installed) = self.install_with_justification(HEX_EDITOR_EXTENSION_ID.to_owned(), None, !crate::product::is_stable(), justification, window, cx) else { return Outcome::done() };+ cx.spawn_in(window, async move |this, cx| {+ if matches!(installed.await, Ok(Ok(_))) {+ let _ = on_workbench(&this, cx, |workbench, window, cx| drop(workbench.open_memory(resource, window, cx)));+ }+ })+ .detach();+ Outcome::done()+ }++ fn open_memory(&mut self, resource: Value, window: &mut Window, cx: &mut Context<Self>) -> Outcome {+ if !self.debug.memory_resources.contains(&resource) {+ self.debug.memory_resources.push(resource.clone());+ }+ self.activate_column(&json!(super::webview_panels::SIDE_GROUP), None);+ self.open_with_resolver(&resource, Some(HEX_EDITOR_EDITOR_ID), json!({ "revealIfOpened": true }), window, cx)+ }++ /// A DebugMemoryFileSystemProvider `stat`, `readFile` or `writeFile` the extension host forwards.+ pub(crate) fn debug_memory_request(&mut self, args: &[Value], cx: &mut Context<Self>) -> Outcome {+ let memory = match args.get(1).map(parse_memory_uri) {+ Some(Ok(memory)) => memory,+ Some(Err(error)) => return Outcome::Ready(Err(error)),+ None => return Outcome::Ready(Err(provider_error(files::FILE_NOT_FOUND, "Missing resource"))),+ };+ let Some(session) = self.debug.session(&memory.session_id) else { return Outcome::Ready(Err(provider_error(files::FILE_NOT_FOUND, "Debug session not found"))) };+ let (can_read, can_write) = (session.capabilities["supportsReadMemoryRequest"] == true, session.capabilities["supportsWriteMemoryRequest"] == true);+ let operation = args[0].as_str().unwrap_or_default();+ if operation == "stat" {+ return Outcome::Ready(Ok(json!({ "readonly": !can_write })));+ }+ let Some((from, to)) = memory.range else { return Outcome::Ready(Err(provider_error(files::FILE_NOT_FOUND, "Range must be present to read a file"))) };+ let reply = match operation {+ // rawDebugSession.ts `readMemory` answers nothing without the capability: the memory is unreadable.+ "readFile" if !can_read => return Outcome::Ready(Ok(json!([]))),+ "readFile" => {+ let length = (to - from) as usize;+ let request = self.dap_request(&memory.session_id, "readMemory", json!({ "memoryReference": memory.memory_reference, "offset": from, "count": length }));+ spawn_answer(cx, async move {+ let body = answer(request).await.map_err(|error| provider_error(files::UNKNOWN, error))?;+ memory_bytes(&body, length).map(|bytes| json!(bytes)).map_err(|error| provider_error(files::UNKNOWN, error))+ })+ }+ "writeFile" => {+ let data = match serde_json::from_value::<Vec<u8>>(args.get(2).cloned().unwrap_or_default()) {+ Ok(data) if data.len() as u64 <= MAX_RANGE => data,+ _ => return Outcome::Ready(Err(provider_error(files::UNKNOWN, "Invalid memory contents"))),+ };+ if !can_write {+ return Outcome::Ready(Err(provider_error(files::NO_PERMISSIONS, "Not allowed")));+ }+ let data = base64::engine::general_purpose::STANDARD.encode(data);+ let request = self.dap_request(&memory.session_id, "writeMemory", json!({ "memoryReference": memory.memory_reference, "offset": from, "data": data, "allowPartial": true }));+ spawn_answer(cx, async move { answer(request).await.map(|_| Value::Null).map_err(|error| provider_error(files::UNKNOWN, error)) })+ }+ _ => return Outcome::Ready(Err(provider_error(files::NO_PERMISSIONS, "Not allowed"))),+ };+ Outcome::Pending(reply)+ }++ /// debugMemory.ts `watch`: the session's memory resources are deleted once it runs or ends (the hex editor closes+ /// them), and changed when a `memory` event invalidates their reference.+ pub(super) fn debug_memory_session_changed(&mut self, session_id: &str, invalidated_reference: Option<&str>) {+ let focused_thread = self.debug.focus.thread.filter(|_| self.debug.focus.session.as_deref() == Some(session_id));+ let state = self.debug.session(session_id).map_or(State::Inactive, |session| session.state(focused_thread));+ let ran = matches!(state, State::Running | State::Inactive) && invalidated_reference.is_none();+ let mut touched = Vec::new();+ for resource in &self.debug.memory_resources {+ let Ok(memory) = parse_memory_uri(resource) else { continue };+ if memory.session_id == session_id && (ran || invalidated_reference == Some(memory.memory_reference.as_str())) {+ touched.push(resource.clone());+ }+ }+ if touched.is_empty() {+ return;+ }+ let event = match ran {+ true => {+ self.debug.memory_resources.retain(|resource| !touched.contains(resource));+ json!({ "created": [], "changed": [], "deleted": touched })+ }+ false => json!({ "created": [], "changed": touched, "deleted": [] }),+ };+ drop(self.host.call("ExtHostFileSystemEventService", "$onFileEvent", vec![event]));+ }+}++fn spawn_answer(cx: &mut Context<Workbench>, answer: impl Future<Output = Result<Value, Value>> + 'static) -> oneshot::Receiver<Result<Value, Value>> {+ let (sender, receiver) = oneshot::channel();+ cx.spawn(async move |_, _| drop(sender.send(answer.await))).detach();+ receiver+}++#[cfg(test)]+mod tests;diff --git a/native/crates/app/src/workbench/debug_memory/tests.rs b/native/crates/app/src/workbench/debug_memory/tests.rsnew file mode 100644index 00000000000..ec9fd721ac2--- /dev/null+++ b/native/crates/app/src/workbench/debug_memory/tests.rs@@ -0,0 +1,131 @@+use base64::Engine;+use gpui::TestAppContext;+use serde_json::{Value, json};++use super::*;+use crate::debug::session::Variable;+use crate::menus::{MenuAction, MenuId, menu_group_actions};+use crate::workbench::variable_menu::VariableMenuRow;+use crate::workbench::variable_menu::tests::{respond, sent_request, stopped_session};++fn ranged(session_id: &str, reference: &str, query: &str) -> Value {+ let mut uri = memory_uri(session_id, reference);+ uri["query"] = json!(query);+ uri+}++#[test]+fn a_memory_uri_round_trips_and_rejects_bad_ranges() {+ let uri = ranged("s", "0x10/a b", "?range=16:32");+ assert_eq!(uri["path"], "/0x10%2Fa%20b/memory.bin");+ assert_eq!(parse_memory_uri(&uri), Ok(MemoryResource { session_id: "s".into(), memory_reference: "0x10/a b".into(), range: Some((16, 32)) }));+ assert_eq!(parse_memory_uri(&ranged("s", "r", "")).map(|memory| memory.range), Ok(None));+ for query in ["?range=32:16", "?range=0:16777217", "?range=9007199254740992:9007199254740992", "?range=0:99999999999999999999999"] {+ assert!(parse_memory_uri(&ranged("s", "r", query)).is_err(), "{query} is refused");+ }+ assert!(parse_memory_uri(&ranged("s", "", "?range=0:1")).is_err(), "no memory reference");+ assert!(parse_memory_uri(&json!({ "scheme": "file", "path": "/r/memory.bin" })).is_err());+}++/// debugModel.ts `MemoryRegion.read` through debugMemory.ts `read`: the file ends at the first unreadable byte,+/// short data reads as zeros and extra data is dropped.+#[test]+fn memory_bytes_end_at_the_first_unreadable_byte() {+ let data = |bytes: &[u8]| base64::engine::general_purpose::STANDARD.encode(bytes);+ assert_eq!(memory_bytes(&json!({ "address": "0x0", "data": data(&[1, 2, 3, 4, 5]) }), 4), Ok(vec![1, 2, 3, 4]));+ assert_eq!(memory_bytes(&json!({ "address": "0x0", "data": data(&[1, 2]) }), 4), Ok(vec![1, 2, 0, 0]));+ assert_eq!(memory_bytes(&json!({ "address": "0x0", "data": data(&[1, 2, 3, 4]), "unreadableBytes": 3 }), 4), Ok(vec![1]));+ assert_eq!(memory_bytes(&json!({ "address": "0x0", "data": data(&[1]), "unreadableBytes": 99999999999u64 }), 2), Ok(vec![]));+ assert_eq!(memory_bytes(&json!({ "address": "0x0", "data": "", "unreadableBytes": 2 }), 2), Ok(vec![]));+ assert!(memory_bytes(&json!({ "address": "0x0", "data": "!!" }), 2).is_err());+}++fn request(workbench: &gpui::Entity<Workbench>, cx: &mut gpui::VisualTestContext, args: Vec<Value>) -> Outcome {+ workbench.update_in(cx, |workbench, _, cx| workbench.debug_memory_request(&args, cx))+}++fn settled(outcome: Outcome) -> Result<Value, Value> {+ match outcome {+ Outcome::Ready(result) => result,+ Outcome::Pending(mut receiver) => receiver.try_recv().unwrap().expect("answered"),+ }+}++/// debugMemory.ts `stat`, `readFile` and `writeFile` over the adapter's `readMemory` and `writeMemory`.+#[gpui::test]+fn the_memory_provider_reads_and_writes_through_the_adapter(cx: &mut TestAppContext) {+ let (workbench, cx, host) = stopped_session(cx, json!({ "supportsReadMemoryRequest": true }));+ let uri = ranged("s", "0x10", "?range=4:8");+ assert_eq!(settled(request(&workbench, cx, vec![json!("stat"), uri.clone()])), Ok(json!({ "readonly": true })));++ let read = request(&workbench, cx, vec![json!("readFile"), uri.clone()]);+ cx.run_until_parked();+ let sent = sent_request(&host, "readMemory");+ assert_eq!(sent["arguments"], json!({ "memoryReference": "0x10", "offset": 4, "count": 4 }));+ respond(&workbench, cx, &sent, true, json!({ "address": "0x14", "data": "AQID" }));+ assert_eq!(settled(read), Ok(json!([1, 2, 3, 0])));++ let refused = settled(request(&workbench, cx, vec![json!("writeFile"), uri.clone(), json!([9])])).unwrap_err();+ assert_eq!(refused["name"], "NoPermissions (FileSystemError)");+ workbench.update_in(cx, |workbench, _, _| workbench.debug.sessions[0].capabilities["supportsWriteMemoryRequest"] = json!(true));+ let write = request(&workbench, cx, vec![json!("writeFile"), uri.clone(), json!([9, 8])]);+ cx.run_until_parked();+ let sent = sent_request(&host, "writeMemory");+ assert_eq!(sent["arguments"], json!({ "memoryReference": "0x10", "offset": 4, "data": "CQg=", "allowPartial": true }));+ respond(&workbench, cx, &sent, true, json!({}));+ assert_eq!(settled(write), Ok(Value::Null));++ let unknown = settled(request(&workbench, cx, vec![json!("readFile"), ranged("other", "0x10", "?range=0:1")])).unwrap_err();+ assert_eq!(unknown["name"], "EntryNotFound (FileSystemError)");+ let unranged = settled(request(&workbench, cx, vec![json!("readFile"), ranged("s", "0x10", "")])).unwrap_err();+ assert_eq!(unranged["message"], "Range must be present to read a file");+}++/// debugMemory.ts `watch`: running the session deletes its open memory, a `memory` event changes it.+#[gpui::test]+fn the_session_reports_its_memory_changes(cx: &mut TestAppContext) {+ let (workbench, cx, host) = stopped_session(cx, json!({ "supportsReadMemoryRequest": true }));+ let resource = memory_uri("s", "0x10");+ let events = |host: &std::sync::mpsc::Receiver<crate::host_sync::HostMessage>| host.try_iter().filter(|message| message.method == "$onFileEvent").map(|message| message.args[0].clone()).collect::<Vec<_>>();+ workbench.update_in(cx, |workbench, _, _| {+ workbench.debug.memory_resources.push(resource.clone());+ workbench.debug_memory_session_changed("s", Some("0x99"));+ });+ assert!(events(&host).is_empty(), "another reference's event changes nothing");+ workbench.update_in(cx, |workbench, _, _| workbench.debug_memory_session_changed("s", Some("0x10")));+ assert_eq!(events(&host), [json!({ "created": [], "changed": [resource.clone()], "deleted": [] })]);+ workbench.update_in(cx, |workbench, _, _| {+ workbench.debug.sessions[0].continue_threads(None);+ workbench.debug_memory_session_changed("s", None);+ });+ assert_eq!(events(&host), [json!({ "created": [], "changed": [], "deleted": [resource] })]);+ assert!(workbench.read_with(cx, |workbench, _| workbench.debug.memory_resources.is_empty()));+}++/// debug.contribution.ts: View Binary Data is inline on a row whose variable has a `memoryReference`, in a session that+/// `supportsReadMemoryRequest`.+#[gpui::test]+fn view_binary_data_is_inline_on_memory_rows(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = stopped_session(cx, json!({ "supportsReadMemoryRequest": true }));+ let with_memory = Variable { name: "buf".into(), value: "Buffer(4)".into(), memory_reference: Some("0x10".into()), ..Variable::default() };+ let inline = |row: VariableMenuRow, cx: &mut gpui::VisualTestContext| {+ workbench.update_in(cx, |workbench, window, _| {+ let mut context = workbench.key_context(window);+ let (menu, _) = workbench.variable_menu_context(&row, &mut context);+ let mut titles = Vec::new();+ for action in menu_group_actions(&workbench.menus, menu, &context, |group| group == "inline") {+ if let MenuAction::Command { title, .. } = action {+ titles.push(title);+ }+ }+ titles+ })+ };+ let variable_row = |variable: Variable| VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session: "s".into(), parent_reference: 4, variable };+ assert_eq!(inline(variable_row(with_memory.clone()), cx), ["View Binary Data"]);+ assert_eq!(inline(VariableMenuRow::Variable { menu: MenuId::DebugHoverContext, session: "s".into(), parent_reference: 4, variable: with_memory.clone() }, cx), ["View Binary Data"]);+ assert_eq!(inline(VariableMenuRow::WatchVariable { session: "s".into(), parent_reference: 4, variable: with_memory.clone() }, cx), ["View Binary Data"]);+ assert!(inline(variable_row(Variable { memory_reference: None, ..with_memory.clone() }), cx).is_empty());+ workbench.update_in(cx, |workbench, _, _| workbench.debug.sessions[0].capabilities = json!({}));+ assert!(inline(variable_row(with_memory), cx).is_empty());+}diff --git a/native/crates/app/src/workbench/debug_service.rs b/native/crates/app/src/workbench/debug_service.rsindex 999e3833ced..75879529a28 100644--- a/native/crates/app/src/workbench/debug_service.rs+++ b/native/crates/app/src/workbench/debug_service.rs@@ -86,6 +86,8 @@ pub struct DebugService {pub inline_breakpoints: super::inline_breakpoints::InlineBreakpoints,/// Watch expression results by expression id.pub watch_values: HashMap<String, Variable>,+ /// The `vscode-debug-memory` resources opened, which `debug_memory_session_changed` reports to the extension host.+ pub memory_resources: Vec<Value>,pub repl: Vec<ReplElement>,/// Sessions the extension host caches (`$sessionCached`): their DTO is the id alone.known_sessions: HashSet<String>,@@ -586,7 +588,8 @@ impl Workbench {cx.notify();}"invalidated" => self.refresh_focus(window, cx),- "exited" | "progressStart" | "progressUpdate" | "progressEnd" | "memory" | "process" | "module" => {}+ "memory" => self.debug_memory_session_changed(session_id, body["memoryReference"].as_str()),+ "exited" | "progressStart" | "progressUpdate" | "progressEnd" | "process" | "module" => {}_ => {let Some(session) = self.debug.session(session_id) else { return };let dto = self.debug.session_dto(session);@@ -943,6 +946,7 @@ impl Workbench {fn threads_continued(&mut self, session_id: &str, thread_id: Option<i64>, cx: &mut Context<Self>) {let Some(session) = self.debug.session_mut(session_id) else { return };session.continue_threads(thread_id);+ self.debug_memory_session_changed(session_id, None);if self.debug.focus.session.as_deref() == Some(session_id) && thread_id.is_none_or(|id| Some(id) == self.debug.focus.thread) {self.debug.focus.frame = None;self.close_exception_widget(cx);@@ -1379,6 +1383,7 @@ impl Workbench {}let shown_repl = self.shown_repl_session();let mut session = self.debug.sessions.remove(index);+ self.debug_memory_session_changed(session_id, None);if self.debug.sessions.is_empty() {self.debug.multi_session_view = false;}diff --git a/native/crates/app/src/workbench/debug_view.rs b/native/crates/app/src/workbench/debug_view.rsindex 4332ca539b2..a68e70c4d9d 100644--- a/native/crates/app/src/workbench/debug_view.rs+++ b/native/crates/app/src/workbench/debug_view.rs@@ -54,6 +54,8 @@ pub struct DebugView {pub selected: Option<String>,/// The list focus (listWidget.ts `setFocus`): the row last clicked or right-clicked.pub focused_row: Option<String>,+ /// The row under the mouse, whose action bar shows.+ pub hovered_row: Option<String>,/// The DOM focus of each view's tree, which turns its selection active and shows its focused row's outline.pub list_focus: std::collections::HashMap<&'static str, gpui::FocusHandle>,/// The glyph margin line under the pointer, which shows the breakpoint hint.@@ -97,6 +99,7 @@ impl DebugView {run_to_cursor: None,selected: None,focused_row: None,+ hovered_row: None,list_focus: [VARIABLES_VIEW, WATCH_VIEW, CALL_STACK_VIEW, BREAKPOINTS_VIEW, LOADED_SCRIPTS_VIEW, NOTEBOOK_VARIABLES_VIEW].into_iter().map(|id| (id, cx.focus_handle())).collect(),hint: None,widget_view: Default::default(),@@ -460,7 +463,7 @@ impl Workbench {/// selection to a clicked one.pub(super) fn debug_row(&self, key: String, depth: usize, twistie_expanded: Option<bool>, selected: bool, list_focused: bool, cx: &Context<Self>) -> gpui::Stateful<Div> {let is_focus = self.debug_view.focused_row.as_deref() == Some(key.as_str());- let (clicked, right_clicked) = (key.clone(), key.clone());+ let (clicked, right_clicked, hovered) = (key.clone(), key.clone(), key.clone());let row = div().id(gpui::SharedString::from(key.clone())).debug_selector(move || key)@@ -480,6 +483,10 @@ impl Workbench {.on_mouse_down(MouseButton::Right, cx.listener(move |workbench, _: &MouseDownEvent, _, cx| {workbench.debug_view.focused_row = Some(right_clicked.clone());cx.notify();+ }))+ .on_hover(cx.listener(move |workbench, entered: &bool, _, cx| {+ set_hovered(&mut workbench.debug_view.hovered_row, &hovered, *entered);+ cx.notify();}));let row = self.list_row_selection(row, selected, is_focus, list_focused);let foreground = self.foreground_or("icon.foreground");@@ -591,8 +598,12 @@ impl Workbench {}let lazy_button = variable.is_lazy().then(|| self.lazy_button(session, reference, variable, &key, cx));let group = gpui::SharedString::from(key.clone());- let actions = self.visualizer_actions(&visualizer_row, &group, self.debug_view.focused_row.as_deref() == Some(key.as_str()), cx);- let mut row = self.debug_row(key.clone(), depth, expandable.then_some(expanded), self.row_selected(&key), list_focused, cx).group(group).child(self.expression_label(variable, &[], lazy_button).font_family(EXPRESSION_FONT).text_size(px(EXPRESSION_FONT_SIZE))).children(actions);+ let menu_row = match in_watch {+ true => VariableMenuRow::WatchVariable { session: session.to_owned(), parent_reference: reference, variable: variable.clone() },+ false => VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session: session.to_owned(), parent_reference: reference, variable: variable.clone() },+ };+ let actions = self.row_action_bar(self.row_shows_actions(&key)).child(self.variable_inline_actions(&menu_row, window, cx)).children(self.visualizer_actions(&visualizer_row, cx));+ let mut row = self.debug_row(key.clone(), depth, expandable.then_some(expanded), self.row_selected(&key), list_focused, cx).group(group).child(self.expression_label(variable, &[], lazy_button).font_family(EXPRESSION_FONT).text_size(px(EXPRESSION_FONT_SIZE))).child(actions);// variablesView.ts `onMouseDblClick`: a variable that `canSetExpressionValue` opens its value's input.let editable = !in_watch && self.can_set_variable_value(variable);row = row.on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| {@@ -604,14 +615,8 @@ impl Workbench {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 { session: menu_session.clone(), parent_reference: reference, variable: menu_variable.clone() }- } else {- VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session: menu_session.clone(), parent_reference: reference, variable: menu_variable.clone() }- };- workbench.show_variable_menu(row, gpui::Bounds::new(event.position, Default::default()), window, cx);+ workbench.show_variable_menu(menu_row.clone(), gpui::Bounds::new(event.position, Default::default()), window, cx);}));rows.push((row.into_any_element(), depth, self.row_selected(&key)));if expanded {@@ -620,6 +625,11 @@ impl Workbench {}}+ /// debugViewlet.css `.monaco-list-row:hover .monaco-action-bar, .monaco-list-row.focused .monaco-action-bar`.+ pub(super) fn row_shows_actions(&self, key: &str) -> bool {+ self.debug_view.focused_row.as_deref() == Some(key) || self.debug_view.hovered_row.as_deref() == Some(key)+ }+pub(super) fn row_selected(&self, key: &str) -> bool {self.debug_view.selected.as_deref() == Some(key)}@@ -657,7 +667,9 @@ impl Workbench {let expandable = value.has_children();let expanded = expandable && self.row_expanded(&key, false);let (row_key, session_id, reference, id) = (key.clone(), session.clone(), value.variables_reference, expression.id.clone());- let mut row = self.debug_row(key.clone(), 0, expandable.then_some(expanded), self.row_selected(&key), list_focused, cx).child(self.expression_label(&Variable { name: expression.name.clone(), ..value.clone() }, &[], None).debug_selector(|| format!("{key}/label")).font_family(EXPRESSION_FONT).text_size(px(EXPRESSION_FONT_SIZE)));+ let menu_row = VariableMenuRow::WatchExpression { id: expression.id.clone(), name: expression.name.clone() };+ let actions = self.row_action_bar(self.row_shows_actions(&key)).child(self.variable_inline_actions(&menu_row, window, cx));+ let mut row = self.debug_row(key.clone(), 0, expandable.then_some(expanded), self.row_selected(&key), list_focused, cx).child(self.expression_label(&Variable { name: expression.name.clone(), ..value.clone() }, &[], None).debug_selector(|| format!("{key}/label")).font_family(EXPRESSION_FONT).text_size(px(EXPRESSION_FONT_SIZE))).child(actions);row = row.on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| {if event.click_count() == 2 {workbench.start_debug_view_edit(Editing::Watch(id.clone()), window, cx);@@ -667,10 +679,8 @@ 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);+ workbench.show_variable_menu(menu_row.clone(), gpui::Bounds::new(event.position, Default::default()), window, cx);}));rows.push((row.into_any_element(), 0, self.row_selected(&key)));if expanded {@@ -1120,6 +1130,15 @@ fn markdown_links(line: &str) -> Vec<(String, Option<String>)> {parts}+/// A row's `on_hover`: entering it marks it hovered, leaving it clears the mark it still holds.+pub(super) fn set_hovered(hovered: &mut Option<String>, key: &str, entered: bool) {+ if entered {+ *hovered = Some(key.to_owned());+ } else if hovered.as_deref() == Some(key) {+ *hovered = None;+ }+}+#[cfg(test)]mod tests {use std::path::Path;diff --git a/native/crates/app/src/workbench/debug_visualizers.rs b/native/crates/app/src/workbench/debug_visualizers.rsindex ca1ed9806b5..4d50aa6acc4 100644--- a/native/crates/app/src/workbench/debug_visualizers.rs+++ b/native/crates/app/src/workbench/debug_visualizers.rs@@ -256,8 +256,8 @@ impl Workbench {}/// The visualizer actions at the end of a variable row: one visualizer's own icon, several behind- /// Visualize Variable...; shown on the hovered or focused row (debugViewlet.css).- pub(super) fn visualizer_actions(&self, row: &RowKey, group: &gpui::SharedString, focused: bool, cx: &mut Context<Self>) -> Option<gpui::AnyElement> {+ /// Visualize Variable..., for the row's action bar.+ pub(super) fn visualizer_actions(&self, row: &RowKey, cx: &mut Context<Self>) -> Option<gpui::AnyElement> {let visualizers = self.debug.visualizers.applicable.get(row)?.clone();let foreground = self.foreground_or("icon.foreground");let id = format!("{}/{}/{}/viz", row.0, row.1, row.2);@@ -282,17 +282,17 @@ impl Workbench {}))}};- Some(self.row_action_bar(group, focused).child(button).into_any_element())+ Some(button.into_any_element())}/// `VisualizedVariableRenderer.renderActionBar` on a visualized variable.- pub(super) fn remove_visualizer_action(&self, key: &str, original: RowKey, group: &gpui::SharedString, focused: bool, cx: &mut Context<Self>) -> gpui::AnyElement {+ pub(super) fn remove_visualizer_action(&self, key: &str, original: RowKey, shows: bool, cx: &mut Context<Self>) -> gpui::AnyElement {let foreground = self.foreground_or("icon.foreground");let button = self.visualizer_button(&format!("{key}/remove-viz"), Some("eye".into()), "Remove Visualizer".into(), foreground).on_click(cx.listener(move |workbench, _: &ClickEvent, _, cx| {cx.stop_propagation();workbench.remove_visualizer(&original, cx);}));- self.row_action_bar(group, focused).child(button).into_any_element()+ self.row_action_bar(shows).child(button).into_any_element()}fn visualizer_button(&self, id: &str, icon: Option<String>, title: String, foreground: Rgba) -> gpui::Stateful<gpui::Div> {@@ -309,8 +309,10 @@ impl Workbench {.child(self.hover_target(gpui::SharedString::from(format!("{id}/hover")), HoverContent::Text(title), HoverOptions::action_item()))}- fn row_action_bar(&self, group: &gpui::SharedString, focused: bool) -> gpui::Div {- div().flex_none().ml_auto().flex().items_center().invisible().when(focused, |bar| bar.visible()).group_hover(group.clone(), |bar| bar.visible())+ /// debugViewlet.css: a row's `.monaco-action-bar` is `display: none` but on the hovered or focused row. A+ /// `group_hover` display change would skip the bar's prepaint and panic in its paint.+ pub(super) fn row_action_bar(&self, shown: bool) -> gpui::Div {+ div().flex_none().ml_auto().items_center().hidden().when(shown, |bar| bar.flex())}/// `VisualizedVariableRenderer`: a visualized row, then its expanded children. `original` is the variable row it@@ -334,7 +336,6 @@ impl Workbench {};let value_color = self.value_color(&Variable { value: description.to_owned(), ..Variable::default() });let group = gpui::SharedString::from(key.clone());- let focused = self.debug_view.focused_row.as_deref() == Some(key.as_str());let mut row = self.debug_row(key.clone(), depth, expandable.then_some(expanded), self.debug_view.selected.as_deref() == Some(key.as_str()), list_focused, cx).group(group.clone())@@ -350,7 +351,7 @@ impl Workbench {.child(div().ml(px(6.)).text_color(value_color).overflow_hidden().text_ellipsis().child(description.to_owned())),);if let Some(original) = original.cloned() {- row = row.child(self.remove_visualizer_action(&key, original, &group, focused, cx));+ row = row.child(self.remove_visualizer_action(&key, original, self.row_shows_actions(&key), cx));}let can_edit = item["canEdit"] == true;let (row_key, tree) = (key.clone(), tree_id.to_owned());diff --git a/native/crates/app/src/workbench/extension_management.rs b/native/crates/app/src/workbench/extension_management.rsindex 5230b55fb68..85a68f9a850 100644--- a/native/crates/app/src/workbench/extension_management.rs+++ b/native/crates/app/src/workbench/extension_management.rs@@ -170,7 +170,7 @@ impl Workbench {/// `extensionsWorkbenchService.installExtension` with `justification`: asks "Would you like to install ..." with the/// gallery extension's names before installing; Cancel ends in a `CancellationError`, which no one shows.- fn install_with_justification(&mut self, id: String, version: Option<String>, pre_release: bool, justification: Value, window: &mut Window, cx: &mut Context<Self>) -> Outcome {+ pub(super) fn install_with_justification(&mut self, id: String, version: Option<String>, pre_release: bool, justification: Value, window: &mut Window, cx: &mut Context<Self>) -> Outcome {let lookup = {let (id, version) = (id.clone(), version.clone());cx.background_executor().spawn(async move { Gallery::open_vsx(&crate::VERSION).installable_extension(&id, version.as_deref(), pre_release) })diff --git a/native/crates/app/src/workbench/variable_menu.rs b/native/crates/app/src/workbench/variable_menu.rsindex 6fb019ee34c..091c2aa4a16 100644--- a/native/crates/app/src/workbench/variable_menu.rs+++ b/native/crates/app/src/workbench/variable_menu.rs@@ -16,6 +16,7 @@ use crate::debug::session::Variable;use crate::menus::{MenuId, menu_group_actions};/// A row a variable menu opens on.+#[derive(Clone)]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 },@@ -130,6 +131,15 @@ impl Workbench {}}+ /// variablesView.ts and watchExpressionsView.ts `renderActionBar`: the menu's `inline` items for the row. The hover's+ /// `VariablesRenderer` takes them from DebugVariablesContext too.+ pub(super) fn variable_inline_actions(&self, row: &VariableMenuRow, window: &Window, cx: &mut Context<Self>) -> gpui::Div {+ let mut context = self.key_context(window);+ let (menu, args) = self.variable_menu_context(row, &mut context);+ let menu = if menu == MenuId::DebugHoverContext { MenuId::DebugVariablesContext } else { menu };+ self.inline_actions(menu, None, &context, args, self.foreground_or("icon.foreground"), cx)+ }+/// variablesView.ts `getVariablesContext` `container`: the parent scope's or variable's `toDebugProtocolObject`, or/// `{ expression }` for the hover's evaluated expression (debugHover.ts finds it in the scopes without `supportsEvaluateForHovers`).fn variable_container(&self, menu: MenuId, session: &str, parent_reference: i64) -> Value {diff --git a/port/fixtures/debug-node/.vscode/launch.json b/port/fixtures/debug-node/.vscode/launch.jsonindex 649090ed2b4..3c62052243c 100644--- a/port/fixtures/debug-node/.vscode/launch.json+++ b/port/fixtures/debug-node/.vscode/launch.json@@ -29,6 +29,12 @@"request": "launch","name": "Launch lazy.js","program": "${workspaceFolder}/lazy.js"+ },+ {+ "type": "node",+ "request": "launch",+ "name": "Launch memory.js",+ "program": "${workspaceFolder}/memory.js"}]}diff --git a/port/fixtures/debug-node/memory.js b/port/fixtures/debug-node/memory.jsnew file mode 100644index 00000000000..fdc07045767--- /dev/null+++ b/port/fixtures/debug-node/memory.js@@ -0,0 +1,7 @@+// js-debug gives a typed array a `memoryReference`, which View Binary Data opens in the hex editor.+function main() {+ const bytes = new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x68, 0x65, 0x78, 0x21, 0x00, 0xde, 0xad, 0xbe, 0xef]);+ debugger;+ console.log(bytes);+}+main();diff --git a/port/fixtures/ui-pair/debug/memory.json b/port/fixtures/ui-pair/debug/memory.jsonnew file mode 100644index 00000000000..60797868f81--- /dev/null+++ b/port/fixtures/ui-pair/debug/memory.json@@ -0,0 +1,93 @@+[+ {+ "wait": 25000+ },+ {+ "hotkey": [+ "cmd",+ "shift",+ "p"+ ],+ "foreground": true+ },+ {+ "wait": 1000+ },+ {+ "type": "Debug: Select and Start Debugging"+ },+ {+ "wait": 1500+ },+ {+ "key": "return",+ "foreground": true+ },+ {+ "wait": 1500+ },+ {+ "type": "memory"+ },+ {+ "wait": 1000+ },+ {+ "key": "return",+ "foreground": true+ },+ {+ "wait": 10000+ },+ {+ "shot": "stopped"+ },+ {+ "click": [+ 26,+ 190+ ],+ "foreground": true+ },+ {+ "wait": 2000+ },+ {+ "shot": "variables"+ },+ {+ "click": [+ 100,+ 106+ ],+ "foreground": true+ },+ {+ "wait": 1500+ },+ {+ "hover": [+ 120,+ 129+ ]+ },+ {+ "wait": 1000+ },+ {+ "shot": "row-hover"+ },+ {+ "click": [+ 289,+ 128+ ],+ "foreground": true+ },+ {+ "wait": 6000+ },+ {+ "shot": "hex-editor"+ }+]diff --git a/port/ledger.md b/port/ledger.mdindex 49da900f5b3..8a6a452fd9a 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -22,7 +22,7 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,| Milestones | M5 edit and save | done | One cursor with selection, the `coreCommands.ts` cursor and delete commands, typing with IME through GPUI's input handler, undo/redo with `editStack.ts` stops, clipboard, save and dirty state; the host hears `$acceptModelChanged`, `$acceptDirtyStateChanged`, `$acceptModelSaved` and selection changes (`editor/cursor.rs`, `editor/edit.rs`, `workbench/text_input.rs`, `host_sync.rs`). | `cargo test -p app` passes with the cursor, edit and host sync tests (including `live_host_takes_edits_and_typescript_sees_the_new_text`); typing in `notes.txt` then Cmd+S writes the file and the tab loses its dirty dot; pixel-check of the three earlier windows unchanged. || Milestones | M6 API test harness | done | Run `extensions/vscode-api-tests` against the port, so every later milestone reports a pass count against the reference baseline (`port/results/api-tests-reference.md`: folder 356/46/0, workspace 4/0/0): `--extensionDevelopmentPath` / `--extensionTestsPath` in `code-gpui`, the test runner's exit code reaching the parent, host errors and console forwarded to the port's log, a `port/tools/api-tests` script on the Studio. Open gaps: the gaps column of its unit rows. | `port/tools/api-tests` prints passing/pending/failing per suite for the port and writes them to `port/results/api-tests.md`; the run finishes (failures allowed) without a hang. || Milestones | M7 syntax colors and themes | done | TextMate grammars from `contributes.grammars` (vscode-textmate's algorithm, Oniguruma regexes), token colors from the theme's `tokenColors` and `semanticTokenColors`, bracket pair colorization and matching, every built-in color theme including High Contrast Light, `firstLine` language detection. Open gaps: the gaps column of its unit rows. | `port/results/pixels.md` milestone 7 (main window in dark, light, hc and hclight); cargo test -p app syntax:: (colorize_fixtures_match_the_reference: every colorize-tests fixture's scopes and colors) |-| Milestones | M8 editor viewport and editing commands | done | Scrolling (wheel, scrollbar, reveal), real `visibleRanges`, minimap, folding, sticky scroll, multi-cursor, find/replace widget, comment toggling, line operations, smart select, font zoom, the editor context menu. Open gaps: the gaps column of its unit rows. | api-tests `editor.test`, `window.test` (text editor parts) and `documents.test` pass as in the reference; pixel-check gains a scrolled long-file window with minimap and a folded region; `cargo test -p app` folding and multi-cursor tests. |+| Milestones | M8 editor viewport and editing commands | in progress | Scrolling (wheel, scrollbar, reveal), real `visibleRanges`, minimap, folding, sticky scroll, multi-cursor, find/replace widget, comment toggling, line operations, smart select, font zoom, the editor context menu. Open gaps: the gaps column of its unit rows. | api-tests `editor.test`, `window.test` (text editor parts) and `documents.test` pass as in the reference; pixel-check gains a scrolled long-file window with minimap and a folded region; `cargo test -p app` folding and multi-cursor tests. || Milestones | M9 commands, keybindings, menus, quick input | done | Command registry shared by the workbench and `vscode.commands`, context keys and `when` clauses, keybinding resolution from `contributes.keybindings` and `keybindings.json`, the native macOS menu bar, context menus, hovers, Command Palette and Quick Open (files, symbols, commands, theme picker), title bar and activity bar clicks. Open gaps: the gaps column of its unit rows. | api-tests `commands.test` and `quickInput.test` pass as in the reference; Cmd+Shift+P runs a command contributed by an extension; Cmd+P opens a fixture file; `cargo test -p app` `when`-clause and keybinding resolution tests against upstream cases. || Milestones | M10 settings, storage, profiles | done | `settings.json` (user, workspace, folder, language overrides) feeding both the workbench and `vscode.workspace.getConfiguration`, configuration schema from `contributes.configuration`, the Settings editor and JSON settings with schema validation, global and workspace storage on disk, secret storage in the macOS Keychain, profiles, real `environment` in init data. Import from VS Code, Cursor and VSCodium (Artur, port feature with no upstream counterpart): a command and a first-run offer that read each installed editor's user data (`~/Library/Application Support/{Code,Cursor,VSCodium}/User`: settings.json, keybindings.json, snippets, the color and icon theme ids) and its extension list (`~/.vscode/extensions`, `~/.cursor/extensions`, `~/.vscode-oss/extensions`, installed again from Open VSX), show what will be imported, write it into the active profile and skip settings and extensions the port has removed (AI, sign-in, Microsoft services, telemetry, remote). Open gaps: the gaps column of its unit rows. | api-tests `configuration.test` and `state.test` pass as in the reference; a setting changed in `settings.json` reaches an extension's `onDidChangeConfiguration`; storage survives a restart; importing from a fixture VS Code, Cursor and VSCodium user data folder gives the same settings, keybindings, snippets and theme in the port. || Milestones | M11 workbench layout and chrome | done | The part grid with sashes and hidden parts, panel and secondary side bar, view containers and collapsible views, tree views from extensions (with the Refactor Preview of workbench/contrib/bulkEdit, which file operation participants open), editor groups and splits, notifications, dialogs (native open/save), progress, banner, status bar entries from extensions, decorations, window lifecycle (close, quit, hot exit backup), multiple windows, focus and inactive look. Open gaps: the gaps column of its unit rows. | api-tests `window.test` (messages, progress, tree views, status bar) pass as in the reference; pixel-check gains a window with panel and split editor; hot exit restores an unsaved buffer after quit. |@@ -409,7 +409,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/parts/banner | workbench part | M11 | verified | | workbench/banner.rs (bannerPart.ts): one item by priority, icon, message with ellipsis, link actions, Close Banner; Focus Banner, `bannerFocused`, arrow keys through the links and the close button, Enter and Space on them. `cargo test -p app banner`; verified: ui-pair banner.json vs the reference (port/results/windows.md, milestone 11 verification) || workbench/parts/chat | workbench part | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/parts/dialogs | workbench part | M11 | verified | | workbench/dialog_view.rs custom dialog, used for every message box with `window.dialogStyle: custom` (severity codicons, plain detail); cargo test -p app dialogs; verified: ui-pair dialogs.json `custom-modal` vs the reference (port/results/windows.md, milestone 11 verification): size, buttons in macOS order, Close Dialog; its buttons and Close Dialog are accessibility buttons named by their labels (dialog.ts monaco Buttons, the close action's aria-label): port/tools/update-check pre-release presses "Trust Publisher & Install" through them |-| workbench/parts/editor | workbench part | M8 | verified | | breadcrumbs, tab strip, text editor, groups, title menus, terminal editors, `workbench.editor.showTabs` and `editorActionsLocation` (workbench/editor_view.rs, workbench/editor_menus.rs, editor_type_picker.rs, scroll_locking.rs; port/notes.md milestone 5): cargo test -p app workbench::breadcrumbs editor::tests use_modal_all_opens_editors_in_the_modal_part use_modal_all_reveals_an_opened_editor_in_its_group_unless_an_index_is_given keys_and_typed_text_edit_the_focused_editor_and_reach_the_host editor_menus workbench_open diff_editor editor_groups editor_grid scroll_locking the_grid_and_its_editors_come_back_from_workspace_storage the_wait_marker_waits_for_the_dirty_file_to_be_saved editor_type_picker custom_editors terminal_editor icon_select_box previews_off_pins_every_opened_editor tab_labels_keep show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own show_tabs_none_moves_the_editor_actions_into_the_title_bar the_tab_bar_menu_switches_the_tabs_mode the_editor_actions_toggle_restores_the_hidden_location menubar the_keyboard_focuses_moves_through_and_reveals_the_breadcrumbs the_modal_header_shows_the_modal_editor_title_menu; ui-pair m8/breadcrumbs-pickers.json, m12/editor-type.json, m12/editor-type-second-start.json, m11/editor-menus.json, m11/watermark-tips.json, m12/terminal-editor.json, m12/terminal-pickers.json, m12/terminal-tab-list-menu.json, icons/seti.json, show-tabs.json, menus/modal-editor-title.json; pixel-check file window (port/results/pixels.md milestone 4); port/results/contextmenu.md, port/results/auxiliary-windows.md, port/results/api-tests.md |+| workbench/parts/editor | workbench part | M8 | ported | [3 S] breadcrumbs.rs: a custom editor on a resource that is not `file` has no breadcrumbs, where the reference's hex editor on `vscode-debug-memory` shows `3 > memory.bin` (webview_panels.rs `webview_resource` keeps only `file`; ui-pair `debug/memory.json` hex-editor.png) | breadcrumbs, tab strip, text editor, groups, title menus, terminal editors, `workbench.editor.showTabs` and `editorActionsLocation` (workbench/editor_view.rs, workbench/editor_menus.rs, editor_type_picker.rs, scroll_locking.rs; port/notes.md milestone 5): cargo test -p app workbench::breadcrumbs editor::tests use_modal_all_opens_editors_in_the_modal_part use_modal_all_reveals_an_opened_editor_in_its_group_unless_an_index_is_given keys_and_typed_text_edit_the_focused_editor_and_reach_the_host editor_menus workbench_open diff_editor editor_groups editor_grid scroll_locking the_grid_and_its_editors_come_back_from_workspace_storage the_wait_marker_waits_for_the_dirty_file_to_be_saved editor_type_picker custom_editors terminal_editor icon_select_box previews_off_pins_every_opened_editor tab_labels_keep show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own show_tabs_none_moves_the_editor_actions_into_the_title_bar the_tab_bar_menu_switches_the_tabs_mode the_editor_actions_toggle_restores_the_hidden_location menubar the_keyboard_focuses_moves_through_and_reveals_the_breadcrumbs the_modal_header_shows_the_modal_editor_title_menu; ui-pair m8/breadcrumbs-pickers.json, m12/editor-type.json, m12/editor-type-second-start.json, m11/editor-menus.json, m11/watermark-tips.json, m12/terminal-editor.json, m12/terminal-pickers.json, m12/terminal-tab-list-menu.json, icons/seti.json, show-tabs.json, menus/modal-editor-title.json; pixel-check file window (port/results/pixels.md milestone 4); port/results/contextmenu.md, port/results/auxiliary-windows.md, port/results/api-tests.md || workbench/parts/notifications | workbench part | M11 | verified | | workbench/notifications_view.rs: toasts (3 at most, purge 10/12/15s unless sticky, focused or hovered, spam protection), notifications center (Clear All, Do Not Disturb menu with per-source filters, Hide), rows with expand, collapse, clear, More Actions, buttons, links, Copy Text, double-click toggle; status bar bell states and tooltips; notificationsCommands.ts commands and context keys; geometry from the reference DOM (port/tools/ref-dom); cargo test -p app notifications_view; `workbench.notifications.position` (bottom right, bottom left, top right with the title bar bell); no toast animation, no screen reader announcements; verified: ui-pair messages.json `center`, `progress` vs the reference (port/results/windows.md, milestone 11 verification) || workbench/parts/panel | workbench part | M11 | verified | | bottom centered card, view tabs from register_panel_view with the "..." overflow of compositeBar.ts (cargo test -p app workbench::panel::, ui-pair port/results/problems.md), `<view id>.focus` per view, Maximize/Restore, Close, Cmd+J, active view in workspace storage; Problems, Output, Debug Console, Test Results (`hideIfEmpty`) and Terminal views with their title actions (cargo test -p app editor_groups the_output_view_shows_in_the_panel, output_view, the_debug_console_and_test_results_are_panel_views, terminal); part_grid tests, ui-pair port/results/layout.md; no panel position or alignment change, no Views and More Actions menu; verified: ui-pair port/results/problems.md (milestone 11 verification): tabs, "..." overflow and the filter box as the reference; tabs at Chromium's fractional text widths (the Problems tab with its badge was 2px wider: GPUI rounds a text element's width up), the filter in the view below 600px of width (`shouldShowFilterInHeader`) || workbench/parts/partGrid | workbench part | M11 | verified | | workbench/layout.rs grid on split_view.rs (splitview.ts priorities, snap, visibility), workbench/part_grid.rs sashes, hidden parts, sizes and visibility in LayoutStateModel storage keys: cargo test -p app layout part_grid split_view (reference geometry at 1024x768, Cmd+B for the next open, sash drag, snap); ui-pair grid steps, port/results/layout.md |@@ -530,7 +530,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/contrib/commands | workbench contribution | M9 | verified | | runCommands (commands.rs register_run_commands): cargo test -p app commands::, argument checks, spread args, order, stop at a failure; argument errors and the failure notify (cargo test -p app run_commands_argument_errors_notify) || workbench/contrib/comments | workbench contribution | M13 | verified | | workbench/comments_view.rs, workbench/comment_thread_widget.rs, comment_thread_floating.rs, workbench/comment_thread_floating_layout.rs, workbench/comment_node.rs, workbench/commenting_ranges.rs, workbench/comment_navigation.rs, workbench/editor_view/comment_glyph.rs, multi_diff_editor_view.rs: cargo test -p app comment diff floating room multi_diff comment_thread_floating two_threads_keep_their_reply_forms_open_together a_wrapped_comment_body_grows_its_zone the_reached_thread_takes_the_focus a_markdown_comment_previews_its_first_rendered_block the_filter_keeps_its_history_and_escape_clears_it the_thread_menu_replies_to_the_thread a_comment_s_code_span_draws_no_code_block_background additional_actions_show_under_the_body_and_run_with_the_thread a_commenting_range_is_reached_at_its_columns_unless_it_holds_the_cursor dismissing_a_new_template_keeps_it_open an_expanded_thread_shows_a_zone_and_replies_run_the_form_actions a_comment_switched_to_editing_runs_the_edit_actions rows_sit_in_the_pane_s_inset_with_the_tree_s_indent_and_guides (commentThreadFloatingWidget.test.ts); ui-pair `portComments.openDiff` (modified, original, multi, floating), steps-comment-floating.json, steps-comment-additional.json, steps-comment-escape-typed.json, steps-comment-reply-editor.json, steps-comments.json (port/results/language-features.md Comments, Comment editing and commands, Floating comment threads); cargo test -p app reactions_are_action_items_4px_apart || workbench/contrib/customEditor | workbench contribution | M17 | verified | | cargo test -p app custom_editors each_group_s_custom_text_editor_has_its_own_webview a_custom_text_editor_s_navigation_drives_the_outline a_custom_document_open_in_another_group_moves_to_the_active_one a_custom_document_with_multiple_editors_opens_one_more_in_the_active_group a_workspace_association_wins_over_a_user_one_of_the_same_length a_reopened_preview_keeps_its_tab_position two_default_editors_for_a_resource_ask_once_which_to_keep markdown_editor_files_offer; `FIXTURE=custom-editor-tests port/tools/webview-check` 8/8; custom editor diffs: cargo test -p app reopen_as_text_turns_an_inline_custom_diff_into_the_text_diff the_modal_header_of_a_custom_diff_offers_reopen_as_text; `FIXTURE=markdown-tests port/tools/webview-check` 8/8 (side by side, inline, reopenTextEditor); ui-pair port/fixtures/custom-editor-diff/steps.json with FILE=README.md and the `*.md` association to `vscode.markdown.preview.editor` |-| workbench/contrib/debug | workbench contribution | M16 | ported | [3 M] variable_menu.rs: no View Binary Data: debug.contribution.ts registers it only in the rows' `inline` group, and the port's Variables, Watch and hover rows have no inline action bar, no `vscode-debug-memory` file system and no hex editor install prompt (variablesView.ts `VIEW_MEMORY_ID`) | cargo test -p app debug launch_picker_shrinks the_debug_container_more_actions debug_service a_workbench_hover_draws_over_the_debug_hover the_tree_height_keeps_an_above_hover_off_the_hovered_line watch_expression_labels_use_the_monospace_font debug_view debug_task_runner debug_commands debug_console debug::ansi an_ended_session_stays_in_the_picker_until_cleared_or_started_again a_start_or_restart_saves_the_dirty_editors a_hit_breakpoint_enables_its_dependents debug_inline_values debug_hover alt_click_toggles_the_loaded_subtree a_click_on_a_hover_row_focuses_the_tree a_lazy_row_takes_its_value_from_the_eye_button the_find_widget_filters_the_hover_tree disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints a_right_clicked_call_stack_row_takes_the_list_focus the_debug_toolbar_and_create_configuration_menus_take_contributed_items debug_toolbar variable_menu a_stop_on_a_line_in_view_keeps_the_scroll the_debug_picker_lists_and_starts_the_launch_configurations the_first_scope_expands_only_once_the_variables_view_exists the_find_widget_filters_the_console a_variable_row_draws_its_scopes_indent_guide a_top_frame_past_column_1_injects_the_column_arrow the_call_stack_selects_the_focused_frame_only_after_a_focus_change_it_saw a_visualized_child_shows_its_tree_in_the_hover a_watch_expressions_visualized_child_draws_its_tree a_dynamic_selection_keeps_its_type_for_f5 inline_breakpoints; ui-pair port/fixtures/debug-node (breakpoint, F5, views, REPL, toolbar, `greeting` and `numbers` hovers), menus/view-container-title.json, port/fixtures/ui-pair/debug/hover-find.json, port/fixtures/ui-pair/debug/unverified-breakpoints.json, port/fixtures/ui-pair/debug/call-stack-menu.json, port/fixtures/ui-pair/debug/toolbar.json, port/fixtures/ui-pair/debug/variables-menu.json, port/fixtures/ui-pair/debug/lazy-variable.json, port/fixtures/ui-pair/debug/quick-access.json; shortcuts in port/notes.md |+| workbench/contrib/debug | workbench contribution | M16 | verified | | cargo test -p app debug launch_picker_shrinks the_debug_container_more_actions debug_service a_workbench_hover_draws_over_the_debug_hover the_tree_height_keeps_an_above_hover_off_the_hovered_line watch_expression_labels_use_the_monospace_font debug_view debug_task_runner debug_commands debug_console debug::ansi an_ended_session_stays_in_the_picker_until_cleared_or_started_again a_start_or_restart_saves_the_dirty_editors a_hit_breakpoint_enables_its_dependents debug_inline_values debug_hover alt_click_toggles_the_loaded_subtree a_click_on_a_hover_row_focuses_the_tree a_lazy_row_takes_its_value_from_the_eye_button the_find_widget_filters_the_hover_tree disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints a_right_clicked_call_stack_row_takes_the_list_focus the_debug_toolbar_and_create_configuration_menus_take_contributed_items debug_toolbar variable_menu a_stop_on_a_line_in_view_keeps_the_scroll the_debug_picker_lists_and_starts_the_launch_configurations the_first_scope_expands_only_once_the_variables_view_exists the_find_widget_filters_the_console a_variable_row_draws_its_scopes_indent_guide a_top_frame_past_column_1_injects_the_column_arrow the_call_stack_selects_the_focused_frame_only_after_a_focus_change_it_saw a_visualized_child_shows_its_tree_in_the_hover a_watch_expressions_visualized_child_draws_its_tree a_dynamic_selection_keeps_its_type_for_f5 inline_breakpoints debug_memory; ui-pair debug/memory.json (setup in port/notes.md, View Binary Data), port/fixtures/debug-node (breakpoint, F5, views, REPL, toolbar, `greeting` and `numbers` hovers), menus/view-container-title.json, debug/hover-find.json, debug/unverified-breakpoints.json, debug/call-stack-menu.json, debug/toolbar.json, debug/variables-menu.json, debug/lazy-variable.json, debug/quick-access.json; shortcuts in port/notes.md || workbench/contrib/dropOrPasteInto | workbench contribution | M13 | verified | | commands.ts `configurePreferredPasteAction`/`configurePreferredDropAction`: the widgets' menus and the Paste As pick open user settings JSON at `editor.pasteAs.preferences` or `editor.dropIntoEditor.preferences` (workbench/paste_edits.rs); the `editor.pasteAs.*` and `editor.dropIntoEditor.*` settings come from core-settings.json; ui-pair paste-menu (port/results/language-features.md) || workbench/contrib/editSessions | workbench contribution | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/contrib/editTelemetry | workbench contribution | | removed | | no AI or Microsoft services by decision (port/notes.md); API stays inert |diff --git a/port/notes.md b/port/notes.mdindex 3451309f840..2f4b4165284 100644--- a/port/notes.md+++ b/port/notes.md@@ -888,6 +888,7 @@ Scope as in the M19 Work row of port/ledger.md.- Debug Console find (`workbench/debug_console_find.rs`; repl.ts `FindReplAction`, `openFind`): `repl.action.find` (Cmd+Alt+F, the title's `search` before the session picker and Clear Console) opens the tree find widget of the debug hover (`TreeFind`) over the console with 30px of padding; elements are found by `IReplElement.toString(true)`, an evaluation by its input or its result, filter mode drops the elements without a match, evaluation inputs and variable names highlight the matched chars, "No results found." when nothing matches, the pattern is kept for the next open. Shortcuts: the port's console has no row focus, so highlight mode moves no focus to the first match; the item in `MenuId.DebugConsoleContext` waits on that menu, which the port does not have (cargo test -p app the_find_widget_filters_the_console).- Extension host debugging (`extensionHost` launch type; rawDebugSession.ts `launchVsCode`, localProcessExtensionHost.ts `attachSession`, debugService.ts `onAttachSession`): js-debug's `launchVSCode` opens the Extension Development Host window (or reloads the one on the same extension path) with `--debugId`, `--inspect-brk-extensions` and `--extensionEnvironment`; the host it starts has the session attach to the inspector port on a new adapter. Decision: a host with an inspector port runs on Node, since Bun has no V8 inspector; a host without one stays on Bun, and there is no 5870 default port (environmentService.ts gives one to a build from source, which would put every checkout run on Node). The window closes with its current host's exit and at the end of a 'Run Without Debugging' session; a restart reloads it. Check: `cargo test -p app workbench::host::`, ui-pair `debug/extension-host.json` with `FOLDER=port/fixtures/debug-extension` (stops at the breakpoint in `activate`).- Debug visualizers (`workbench/debug_visualizers.rs`): a visualizer contributed with a Uri `iconPath` draws an empty button in the reference too: variablesView.ts builds the action with `class: v.iconClass || 'debug-viz-icon'`, reads no `iconPath`, and no stylesheet of 1.147.0 names `debug-viz-icon` (cargo test -p app debug_visualizers).+- View Binary Data (`workbench/debug_memory.rs`; variablesView.ts `VIEW_MEMORY_ID`, debugMemory.ts): the `vscode-debug-memory` provider lives in the workbench, and `exthost/src/main_thread_files.rs` asks it through `ask_workbench`. The answer waits on the workbench's own `readMemory` to js-debug, so `Session::ask_workbench` flushes the workbench's queued host calls while it waits; before that the hex editor's read hung on its LOADING placeholders. The provider has only `FileOpenReadWriteClose`, so upstream's file service reads with `read`, which ends the file at the first unreadable byte; the port's `readFile` returns that prefix. The range comes from an extension: it must be ordered, end at most at 2^53-1 and span at most 16 MiB. Inline row buttons show on hover or focus through `hidden()`/`flex()`: a `group_hover` display change skips prepaint and panics. ui-pair `debug/memory.json` needs `ms-vscode.hexeditor` 1.11.1 from Open VSX in `<dir>`, `ARGS="--extensions-dir <dir>"` and `FOLDER=port/fixtures/debug-node`.- 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`.## Milestone 11 windows: dialogs, lifecycle, hot exit, windows, title bar