Visual Studio Code, rebuilt in Rust
Rust
feat(debug): port the debug hover tree's list keys and layoutTree height
rokarture01db5ec08d9
diff --git a/native/crates/app/src/workbench/debug_hover.rs b/native/crates/app/src/workbench/debug_hover.rsindex c19a6c681bf..77e572f8cee 100644--- a/native/crates/app/src/workbench/debug_hover.rs+++ b/native/crates/app/src/workbench/debug_hover.rs@@ -8,7 +8,7 @@ use std::sync::LazyLock;use std::time::Duration;use gpui::{- Animation, AnimationExt, AnyElement, AsyncWindowContext, Bounds, BoxShadow, ClickEvent, Context, Div, Modifiers, MouseDownEvent, MouseMoveEvent, Point, Size, Task, WeakEntity, Window,+ Animation, AnimationExt, AnyElement, AsyncWindowContext, Bounds, BoxShadow, ClickEvent, Context, Div, Modifiers, MouseDownEvent, MouseMoveEvent, Point, ScrollHandle, Size, Task, WeakEntity, Window,canvas, deferred, div, point, prelude::*, px, rgba,};use regex::Regex;@@ -50,6 +50,10 @@ pub(super) struct DebugHover {pub(super) widget_bounds: Rc<Cell<Option<Bounds<f32>>>>,/// The tree's expanded rows by their path; `setInput` starts each value collapsed.expanded: HashSet<String>,+ /// The tree's focused and selected rows by their path.+ focused: Option<String>,+ selected: Option<String>,+ tree_scroll: ScrollHandle,focus_on_show: bool,/// Restarts the fade-in of each new value.shows: usize,@@ -67,6 +71,14 @@ pub(super) struct ShownValue {scroll: (f32, f32),}+struct TreeRow<'a> {+ /// The names from the shown value down, joined by `/`.+ key: String,+ depth: usize,+ variable: &'a Variable,+ expanded: bool,+}+#[derive(Debug, PartialEq)]enum ShowResult {Shown,@@ -207,10 +219,17 @@ impl Workbench {window.focus(&self.editor_focus, cx);}self.debug_hover.widget_bounds.set(None);- self.debug_hover.expanded.clear();+ self.clear_debug_hover_tree();cx.notify();}+ fn clear_debug_hover_tree(&mut self) {+ self.debug_hover.expanded.clear();+ self.debug_hover.focused = None;+ self.debug_hover.selected = None;+ self.debug_hover.tree_scroll.set_offset(point(px(0.), px(0.)));+ }+/// `preventDefaultEditorHover`: the editor hover hides and stays off until the lockout clears.fn prevent_default_editor_hover(&mut self, cx: &mut Context<Self>) {let off = self.editors.active().is_some_and(|editor| self.hover_settings(editor).enabled == "off");@@ -268,12 +287,13 @@ impl Workbench {}/// `doShow`: the value, and the children of a complex one, with the range highlighted.+ #[allow(clippy::too_many_arguments, reason = "doShow's inputs")]fn set_debug_hover_value(&mut self, range: Anchor, session_id: String, value: Variable, focus: bool, mouse: Option<Point<f32>>, window: &mut Window, cx: &mut Context<Self>) {let scroll = self.editors.editor_by_id(range.model_id).map_or((0., 0.), |editor| (editor.scroll.top, editor.scroll.left));if value.has_children() {self.fetch_children(&session_id, value.variables_reference, window, cx);}- self.debug_hover.expanded.clear();+ self.clear_debug_hover_tree();self.debug_hover.widget_bounds.set(None);self.debug_hover.shows += 1;self.debug_hover.shown = Some(ShownValue { range, session_id, value, origin: mouse, above: Cell::new(None), scroll });@@ -333,7 +353,7 @@ impl Workbench {.absolute().inset_0();let contents = match shown.value.has_children() {- true => self.debug_hover_complex_value(shown, editor_bounds.size.height, cx),+ true => self.debug_hover_complex_value(shown, editor_bounds.size.height, anchor_top, window, cx),false => self.debug_hover_simple_value(&shown.value, editor_bounds.size.width),};let radius = super::content_hover_view::RADIUS;@@ -390,15 +410,15 @@ impl Workbench {}/// `.complex-value`: the value as the title, its children as a tree, and the Alt tip.- fn debug_hover_complex_value(&self, shown: &ShownValue, editor_height: f32, cx: &mut Context<Self>) -> AnyElement {+ fn debug_hover_complex_value(&self, shown: &ShownValue, editor_height: f32, hovered_line_top: f32, window: &Window, cx: &mut Context<Self>) -> AnyElement {let mut rule = self.color("editorHoverWidget.foreground");(rule.r, rule.g, rule.b, rule.a) = (128. / 255., 128. / 255., 128. / 255., 0.35);let caption = |text: Div| text.h(px(ROW_HEIGHT)).pl(px(15.)).pr(px(2.)).text_size(px(11.)).line_height(px(ROW_HEIGHT)).overflow_hidden().whitespace_nowrap().text_ellipsis();- let mut rows = Vec::new();- self.debug_hover_rows(&shown.session_id, shown.value.variables_reference, "hover", 0, &mut rows, cx);- // shortcut: the tree takes 400 to 550px and up to max(266, 55% of the editor) of height, without layoutTree's- // cap that keeps an above hover off the hovered line; needs the tree's content size measured.- let tree = div().id("debug-hover-tree").flex().flex_col().max_h(px(266f32.max(editor_height * 0.55))).overflow_y_scroll().cursor_pointer().children(rows);+ let tree_rows = self.debug_hover_tree_rows(shown);+ let height = tree_height(editor_height, tree_rows.len(), 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 tree = div().id("debug-hover-tree").track_scroll(&self.debug_hover.tree_scroll).flex().flex_col().h(px(height)).overflow_y_scroll().cursor_pointer().children(rows);div().min_w(px(400.)).max_w(px(550.))@@ -410,36 +430,164 @@ impl Workbench {.into_any_element()}- /// The tree rows of a reference's children (`VariablesRenderer`), with the expanded ones' children under them.- fn debug_hover_rows(&self, session: &str, reference: i64, parent: &str, depth: usize, rows: &mut Vec<AnyElement>, cx: &mut Context<Self>) {+ /// The tree's visible rows: the shown value's children, with the expanded ones' children under them.+ fn debug_hover_tree_rows(&self, shown: &ShownValue) -> Vec<TreeRow<'_>> {+ let mut rows = Vec::new();+ self.collect_debug_hover_rows(&shown.session_id, shown.value.variables_reference, "hover", 0, &mut rows);+ rows+ }++ fn collect_debug_hover_rows<'a>(&'a self, session: &str, reference: i64, parent: &str, depth: usize, rows: &mut Vec<TreeRow<'a>>) {let Some(children) = self.debug.children.get(&(session.to_owned(), reference)) else { return };- let foreground = self.foreground_or("icon.foreground");for variable in children {let key = format!("{parent}/{}", variable.name);- let expandable = variable.has_children();- let expanded = expandable && self.debug_hover.expanded.contains(&key);- // tree.css `.monaco-tl-twistie`: 16px wide, `padding-right: 6px`, the chevron moved 3px right.- let twistie = div().w(px(22.)).pl(px(3.)).pr(px(3.)).flex_none().when(expandable, |twistie| {- twistie.child(self.icon(if expanded { "chevron-down" } else { "chevron-right" }, 16., 16., foreground))- });- let (row_key, session_id, child_reference) = (key.clone(), session.to_owned(), variable.variables_reference);- // abstractTree.ts `TreeRenderer.DefaultIndent` (8px) plus `workbench.tree.indent` per level.- let indent = 8. + INDENT * depth as f32;- let mut row = div().id(gpui::SharedString::from(key.clone())).h(px(ROW_HEIGHT)).flex().items_center().pl(px(indent)).child(twistie).child(self.expression_label(variable));- if expandable {- row = row.on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {- if !workbench.debug_hover.expanded.remove(&row_key) {- workbench.debug_hover.expanded.insert(row_key.clone());- workbench.fetch_children(&session_id, child_reference, window, cx);- }- cx.notify();- }));- }- rows.push(row.into_any_element());+ let expanded = variable.has_children() && self.debug_hover.expanded.contains(&key);+ rows.push(TreeRow { key: key.clone(), depth, variable, expanded });if expanded {- self.debug_hover_rows(session, variable.variables_reference, &key, depth + 1, rows, cx);+ self.collect_debug_hover_rows(session, variable.variables_reference, &key, depth + 1, rows);+ }+ }+ }++ /// 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 {+ let expandable = row.variable.has_children();+ let foreground = self.foreground_or("icon.foreground");+ // tree.css `.monaco-tl-twistie`: 16px wide, `padding-right: 6px`, the chevron moved 3px right.+ let twistie = div().w(px(22.)).pl(px(3.)).pr(px(3.)).flex_none().when(expandable, |twistie| {+ twistie.child(self.icon(if row.expanded { "chevron-down" } else { "chevron-right" }, 16., 16., foreground))+ });+ // abstractTree.ts `TreeRenderer.DefaultIndent` (8px) plus `workbench.tree.indent` per level.+ let indent = 8. + INDENT * row.depth as f32;+ let mut element = div().id(gpui::SharedString::from(row.key.clone())).h(px(ROW_HEIGHT)).flex().items_center().pl(px(indent)).child(twistie).child(self.expression_label(row.variable));+ if expandable {+ let (key, session, reference, expanded) = (row.key.clone(), session.to_owned(), row.variable.variables_reference, row.expanded);+ element = element.on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| workbench.set_debug_hover_row_expanded(&key, &session, reference, !expanded, 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 {+ element = self.list_row_selection(element, selected, focused, tree_focused);+ }+ element.into_any_element()+ }++ fn set_debug_hover_row_expanded(&mut self, key: &str, session: &str, reference: i64, expand: bool, window: &mut Window, cx: &mut Context<Self>) {+ if !expand {+ self.debug_hover.expanded.remove(key);+ } else if self.debug_hover.expanded.insert(key.to_owned()) {+ self.fetch_children(session, reference, window, cx);+ }+ cx.notify();+ }++ /// The tree's keys while it has the focus: listWidget.ts `KeyboardController` and abstractTree.ts's arrows and+ /// Space, plus the `list.*` keybindings.+ pub(super) fn debug_hover_list_command(&mut self, id: &str, window: &mut Window, cx: &mut Context<Self>) -> bool {+ let Some(shown) = self.focused_debug_hover_tree(window) else { return false };+ let session = shown.session_id.clone();+ let rows: Vec<(String, usize, i64, bool)> = self.debug_hover_tree_rows(shown).iter().map(|row| (row.key.clone(), row.depth, row.variable.variables_reference, row.expanded)).collect();+ if rows.is_empty() {+ return true;+ }+ let focus = self.debug_hover.focused.as_ref().and_then(|focused| rows.iter().position(|row| row.0 == *focused));+ let last = rows.len() - 1;+ let list = self.debug_hover_list_scroll(rows.len());+ let target = match id {+ "list.focusDown" => focus.map_or(0, |index| (index + 1).min(last)),+ "list.focusUp" => focus.map_or(0, |index| index.saturating_sub(1)),+ "list.focusFirst" => 0,+ "list.focusLast" => last,+ "list.focusPageDown" | "list.focusPageUp" => {+ let Some((target, scroll_top)) = crate::list_tree::page_focus(list, id == "list.focusPageDown", focus) else { return true };+ self.debug_hover.tree_scroll.set_offset(point(px(0.), px(-scroll_top)));+ target+ }+ "list.select" => {+ self.debug_hover.selected = self.debug_hover.focused.clone();+ cx.notify();+ return true;+ }+ "list.expand" | "list.collapse" | "list.toggleExpand" => {+ let Some(index) = focus else { return true };+ let (key, depth, reference, expanded) = &rows[index];+ // Variable::has_children.+ let expandable = *reference > 0;+ match id {+ "list.toggleExpand" if expandable => self.set_debug_hover_row_expanded(key, &session, *reference, !expanded, window, cx),+ "list.expand" if expandable && !expanded => self.set_debug_hover_row_expanded(key, &session, *reference, true, window, cx),+ "list.collapse" if *expanded => self.set_debug_hover_row_expanded(key, &session, *reference, false, window, cx),+ "list.expand" if rows.get(index + 1).is_some_and(|child| child.1 > *depth) => self.focus_debug_hover_row(&rows[index + 1].0, index + 1, list, cx),+ "list.collapse" => {+ if let Some(parent) = rows[..index].iter().rposition(|parent| parent.1 < *depth) {+ self.focus_debug_hover_row(&rows[parent].0, parent, list, cx);+ }+ }+ _ => {}+ }+ return true;}+ _ => return false,+ };+ if let Some(row) = rows.get(target) {+ self.focus_debug_hover_row(&row.0, target, list, cx);+ }+ true+ }++ fn focus_debug_hover_row(&mut self, key: &str, index: usize, list: crate::list_tree::ListScroll, cx: &mut Context<Self>) {+ self.debug_hover.focused = Some(key.to_owned());+ if let Some(scroll_top) = crate::list_tree::reveal_scroll_top(list, index, false) {+ self.debug_hover.tree_scroll.set_offset(point(px(0.), px(-scroll_top)));}+ cx.notify();+ }++ /// The shown complex value while its tree has the focus.+ pub(super) fn focused_debug_hover_tree(&self, window: &Window) -> Option<&ShownValue> {+ self.debug_hover.shown.as_ref().filter(|shown| shown.value.has_children() && self.debug_hover_focus.is_focused(window))+ }++ /// The tree's `keyboardNavigationLabelProvider`: the variable's name.+ pub(super) fn debug_hover_type_navigation(&mut self, word: &str, idle: bool, cx: &mut Context<Self>) {+ let Some(shown) = self.debug_hover.shown.as_ref() else { return };+ let rows = self.debug_hover_tree_rows(shown);+ let labels: Vec<String> = rows.iter().map(|row| row.variable.name.clone()).collect();+ let focus = self.debug_hover.focused.as_ref().and_then(|focused| rows.iter().position(|row| row.key == *focused));+ let Some(index) = super::type_navigation::type_navigation_target(&labels, focus, word, idle) else { return };+ let key = rows[index].key.clone();+ let list = self.debug_hover_list_scroll(rows.len());+ self.focus_debug_hover_row(&key, index, list, cx);+ }++ fn debug_hover_list_scroll(&self, count: usize) -> crate::list_tree::ListScroll {+ let scroll = &self.debug_hover.tree_scroll;+ crate::list_tree::ListScroll { count, row_height: ROW_HEIGHT, viewport: f32::from(scroll.bounds().size.height), scroll_top: -f32::from(scroll.offset().y) }+ }++ /// listWidget.ts `onEscape`: a selection clears first, then debugHover.ts's own listener hides the widget.+ pub(super) fn debug_hover_escape(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ if self.debug_hover.selected.take().is_some() {+ cx.notify();+ return;+ }+ self.hide_debug_hover(window, cx);+ }++ /// `WorkbenchAsyncDataTree`'s context keys while the hover's tree has the focus.+ pub(super) fn debug_hover_context(&self, window: &Window, context: &mut std::collections::HashMap<String, serde_json::Value>) {+ let Some(shown) = self.focused_debug_hover_tree(window) else { return };+ context.insert("listFocus".into(), json!(true));+ context.insert("listHasSelectionOrFocus".into(), json!(self.debug_hover.focused.is_some() || self.debug_hover.selected.is_some()));+ let rows = self.debug_hover_tree_rows(shown);+ let Some(index) = self.debug_hover.focused.as_ref().and_then(|focused| rows.iter().position(|row| row.key == *focused)) else { return };+ let row = &rows[index];+ let expandable = row.variable.has_children();+ context.insert("treeElementCanCollapse".into(), json!(expandable && row.expanded));+ context.insert("treeElementCanExpand".into(), json!(expandable && !row.expanded));+ context.insert("treeElementHasChild".into(), json!(rows.get(index + 1).is_some_and(|child| child.depth > row.depth)));+ context.insert("treeElementHasParent".into(), json!(row.depth > 0));}}@@ -589,6 +737,15 @@ fn hover_position(editor: &OpenEditor, line: usize, visible: f32) -> Option<AnchSome(Anchor { start: column, end: column, ..under })}+/// debugHover.ts `layoutTree`: max(266px, 55% of the editor), at most the rows and the 10px scrollbar, and at most+/// what keeps an above hover off the hovered line. The tree starts under the 18px title and its 1px border; the+/// editor's own `offsetTop` in its container is 0.+fn tree_height(editor_height: f32, rows: usize, hovered_line_top: f32) -> f32 {+ let tree_top = ROW_HEIGHT + 1.;+ let avoid_cursor = if tree_top < hovered_line_top { hovered_line_top - PAGE_PADDING } else { f32::INFINITY };+ 266f32.max(editor_height * 0.55).min(rows as f32 * ROW_HEIGHT + 10.).min(avoid_cursor)+}+/// dom.ts `SafeTriangle.contains`: the four triangles from the origin to the widget's corners, in its point order.fn in_safe_triangle(origin: Point<f32>, bounds: Bounds<f32>, mouse: Point<f32>) -> bool {let (left, top, right, bottom) = (bounds.origin.x, bounds.origin.y, bounds.origin.x + bounds.size.width, bounds.origin.y + bounds.size.height);diff --git a/native/crates/app/src/workbench/debug_hover/tests.rs b/native/crates/app/src/workbench/debug_hover/tests.rsindex 0a673dd6c88..ac9b5393eb8 100644--- a/native/crates/app/src/workbench/debug_hover/tests.rs+++ b/native/crates/app/src/workbench/debug_hover/tests.rs@@ -183,3 +183,58 @@ fn a_provider_range_without_an_expression_evaluates_the_range_text(cx: &mut Testassert_eq!(shown(&workbench, cx).map(|(range, value, _)| (range.start, range.end, value)), Some((9, 16, "3".to_owned())));std::fs::remove_dir_all(file.parent().unwrap()).unwrap();}++/// debugHover.ts `layoutTree` in a 600px editor: the rows plus the 10px scrollbar, at most 55% of the editor, and at+/// most the hovered line's top less the 22px page padding unless the line is under the tree's top.+#[test]+fn the_tree_height_keeps_an_above_hover_off_the_hovered_line() {+ assert_eq!(tree_height(600., 3, 400.), 64.);+ assert_eq!(tree_height(600., 100, 400.), 330.);+ assert_eq!(tree_height(600., 100, 200.), 178.);+ assert_eq!(tree_height(600., 100, 19.), 330.);+}++/// The focused tree takes the list keys: Down focuses the first row, Right expands it and then enters it, Left goes+/// back and collapses, a typed name focuses its row, End and Home jump, Enter selects, and Escape clears the+/// selection before it hides the hover.+#[gpui::test]+fn the_focused_tree_moves_with_the_list_keys(cx: &mut TestAppContext) {+ let file = temp_file("keys", "function f(obj) {\n return obj;\n}\n");+ let (workbench, host, cx) = workbench(cx, &file, json!({ "supportsEvaluateForHovers": true }));+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.editors.active_mut().unwrap().set_selections(vec![crate::editor::Selection::caret(Position::new(1, 10))]);+ drop(workbench.execute_command("editor.debug.action.showDebugHover", Vec::new(), window, cx));+ });+ cx.run_until_parked();+ respond(&workbench, &host, &[("evaluate", json!({ "result": "Object", "variablesReference": 7 }))], cx);+ let children = json!({ "variables": [{ "name": "alpha", "value": "Object", "variablesReference": 8 }, { "name": "beta", "value": "2" }, { "name": "gamma", "value": "3" }] });+ respond(&workbench, &host, &[("variables", children)], cx);+ workbench.update_in(cx, |workbench, window, cx| window.focus(&workbench.debug_hover_focus, cx));+ let state = |cx: &mut VisualTestContext| workbench.read_with(cx, |workbench, _| (workbench.debug_hover.focused.clone(), workbench.debug_hover.expanded.len(), workbench.debug_hover.selected.clone()));+ let some = |key: &str| Some(key.to_owned());+ workbench.update(cx, |workbench, _| workbench.load_keybindings(crate::keybindings::default_keybindings(&[]), file.parent().unwrap().join("keybindings.json")));++ cx.simulate_keystrokes("down");+ assert_eq!(state(cx), (some("hover/alpha"), 0, None));+ cx.simulate_keystrokes("right");+ assert_eq!(state(cx), (some("hover/alpha"), 1, None));+ respond(&workbench, &host, &[("variables", json!({ "variables": [{ "name": "x", "value": "1" }] }))], cx);+ cx.simulate_keystrokes("right");+ assert_eq!(state(cx), (some("hover/alpha/x"), 1, None));+ cx.simulate_keystrokes("left");+ assert_eq!(state(cx), (some("hover/alpha"), 1, None));+ cx.simulate_keystrokes("left");+ assert_eq!(state(cx), (some("hover/alpha"), 0, None));+ cx.simulate_keystrokes("g");+ assert_eq!(state(cx), (some("hover/gamma"), 0, None));+ cx.simulate_keystrokes("home");+ assert_eq!(state(cx), (some("hover/alpha"), 0, None));+ cx.simulate_keystrokes("end enter");+ assert_eq!(state(cx), (some("hover/gamma"), 0, some("hover/gamma")));+ cx.simulate_keystrokes("escape");+ assert_eq!(state(cx).2, None);+ assert!(shown(&workbench, cx).is_some(), "the first Escape only clears the selection");+ cx.simulate_keystrokes("escape");+ assert!(shown(&workbench, cx).is_none());+ std::fs::remove_dir_all(file.parent().unwrap()).unwrap();+}diff --git a/native/crates/app/src/workbench/keyboard.rs b/native/crates/app/src/workbench/keyboard.rsindex 0aff2422fde..391c6443ad5 100644--- a/native/crates/app/src/workbench/keyboard.rs+++ b/native/crates/app/src/workbench/keyboard.rs@@ -255,7 +255,9 @@ impl Workbench {self.debug_hover_key_down(window, cx);}if keystroke.key == "escape" && self.debug_hover_focus.contains_focused(window, cx) {- self.hide_debug_hover(window, cx);+ self.debug_hover_escape(window, cx);+ cx.stop_propagation();+ return;}// contentHoverWidgetWrapper.ts: the widget's own keydown listener hides it on Escape.if keystroke.key == "escape" && self.content_hover_focused(window) {@@ -527,6 +529,7 @@ impl Workbench {self.goto_symbol_context(&mut context);self.references_peek_context(window, &mut context);self.hierarchy_peek_context(editor, window, &mut context);+ self.debug_hover_context(window, &mut context);context.insert("editorHoverVisible".into(), json!(self.content_hover_visible()));context.insert("editorHoverFocused".into(), json!(self.content_hover_focused(window)));self.suggest_context(&mut context);diff --git a/native/crates/app/src/workbench/search_actions.rs b/native/crates/app/src/workbench/search_actions.rsindex 9d62a083592..e337f34d75b 100644--- a/native/crates/app/src/workbench/search_actions.rs+++ b/native/crates/app/src/workbench/search_actions.rs@@ -410,7 +410,7 @@ impl Workbench {for id in super::explorer_keyboard::EXPLORER_LIST_COMMANDS {let search_run = commands.iter().find(|(search_id, _)| *search_id == id).map(|(_, run)| *run);self.commands.register(id, move |workbench, _, window, cx| {- if workbench.keybindings_table_list_command(id, window, cx) || workbench.references_peek_list_command(id, window, cx) || workbench.hierarchy_peek_list_command(id, window, cx) || workbench.notebook_list_command(id, window, cx) || workbench.multi_diff_file_list_command(id, window, cx) || workbench.scm_repositories_list_command(id, window, cx) {+ if workbench.keybindings_table_list_command(id, window, cx) || workbench.references_peek_list_command(id, window, cx) || workbench.hierarchy_peek_list_command(id, window, cx) || workbench.debug_hover_list_command(id, window, cx) || workbench.notebook_list_command(id, window, cx) || workbench.multi_diff_file_list_command(id, window, cx) || workbench.scm_repositories_list_command(id, window, cx) {return Outcome::done();}match search_run {diff --git a/native/crates/app/src/workbench/type_navigation.rs b/native/crates/app/src/workbench/type_navigation.rsindex cc196daf6e4..187cf8f5ce3 100644--- a/native/crates/app/src/workbench/type_navigation.rs+++ b/native/crates/app/src/workbench/type_navigation.rs@@ -31,7 +31,8 @@ impl Workbench {let explorer = self.explorer.focus.is_focused(window) && self.folder.is_some();let table = self.keybindings_editor.table_focus.is_focused(window);let action_widget = self.action_widget_focused(window);- if !explorer && !table && !action_widget {+ let debug_hover = self.focused_debug_hover_tree(window).is_some();+ if !explorer && !table && !action_widget && !debug_hover {return false;}let modifiers = &keystroke.modifiers;@@ -61,6 +62,10 @@ impl Workbench {self.action_widget_type_navigation(&word, idle, cx);return true;}+ if debug_hover {+ self.debug_hover_type_navigation(&word, idle, cx);+ return true;+ }if table {let (labels, focus) = self.keybindings_table_navigation_labels();if let Some(index) = type_navigation_target(&labels, focus, &word, idle) {@@ -102,7 +107,7 @@ fn explorer_label(row: &Row) -> String {/// `onInput` without `typeNavigationEnabled`: from the focused row (the next one when a new word starts), the first/// row whose label starts with `word`, ignoring case.-fn type_navigation_target(labels: &[String], focus: Option<usize>, word: &str, idle: bool) -> Option<usize> {+pub(super) fn type_navigation_target(labels: &[String], focus: Option<usize>, word: &str, idle: bool) -> Option<usize> {let start = focus.unwrap_or(0);let delta = usize::from(idle);let word = word.to_lowercase();diff --git a/port/ledger.md b/port/ledger.mdindex 9db39a5b233..1a1b4f3de75 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 L] Disassembly view: not ported <br> [3 L] extensionHost launch type: not ported | 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 (cargo test -p app debug_hover; ui-pair port/fixtures/debug-node `greeting` and `numbers` hovers); shortcuts in port/notes.md |+| workbench/contrib/debug | workbench contribution | M16 | ported | [3 L] Disassembly view: not ported <br> [3 L] extensionHost launch type: not ported <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 | 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 (cargo test -p app debug_hover; ui-pair port/fixtures/debug-node `greeting` and `numbers` hovers); 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 cd002a5b9b5..0e2bb4a6517 100644--- a/port/notes.md+++ b/port/notes.md@@ -936,7 +936,7 @@ Scope as in the M19 Work row of port/ledger.md.- Testing (`testing.rs`, `workbench/testing_service.rs`, `testing_view.rs`): MainThreadTesting with the test collection diffs, run profiles, live results (`$runControllerTests`, `$startedExtensionTestRun`, `$applyTestRunUpdates`, `$publishTestResults`), the Testing view (shows once a controller registers), run glyphs in the editor gutter and the Test Results editor. VSBuffer arguments of forwarded requests now reach the workbench as byte arrays (`exthost::session::arg_value`).- Continuous run (`workbench/testing_continuous.rs`): the view title's dropdown of `getContinuousRunDropdown` runs plain actions upstream; the port's context menu runs commands, so each profile item is an internal `_testing.toggleContinuousRunProfile.<controller>.<profile>` command registered when the menu shows. testingExplorerView.ts re-sorts a parent when a continuous run changes, but `TreeSorter` has no continuous run criterion in 1.147.0, so the order does not change; the port draws rows from the run state each frame and needs no re-sort. The unattended restart participant `testing.continuousRun` waits on the unattended restart service (ledger row workbench/services/lifecycle).- Inline values (`workbench/debug_inline_values.rs`; debugEditorContribution.ts): `debug.inlineValues` `on` or `auto` with a provider shows the focused frame's values as `InjectionOwner::DebugInlineValue` text after the lines, `editor.inlineValuesForeground` on `editor.inlineValuesBackground`. Shortcuts: only the active editor shows them, where upstream decorates every editor on the frame's file; the scopes and variables are fetched again, not shared with the Variables view's cache; the text area width stands in for `layoutInfo.width` in the line length cut.-- Debug hover (`workbench/debug_hover.rs`; debugHover.ts, debugEditorContribution.ts hover handling): while stopped, the expression at the mouse in the focused frame's file (the first `EvaluatableExpressionProvider` through `$provideEvaluatableExpression`, else `getExactExpressionStartAndEnd`) is evaluated with `context: "hover"` (or looked up in the cheap scopes without `supportsEvaluateForHovers`) after the doubled `editor.hover.delay`, the editor hover off meanwhile; Alt swaps it for the editor hover; Cmd+K Cmd+I shows it at the cursor. Shortcuts: the tree expands by click only, without keyboard navigation, the `DebugHoverContext` menu, lazy variables or visualizers; the tree height keeps 266px to 55% of the editor without `layoutTree`'s cap above the hovered line; a glyph margin hover does not lift the editor hover lockout; a tab's nearest caret position is half a column from the mouse, not half the tab. ui-pair on `port/fixtures/debug-node` (Cmd+K Cmd+I on `numbers` and `greeting`) matches the reference's placement, tree indent and focus outline.+- Debug hover (`workbench/debug_hover.rs`; debugHover.ts, debugEditorContribution.ts hover handling): while stopped, the expression at the mouse in the focused frame's file (the first `EvaluatableExpressionProvider` through `$provideEvaluatableExpression`, else `getExactExpressionStartAndEnd`) is evaluated with `context: "hover"` (or looked up in the cheap scopes without `supportsEvaluateForHovers`) after the doubled `editor.hover.delay`, the editor hover off meanwhile; Alt swaps it for the editor hover; Cmd+K Cmd+I shows it at the cursor. The focused tree takes listWidget.ts's and abstractTree.ts's keys through the `list.*` commands (Up, Down, Page Up, Page Down, Home, End, Left, Right, Space, Enter, type navigation by name), Escape clears a selection before it hides the widget; `layoutTree` sizes the tree to its rows plus 10px, at most max(266px, 55% of the editor) and the hovered line's top less 22px. The context menu and visualizers are ledger gaps of workbench/contrib/debug. Shortcuts: no lazy variables, no Alt+Space recursive expand and no tree find widget; a glyph margin hover does not lift the editor hover lockout; a tab's nearest caret position is half a column from the mouse, not half the tab. ui-pair on `port/fixtures/debug-node` (Cmd+K Cmd+I on `numbers` and `greeting`) matches the reference's placement, tree indent and focus outline.- 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 (in progress)