Visual Studio Code, rebuilt in Rust
Rust
feat(port): close 39 parity gaps across debug, testing, SCM and the workbench (#6)
Artur Rok8f07439d5501
diff --git a/README.md b/README.mdindex 1de7d759bca..680bb428e54 100644--- a/README.md+++ b/README.md@@ -7,35 +7,35 @@ Not a fork of VS Code's TypeScript: this repository holds the port only. Upstrea## Coverage<!-- coverage:start -->-**414 of the 433 parts of VS Code 1.147.0 the port covers match upstream 1:1 (95%).** The other 19 work, with open gaps listed below. 154 more are left out on purpose. A part is one upstream folder: a feature, a service or a built-in extension, counted from [port/ledger.md](port/ledger.md).+**426 of the 435 parts of VS Code 1.147.0 the port covers match upstream 1:1 (97%).** The other 9 work, with open gaps listed below. 154 more are left out on purpose. A part is one upstream folder: a feature, a service or a built-in extension, counted from [port/ledger.md](port/ledger.md).```mermaid%%{init: {"theme": "base", "themeVariables": {"pie1": "#2da44e", "pie2": "#d4a72c", "pie3": "#8c959f", "pieStrokeColor": "#ffffff", "pieOuterStrokeColor": "#ffffff", "pieSectionTextColor": "#ffffff", "pieLegendTextColor": "#8c959f", "pieTitleTextColor": "#8c959f"}}}%%pie showData- "Matches VS Code 1:1" : 414- "Works, with open gaps" : 19+ "Matches VS Code 1:1" : 426+ "Works, with open gaps" : 9"Left out on purpose" : 154```| What | Matches 1:1 | With gaps | Left out | Done ||---|---:|---:|---:|---|| Platform services: files, configuration, keybindings, windows, updates | 69 | 0 | 43 | `████████████████████` 100% |-| Workbench features: debug, Git, terminal, search, settings, extensions view | 61 | 9 | 33 | `█████████████████░░░` 87% |-| Workbench services: editors, views, layout, themes, storage | 63 | 2 | 30 | `███████████████████░` 96% |-| Built-in extensions: languages, themes, Git, Markdown, npm | 88 | 1 | 6 | `███████████████████░` 98% |+| Workbench features: debug, Git, terminal, search, settings, extensions view | 66 | 5 | 33 | `██████████████████░░` 92% |+| Workbench services: editors, views, layout, themes, storage | 64 | 1 | 30 | `███████████████████░` 98% |+| Built-in extensions: languages, themes, Git, Markdown, npm | 89 | 0 | 6 | `████████████████████` 100% || Extension API: the calls extensions make into the editor | 59 | 0 | 30 | `████████████████████` 100% |-| Editor features: find, folding, suggest, hover, multi-cursor | 52 | 3 | 3 | `██████████████████░░` 94% |-| Window parts: title bar, activity bar, side bar, panel, status bar | 9 | 2 | 2 | `████████████████░░░░` 81% |+| Editor features: find, folding, suggest, hover, multi-cursor | 55 | 0 | 3 | `████████████████████` 100% |+| Window parts: title bar, activity bar, side bar, panel, status bar | 11 | 1 | 2 | `██████████████████░░` 91% || Extension host: runs unmodified VS Code extensions | 7 | 0 | 0 | `████████████████████` 100% || Base library | 0 | 0 | 5 | all left out || Whole-app checks: look, memory, no telemetry, Open VSX gallery | 5 | 0 | 0 | `████████████████████` 100% || Text editor core: model, view, cursor | 0 | 2 | 2 | `░░░░░░░░░░░░░░░░░░░░` 0% || Port-only features: settings import from VS Code | 1 | 0 | 0 | `████████████████████` 100% |-| **All** | **414** | **19** | **154** | `███████████████████░` 95% |+| **All** | **426** | **9** | **154** | `███████████████████░` 97% |"Matches 1:1" means upstream's tests or a named check against VS Code pass. Parts that work with open gaps, by gap count:-`workbench/contrib/debug` 21, `workbench/contrib/testing` 9, `workbench/contrib/mergeEditor` 5, `workbench/parts/editor` 5, `workbench/services/views` 4, `editor/contrib/inlineCompletions` 3, `workbench/contrib/extensions` 3, `workbench/services/layout` 3, `workbench/contrib/scm` 2, `workbench/parts/titlebar` 2, `editor/browser` 1, `editor/common` 1, `editor/contrib/codeAction` 1, `editor/contrib/inlayHints` 1, `extension/git` 1, `workbench/contrib/comments` 1, `workbench/contrib/multiDiffEditor` 1, `workbench/contrib/notebook` 1, `workbench/contrib/webview` 1.+`workbench/contrib/debug` 8, `workbench/contrib/testing` 4, `workbench/contrib/extensions` 3, `workbench/services/layout` 2, `editor/browser` 1, `editor/common` 1, `workbench/contrib/notebook` 1, `workbench/contrib/webview` 1, `workbench/parts/editor` 1.<!-- coverage:end -->Left out on purpose: AI features, Microsoft services, telemetry, remote and tunnels, by decision ([port/notes.md](port/notes.md)), and upstream's test infrastructure and the Electron process, IPC and DOM layers the native app replaces.diff --git a/native/crates/app/src/editor/injected_text.rs b/native/crates/app/src/editor/injected_text.rsindex d773a3a76ef..b28c0710421 100644--- a/native/crates/app/src/editor/injected_text.rs+++ b/native/crates/app/src/editor/injected_text.rs@@ -235,6 +235,25 @@ impl LineLayout {self.text_x[self.column_at(x)]}+ /// `x` in the model text's x for a hover, which takes the char under the mouse (mouseTarget.ts+ /// `createMouseTargetFromHitTestPosition`'s range): an x on an injection is its column's.+ pub fn model_x(&self, x: f32) -> f32 {+ let mut injected = 0.;+ let mut injections = self.injections.iter().peekable();+ for column in 0..=self.len() {+ while let Some((_, width, _)) = injections.next_if(|(at, ..)| *at == column) {+ if x < self.text_x[column] + injected + width {+ return self.text_x[column];+ }+ injected += width;+ }+ if column < self.len() && x < self.text_x[column + 1] + injected {+ break;+ }+ }+ x - injected+ }+pub fn injection_column(&self, index: usize) -> usize {self.injections[index].0}diff --git a/native/crates/app/src/editor/injected_text/tests.rs b/native/crates/app/src/editor/injected_text/tests.rsindex 553a2b99457..86fd7d5b58f 100644--- a/native/crates/app/src/editor/injected_text/tests.rs+++ b/native/crates/app/src/editor/injected_text/tests.rs@@ -33,6 +33,16 @@ fn a_click_on_an_injection_goes_to_its_column() {assert_eq!(LineLayout::new("\ta", 4, []).column_at(2.), 0);}+#[test]+fn a_hover_takes_the_char_under_the_mouse() {+ // "ab" + "abc" (3 columns wide) + "cd": a hover x on a char's right half stays on that char.+ let layout = LineLayout::new("abcd", 4, [(2, 3., "abc")]);+ assert_eq!(layout.model_x(1.8), 1.8);+ assert_eq!(layout.model_x(3.), 2.);+ assert_eq!(layout.model_x(5.5), 2.5);+ assert_eq!(layout.model_x(9.), 6.);+}+#[test]fn tab_stops_count_the_injected_chars() {// viewLineRenderer.ts `_renderLine` over "a" + "xy" + "\tb": the tab reaches visible column 4 from 3, one column.diff --git a/native/crates/app/src/menus.rs b/native/crates/app/src/menus.rsindex 35194908c02..25927ed2c05 100644--- a/native/crates/app/src/menus.rs+++ b/native/crates/app/src/menus.rs@@ -1341,7 +1341,7 @@ pub fn menu_group_actions(registry: &[MenuItem], menu: MenuId, context: &dyn Con}/// `MenuInfo.compareMenuItems`: groups by name with `navigation` first and no group last, then order, then title.-fn compare_menu_items(a: &MenuItem, b: &MenuItem) -> Ordering {+pub fn compare_menu_items(a: &MenuItem, b: &MenuItem) -> Ordering {if a.group != b.group {match (a.group.as_str(), b.group.as_str()) {("", _) => return Ordering::Greater,diff --git a/native/crates/app/src/merge_editor.rs b/native/crates/app/src/merge_editor.rsindex 82808b657b9..62f452c7def 100644--- a/native/crates/app/src/merge_editor.rs+++ b/native/crates/app/src/merge_editor.rs@@ -46,12 +46,14 @@ pub struct MergeInput {pub synced_scroll: [f32; 3],/// `getInitialResultValue`: the result's lines when the editor opened.pub initial_result: Vec<String>,+ /// The count of the context menu the result title's More Actions... showed, drawn active while that menu is open.+ pub more_menu: Option<usize>,}impl MergeInput {pub fn new(base: Side, input1: InputData, input2: InputData, result: Side, initial_result: Vec<String>) -> Self {let reset_pending = initial_result.iter().any(|line| line.starts_with("<<<<<<<"));- MergeInput { base, input1, input2, result, model: None, reset_pending, placed_zones: Vec::new(), active_range: None, focused_input: None, input_editors: [None, None], placed_input_zones: Default::default(), synced_scroll: [0.; 3], initial_result }+ MergeInput { base, input1, input2, result, model: None, reset_pending, placed_zones: Vec::new(), active_range: None, focused_input: None, input_editors: [None, None], placed_input_zones: Default::default(), synced_scroll: [0.; 3], initial_result, more_menu: None }}/// The code editor of the focused input, `None` while the result has the focus.diff --git a/native/crates/app/src/testing.rs b/native/crates/app/src/testing.rsindex 0d85f175763..0be62d66937 100644--- a/native/crates/app/src/testing.rs+++ b/native/crates/app/src/testing.rs@@ -325,6 +325,8 @@ pub struct ResultItem {pub tasks: Vec<TaskState>,pub own_state: ResultState,pub own_duration: Option<f64>,+ /// From an outdated run, after the extension's `TestController.invalidateTestResults`.+ pub retired: bool,}impl ResultItem {@@ -395,7 +397,7 @@ impl TestResult {let id = item["extId"].as_str().unwrap_or_default().to_owned();if !self.items.contains_key(&id) {let tasks = vec![TaskState::default(); self.tasks.len()];- self.items.insert(id.clone(), ResultItem { item: item.clone(), expand: 0, parent: parent.clone(), children: Vec::new(), tasks, own_state: ResultState::Unset, own_duration: None });+ self.items.insert(id.clone(), ResultItem { item: item.clone(), expand: 0, parent: parent.clone(), children: Vec::new(), tasks, own_state: ResultState::Unset, own_duration: None, retired: false });match &parent {Some(parent) => self.items.get_mut(parent).expect("added before its children").children.push(id.clone()),None => self.roots.push(id.clone()),@@ -457,6 +459,15 @@ impl TestResult {self.completed_at = Some(now);}+ /// testResult.ts `markRetired`: the tests under `test_ids`, or all of them.+ pub fn mark_retired(&mut self, test_ids: Option<&[String]>) {+ for (id, item) in &mut self.items {+ if test_ids.is_none_or(|ids| ids.iter().any(|retired| id == retired || id.starts_with(&format!("{retired}\0")))) {+ item.retired = true;+ }+ }+ }+/// getComputedState.ts: the item's own state raised by its children's.pub fn computed_state(&self, id: &str) -> ResultState {let Some(item) = self.items.get(id) else { return ResultState::Unset };diff --git a/native/crates/app/src/theme.rs b/native/crates/app/src/theme.rsindex 522f94e5da5..97defbdc7d6 100644--- a/native/crates/app/src/theme.rs+++ b/native/crates/app/src/theme.rs@@ -598,6 +598,7 @@ fn registry_default(key: &str, kind: ThemeKind) -> ColorValue {),"activityBar.background" => (Hex("#333333"), Hex("#2C2C2C"), Hex("#000000")),"activityBar.foreground" => (Hex("#FFFFFF"), Hex("#FFFFFF"), Hex("#FFFFFF")),+ "activityBar.activeBorder" => (Key("activityBar.foreground"), Key("activityBar.foreground"), Key("contrastBorder")),"activityBar.inactiveForeground" => (Transparent(&Key("activityBar.foreground"), 0.4),Transparent(&Key("activityBar.foreground"), 0.4),@@ -1006,6 +1007,7 @@ fn hc_light_default(key: &str) -> ColorValue {"minimap.foregroundOpacity" => Hex("#000f"),"activityBar.background" => Hex("#FFFFFF"),"activityBar.foreground" => Key("editor.foreground"),+ "activityBar.activeBorder" => Key("contrastBorder"),"activityBar.inactiveForeground" => Key("editor.foreground"),"surface.background" => Key("sideBar.background"),"surface.border" => Key("contrastBorder"),diff --git a/native/crates/app/src/theme/debug_colors.rs b/native/crates/app/src/theme/debug_colors.rsindex edacef33a29..1522a171d0e 100644--- a/native/crates/app/src/theme/debug_colors.rs+++ b/native/crates/app/src/theme/debug_colors.rs@@ -46,6 +46,12 @@ pub(super) fn debug_default(key: &str) -> Option<[ColorValue; 4]> {"testing.iconPassed" | "testing.runAction" => [Hex("#73c991"), Hex("#73c991"), Hex("#73c991"), Hex("#007100")],"testing.iconQueued" => [Key("list.warningForeground"), Key("list.warningForeground"), Key("list.warningForeground"), Key("list.warningForeground")],"testing.iconUnset" | "testing.iconSkipped" => [Hex("#848484"), Hex("#848484"), Hex("#848484"), Hex("#848484")],+ "testing.iconFailed.retired" => retired(&Key("testing.iconFailed")),+ "testing.iconErrored.retired" => retired(&Key("testing.iconErrored")),+ "testing.iconPassed.retired" => retired(&Key("testing.iconPassed")),+ "testing.iconQueued.retired" => retired(&Key("testing.iconQueued")),+ "testing.iconUnset.retired" => retired(&Key("testing.iconUnset")),+ "testing.iconSkipped.retired" => retired(&Key("testing.iconSkipped")),"debugExceptionWidget.border" => [Hex("#a31515"), Hex("#a31515"), Hex("#a31515"), Hex("#a31515")],"debugExceptionWidget.background" => [Hex("#420b0d"), Hex("#f1dfde"), Hex("#420b0d"), Hex("#f1dfde")],"list.errorForeground" => [Hex("#F88070"), Hex("#B01011"), ColorValue::None, ColorValue::None],@@ -53,3 +59,8 @@ pub(super) fn debug_default(key: &str) -> Option<[ColorValue; 4]> {_ => return Option::None,})}++/// testing/browser/theme.ts `testStatesToRetiredIconColors`: `transparent(color, 0.7)`.+fn retired(color: &'static ColorValue) -> [ColorValue; 4] {+ [Transparent(color, 0.7), Transparent(color, 0.7), Transparent(color, 0.7), Transparent(color, 0.7)]+}diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rsindex 058f1919ff3..84748a0073f 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -529,6 +529,8 @@ pub struct Workbench {manage_bounds: Rc<Cell<gpui::Bounds<gpui::Pixels>>>,/// Each view container title's `...`, the anchor of its menu.container_more_bounds: Rc<std::cell::RefCell<HashMap<&'static str, gpui::Bounds<gpui::Pixels>>>>,+ /// The container whose `...` opened the menu, with that menu's `context_menus_shown`.+ container_more_menu: Option<(&'static str, usize)>,context_menus_shown: usize,pub(crate) notifications: notifications_view::NotificationsUi,/// Extension status bar entries, in statusbarModel.ts order.@@ -905,6 +907,7 @@ impl Workbench {context_menu: None,manage_bounds: Rc::default(),container_more_bounds: Rc::default(),+ container_more_menu: None,context_menus_shown: 0,notifications: notifications_view::NotificationsUi::new(cx),status_entries: Vec::new(),@@ -1347,9 +1350,18 @@ impl Workbench {.text_color(if active { self.color("commandCenter.foreground") } else { foreground }).hover(|center| center.bg(self.color("commandCenter.activeBackground")).border_color(self.color("commandCenter.activeBorder")).text_color(self.color("commandCenter.activeForeground"))).text_size(px(12.))- // `.command-center-center.multiple`: 12px padding on each side, outside the 38vw.- .when_some(self.command_center_debug_actions(window, cx), |center, actions| center.w(px(viewport_width * 0.38 + 2. + 24.)).pl(px(12.)).pr(px(12.)).child(actions))- .child(div().debug_selector(|| "command-center-label".into()).child(self.command_center_label()))+ // `.command-center-center.multiple`: 12px padding on each side, outside the 38vw; compact mode's toolbars+ // share the width (`flex: 1`) around commandCenterControl.ts's `circleSmallFilled` spacer.+ .map(|center| match self.command_center_debug_actions(window, cx) {+ Some(actions) => center+ .w(px(viewport_width * 0.38 + 2. + 24.))+ .pl(px(12.))+ .pr(px(12.))+ .child(actions.flex_1().min_w_0().overflow_hidden())+ .child(div().debug_selector(|| "command-center-spacer".into()).px(px(8.)).opacity(0.5).child(self.icon("circle-small-filled", 16., 16., self.color("commandCenter.foreground"))))+ .child(div().debug_selector(|| "command-center-label".into()).flex_1().min_w_0().child(div().pl(px(8.)).child(self.command_center_label()))),+ None => center.child(div().debug_selector(|| "command-center-label".into()).child(self.command_center_label())),+ }).child(self.hover_target("command-center", HoverContent::Text(self.command_center_tooltip()), HoverOptions::instant())).on_mouse_down(MouseButton::Right, cx.listener(show_command_center_context_menu))// A Cmd+click belongs to the title's menu, which upstream takes in the capture phase.@@ -1423,8 +1435,8 @@ impl Workbench {];// titlebarPart.ts `createActionToolBar`: the editor, layout and global actions are one toolbar, one tab stop.let mut actions = Vec::new();- // titlebarPart.ts: `MenuId.TitleBar`'s `0_leading` group and a separator lead the toolbar.- if !auxiliary {+ // titlebarPart.ts: `MenuId.TitleBar`'s `0_leading` group and a separator lead the toolbar, but in a compact window.+ if !compact {let leading = self.title_bar_global_buttons(TITLE_BAR_LEADING_GROUP, foreground, window, cx);if !leading.is_empty() {actions.extend(leading.into_iter().map(|(id, button)| title_item(actions_bar, &id, button, cx)));@@ -1456,7 +1468,7 @@ impl Workbench {}}// titlebarPart.ts: the global actions (`MenuId.TitleBar`, the bell) come after the layout controls.- if !auxiliary {+ if !compact {let global = self.title_bar_global_buttons("navigation", foreground, window, cx);actions.extend(global.into_iter().map(|(id, button)| title_item(actions_bar, &id, button, cx)));}@@ -1482,7 +1494,7 @@ impl Workbench {actions.push(title_item(actions_bar, "manage", manage, cx));}// The toolbar's overflow ends it: the editor actions' secondary ones, Customize Layout and the other global groups.- let global_overflow = !auxiliary && !self.title_bar_global_secondary_actions(&self.key_context(window)).is_empty();+ let global_overflow = !compact && !self.title_bar_global_secondary_actions(&self.key_context(window)).is_empty();if editor_actions && (layout_control_enabled || self.editors.active_index().is_some()) || global_overflow {let more = self.editor_title_more_button(foreground, true, cx);actions.push(title_item(actions_bar, "more", more, cx));diff --git a/native/crates/app/src/workbench/action_bar.rs b/native/crates/app/src/workbench/action_bar.rsindex fdde16ffaeb..c12d1d79070 100644--- a/native/crates/app/src/workbench/action_bar.rs+++ b/native/crates/app/src/workbench/action_bar.rs@@ -6,7 +6,7 @@ use std::cell::RefCell;use std::collections::HashMap;use std::rc::Rc;-use gpui::{App, BorderStyle, Bounds, Context, Div, FocusHandle, InteractiveElement, KeyDownEvent, MouseButton, ParentElement, Pixels, Stateful, Styled, Window, canvas, outline};+use gpui::{App, BorderStyle, Bounds, Context, Div, FocusHandle, InteractiveElement, KeyDownEvent, MouseButton, ParentElement, Pixels, Stateful, Styled, IntoElement, Window, canvas, fill, outline, px};use super::Workbench;@@ -48,12 +48,14 @@ impl Workbench {let drawn = self.action_bars.drawn.clone();let border = self.theme.color("focusBorder");let painted = focus.clone();+ // `activity_item_focus_indicator` draws the activity bar's, which depends on the item being checked.+ let own_indicator = bar == "activity";item.relative().track_focus(&focus.clone().tab_stop(tab_stop)).on_mouse_down(MouseButton::Left, |_, window, _| window.prevent_default()).child(canvas(move |bounds, _, _| drawn.borrow_mut().entry(bar).or_default().push(DrawnItem { focus, bounds }), move |bounds, _, window, _| {- if let Some(border) = border.filter(|_| painted.is_focused(window)) {+ if let Some(border) = border.filter(|_| !own_indicator && painted.is_focused(window)) {window.paint_quad(outline(bounds, border, BorderStyle::Solid));}})@@ -74,6 +76,29 @@ impl Workbench {last.unwrap_or(&items[0].focus) == focus}+ /// activityaction.css: a focused checked activity item's label has a rounded `focusBorder` outline outside it, an+ /// unchecked one the 2px `activityBar.activeBorder` indicator on its left edge.+ pub(super) fn activity_item_focus_indicator(&self, key: &str, checked: bool, cx: &App) -> impl IntoElement {+ let focus = self.action_bar_focus("activity", key, cx);+ let border = self.theme.color("focusBorder");+ let indicator = self.theme.color("activityBar.activeBorder");+ canvas(|_, _, _| {}, move |bounds, _, window, _| {+ if !focus.is_focused(window) {+ return;+ }+ let quad = match (checked, border, indicator) {+ (true, Some(border), _) => outline(bounds.dilate(px(1.)), border, BorderStyle::Solid).corner_radii(px(4.)),+ (false, _, Some(indicator)) => fill(Bounds::new(bounds.origin, gpui::size(px(2.), bounds.size.height)), indicator),+ _ => return,+ };+ window.paint_quad(quad);+ })+ .absolute()+ .top_0()+ .left_0()+ .size_full()+ }+pub(super) fn action_bar_focus(&self, bar: &'static str, key: &str, cx: &App) -> FocusHandle {self.action_bars.handles.borrow_mut().entry((bar, key.to_owned())).or_insert_with(|| cx.focus_handle()).clone()}@@ -135,6 +160,8 @@ impl Workbench {cx.stop_propagation();window.focus(&focus, cx);self.action_bars.last.insert(bar, focus);+ self.dismiss_hover(cx);+ self.hover_focused_action_item(window, cx);}/// The bar holding the focused item.diff --git a/native/crates/app/src/workbench/activity.rs b/native/crates/app/src/workbench/activity.rsindex b2a79f8e39c..9a33fb8c983 100644--- a/native/crates/app/src/workbench/activity.rs+++ b/native/crates/app/src/workbench/activity.rs@@ -137,6 +137,8 @@ impl Workbench {"workbench.view.scm" => badges.push(Badge::Number(self.scm_badge())),"workbench.view.extensions" => badges.push(Badge::Number(self.extensions_badge().map_or(0, |(count, _)| count as u64))),"workbench.view.testing" => badges.extend(self.testing_badge()),+ // debugService.ts `onDidChangeCallStack`: the Call Stack's container counts the sessions without a parent.+ "workbench.view.debug" => badges.push(Badge::Number(self.debug.sessions.iter().filter(|session| session.parent.is_none()).count() as u64)),_ => {}}badgesdiff --git a/native/crates/app/src/workbench/activity_bar_menu.rs b/native/crates/app/src/workbench/activity_bar_menu.rsindex e69f1332411..26602d49b72 100644--- a/native/crates/app/src/workbench/activity_bar_menu.rs+++ b/native/crates/app/src/workbench/activity_bar_menu.rs@@ -4,7 +4,7 @@use std::collections::HashMap;-use gpui::{AppContext, Bounds, Context, Div, InteractiveElement, MouseButton, MouseDownEvent, Pixels, Point, SharedString, Stateful, StatefulInteractiveElement, Window};+use gpui::{AppContext, Bounds, Context, Div, InteractiveElement, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, SharedString, Stateful, StatefulInteractiveElement, Window, prelude::FluentBuilder};use serde_json::{Value, json};use super::Workbench;@@ -55,12 +55,11 @@ fn toggle_pinned_command(part: Part, id: &str) -> String {}/// `openCommandActionDescriptor.id` of the containers that have one (viewContainerModel.ts `keybindingId`).-fn container_open_command(container: &str) -> Option<&'static str> {+fn container_open_command(container: &'static str) -> Option<&'static str> {match container {- "workbench.view.explorer" => Some("workbench.view.explorer"),- "workbench.view.debug" => Some("workbench.view.debug"),- "workbench.view.extensions" => Some("workbench.view.extensions"),- TESTING_CONTAINER => Some(TESTING_CONTAINER),+ "workbench.view.explorer" | "workbench.view.debug" | "workbench.view.extensions" => Some(container),+ // views.ts `registerViewContainer` gives an extension's container `{ id: viewContainer.id }`, Testing's included.+ extension if extension.starts_with("workbench.view.extension.") => Some(extension),_ => None,}}@@ -292,7 +291,7 @@ impl Workbench {}/// viewContainerModel.ts `keybindingId`: the container's open command, else its first view's that has one.- fn composite_keybinding_command(&self, container: &str) -> Option<&'static str> {+ fn composite_keybinding_command(&self, container: &'static str) -> Option<&'static str> {container_open_command(container).or_else(|| self.views_in(container).iter().find_map(|view| view_open_command(view.id)))}@@ -358,6 +357,7 @@ impl Workbench {pub(super) fn activity_composite_item(&self, item: Stateful<Div>, bar: &'static str, id: &'static str, title: &'static str, icon: SharedString, active: bool, cx: &mut Context<Self>) -> Stateful<Div> {let foreground = self.color(if active { "modernActivityBarItem.activeForeground" } else { "activityBar.inactiveForeground" });let dragged = DraggedComposite { id: composite_container(id), label: title.into(), icon: Some(icon), foreground, background: self.color("modernActivityBar.background") };+ let item = item.when(bar == "activity", |item| item.child(self.activity_item_focus_indicator(id, active, cx)));let item = self.with_composite_menu(item, bar, id, Part::SideBar, cx).on_drag(dragged, |dragged, _, _, cx| cx.new(|_| dragged.clone()));self.with_composite_drop(item, bar, id, Part::SideBar, cx)}diff --git a/native/crates/app/src/workbench/auxiliary_windows/tests.rs b/native/crates/app/src/workbench/auxiliary_windows/tests.rsindex 4f95e86baa0..eea1501e394 100644--- a/native/crates/app/src/workbench/auxiliary_windows/tests.rs+++ b/native/crates/app/src/workbench/auxiliary_windows/tests.rs@@ -6,6 +6,7 @@ use gpui::{AnyWindowHandle, TestAppContext, VisualTestContext};use super::super::editor_groups::MAIN_PART;use crate::host_sync::HostSync;use crate::languages::Languages;+use crate::menus::{Entry, MenuId, MenuItem};use crate::theme::load_theme;use crate::workbench::Workbench;@@ -255,3 +256,26 @@ fn an_editor_windows_title_bar_toolbars_are_its_own_tab_stops(cx: &mut TestAppCowindow_cx.run_until_parked();assert!(workbench.read_with(cx, |workbench, _| workbench.is_compact_part(part)));}++/// titlebarPart.ts `globalActionsEnabled`: an editor window's title bar shows `MenuId.TitleBar`'s actions until it+/// turns compact.+#[gpui::test]+fn an_editor_windows_title_bar_shows_the_global_actions_until_compact(cx: &mut TestAppContext) {+ let (_dir, workbench, cx) = workbench_with("title-global", &["a.txt", "b.txt"], cx);+ workbench.update(cx, |workbench, _| {+ for (id, group) in [("port.lead", "0_leading"), ("port.nav", "navigation")] {+ let entry = Entry::Command { id: id.into(), precondition: None, toggled: None, alt: None };+ workbench.menus.push(MenuItem { menu: MenuId::TitleBar, entry, title: id.into(), group: group.into(), order: 1., when: None });+ }+ });+ run(&workbench, "workbench.action.moveEditorToNewWindow", cx);+ let handle = editor_window(&workbench, cx);+ let mut window_cx = VisualTestContext::from_window(handle, cx);+ let drawn = |cx: &mut VisualTestContext| ["title-bar-action-port.lead", "title-bar-action-port.nav"].map(|selector| cx.debug_bounds(selector).is_some());++ window_cx.run_until_parked();+ assert_eq!(drawn(&mut window_cx), [true; 2]);+ handle.update(&mut window_cx, |_, window, cx| workbench.update(cx, |workbench, cx| drop(workbench.execute_command("workbench.action.enableCompactAuxiliaryWindow", vec![], window, cx)))).unwrap();+ window_cx.run_until_parked();+ assert_eq!(drawn(&mut window_cx), [false; 2]);+}diff --git a/native/crates/app/src/workbench/breakpoint_widget.rs b/native/crates/app/src/workbench/breakpoint_widget.rsindex 25e240659bc..c8ea9ad02b0 100644--- a/native/crates/app/src/workbench/breakpoint_widget.rs+++ b/native/crates/app/src/workbench/breakpoint_widget.rs@@ -19,6 +19,7 @@ pub enum WidgetContext {Condition,HitCount,LogMessage,+ TriggerPoint,}pub struct BreakpointWidget {@@ -34,6 +35,8 @@ pub struct BreakpointWidget {pub condition: String,pub hit_count: String,pub log_message: String,+ /// `triggeredByBreakpointInput`: the breakpoint picked in the Wait for Breakpoint select box.+ pub triggered_by: Option<String>,}/// getBreakpointMessageAndIcon for a source breakpoint: the icon id and the hover message.@@ -82,6 +85,16 @@ pub fn breakpoint_icon(breakpoint: &Breakpoint, model: &DebugModel, debug_active("debug-breakpoint", message)}+/// breakpointEditorContribution.ts and debug.contribution.css: the color of the dot a stack frame glyph draws over a+/// plain or conditional breakpoint; the frame's own color rule comes last, so only the plain one's dot stays red.+fn stack_frame_dot(breakpoint_icon: &str, frame_icon: &str) -> Option<&'static str> {+ match breakpoint_icon {+ "debug-breakpoint" => Some("debugIcon.breakpointForeground"),+ "debug-breakpoint-conditional" => Some(icon_file_and_color(frame_icon).1),+ _ => None,+ }+}+/// The codicon file of a debug icon id (codiconsLibrary.ts aliases) and the color debug.contribution's rules give it.pub fn icon_file_and_color(icon: &str) -> (&'static str, &'static str) {match icon {@@ -109,13 +122,13 @@ pub fn icon_file_and_color(icon: &str) -> (&'static str, &'static str) {/// breakpointWidget.ts placeholders, by context.fn placeholder(context: WidgetContext) -> &'static str {match context {- WidgetContext::Condition => "Break when expression evaluates to true. 'Enter' to accept, 'esc' to cancel.",+ WidgetContext::Condition | WidgetContext::TriggerPoint => "Break when expression evaluates to true. 'Enter' to accept, 'esc' to cancel.",WidgetContext::HitCount => "Break when hit count condition is met. 'Enter' to accept, 'esc' to cancel.",WidgetContext::LogMessage => "Message to log when breakpoint is hit. Expressions within {} are interpolated. 'Enter' to accept, 'esc' to cancel.",}}-const CONTEXT_LABELS: [(WidgetContext, &str); 3] = [(WidgetContext::Condition, "Expression"), (WidgetContext::HitCount, "Hit Count"), (WidgetContext::LogMessage, "Log Message")];+const CONTEXT_LABELS: [(WidgetContext, &str); 4] = [(WidgetContext::Condition, "Expression"), (WidgetContext::HitCount, "Hit Count"), (WidgetContext::LogMessage, "Log Message"), (WidgetContext::TriggerPoint, "Wait for Breakpoint")];impl Workbench {pub(super) fn register_breakpoint_widget_commands(&mut self) {@@ -127,6 +140,14 @@ impl Workbench {workbench.close_breakpoint_widget(window, cx);Outcome::done()});+ self.commands.register("_debug.breakpointWidget.selectTrigger", |workbench, args, window, cx| {+ if let Some(widget) = workbench.breakpoint_widget.as_mut() {+ widget.triggered_by = args.first().and_then(Value::as_str).map(str::to_owned);+ }+ window.focus(&workbench.debug_view.widget_focus, cx);+ cx.notify();+ Outcome::done()+ });// The glyph margin context menu's actions, with `[uri, line]` arguments.self.commands.register("_debug.gutter.addBreakpoint", |workbench, args, _, cx| {let (uri, line) = gutter_args(&args);@@ -134,35 +155,97 @@ impl Workbench {workbench.breakpoints_changed(change, true, cx);Outcome::done()});- for (id, context) in [("_debug.gutter.addConditionalBreakpoint", WidgetContext::Condition), ("_debug.gutter.addLogpoint", WidgetContext::LogMessage), ("_debug.gutter.editBreakpoint", WidgetContext::Condition)] {+ let adds = [("_debug.gutter.addConditionalBreakpoint", WidgetContext::Condition), ("_debug.gutter.addLogpoint", WidgetContext::LogMessage), ("_debug.gutter.addTriggeredBreakpoint", WidgetContext::TriggerPoint)];+ for (id, context) in adds {self.commands.register(id, move |workbench, args, window, cx| {- let (uri, line) = gutter_args(&args);- let uri = crate::debug::uri_string(&uri);- let existing = workbench.debug.model.breakpoints_in(&uri).find(|breakpoint| breakpoint.line_number() == line).map(|breakpoint| breakpoint.id().to_owned());- workbench.show_breakpoint_widget(line, existing, context, window, cx);+ let (_, line) = gutter_args(&args);+ workbench.show_breakpoint_widget(line, None, context, window, cx);Outcome::done()});}- self.commands.register("_debug.gutter.removeBreakpoints", |workbench, args, _, cx| {+ self.commands.register("_debug.gutter.runToLine", |workbench, args, window, cx| {let (uri, line) = gutter_args(&args);- let ids = workbench.line_breakpoints(&uri, line);+ workbench.run_to_line(&uri, line, None, window, cx);+ Outcome::done()+ });+ // The actions on one breakpoint, with its id as the argument.+ self.commands.register("_debug.gutter.editBreakpoint", |workbench, args, window, cx| {+ let Some(breakpoint) = args.first().and_then(Value::as_str).and_then(|id| workbench.debug.model.breakpoint(id)) else { return Outcome::done() };+ let (line, id) = (breakpoint.line_number(), breakpoint.id().to_owned());+ workbench.show_breakpoint_widget(line, Some(id), WidgetContext::Condition, window, cx);+ Outcome::done()+ });+ self.commands.register("_debug.gutter.removeBreakpoint", |workbench, args, _, cx| {+ let ids: Vec<String> = args.first().and_then(Value::as_str).map(str::to_owned).into_iter().collect();let change = workbench.debug.model.remove_breakpoints(&ids);workbench.breakpoints_changed(change, true, cx);Outcome::done()});- self.commands.register("_debug.gutter.toggleEnablement", |workbench, args, _, cx| {- let (uri, line) = gutter_args(&args);- let ids = workbench.line_breakpoints(&uri, line);- let enable = !ids.iter().any(|id| workbench.debug.model.breakpoint(id).is_some_and(|breakpoint| breakpoint.base.enabled));- let mut change = crate::debug::BreakpointsChange::default();- for id in ids {- change.changed.extend(workbench.debug.model.set_enablement(&id, enable).changed);- }+ self.commands.register("_debug.gutter.toggleBreakpoint", |workbench, args, _, cx| {+ let Some(breakpoint) = args.first().and_then(Value::as_str).and_then(|id| workbench.debug.model.breakpoint(id)) else { return Outcome::done() };+ let (id, enabled) = (breakpoint.id().to_owned(), breakpoint.base.enabled);+ let change = workbench.debug.model.set_enablement(&id, !enabled);workbench.breakpoints_changed(change, true, cx);Outcome::done()});}+ /// breakpointEditorContribution.ts's gutter actions generator (`getContextMenuActions`), the line-number menu's+ /// `2_debug` group: add actions on a line without breakpoints, else actions on its one breakpoint or submenus per+ /// breakpoint, then Run to Line while stopped.+ pub(super) fn debug_gutter_actions(&mut self, line: u32) -> Vec<MenuAction> {+ let Some(editor) = self.editors.active() else { return Vec::new() };+ if self.debug.debuggers.is_empty() || !self.can_set_breakpoints_in(editor) {+ return Vec::new();+ }+ let uri = editor.document().uri();+ let mut breakpoints: Vec<Breakpoint> = self.debug.model.breakpoints_in(&editor.document().uri_string()).filter(|breakpoint| breakpoint.line_number() == line).cloned().collect();+ let mut actions = Vec::new();+ let action = |workbench: &mut Self, title: String, command: &str, args: Vec<Value>| MenuAction::Command { id: workbench.bound_command(command, args), title, enabled: true, checked: false, alt: None };+ match breakpoints.as_slice() {+ [] => {+ let line_args = vec![uri.clone(), json!(line)];+ for (title, command) in [("Add Breakpoint", "_debug.gutter.addBreakpoint"), ("Add Conditional Breakpoint...", "_debug.gutter.addConditionalBreakpoint"), ("Add Logpoint...", "_debug.gutter.addLogpoint"), ("Add Triggered Breakpoint...", "_debug.gutter.addTriggeredBreakpoint")] {+ actions.push(action(self, title.into(), command, line_args.clone()));+ }+ }+ [breakpoint] => {+ let kind = if breakpoint.base.log_message.is_some() { "Logpoint" } else { "Breakpoint" };+ let toggle = if breakpoint.base.enabled { format!("Disable {kind}") } else { format!("Enable {kind}") };+ let id = vec![json!(breakpoint.id())];+ actions.push(action(self, format!("Remove {kind}"), "_debug.gutter.removeBreakpoint", id.clone()));+ actions.push(action(self, format!("Edit {kind}..."), "_debug.gutter.editBreakpoint", id.clone()));+ actions.push(action(self, toggle, "_debug.gutter.toggleBreakpoint", id));+ }+ _ => {+ breakpoints.sort_by(|first, second| match (first.column(), second.column()) {+ (Some(first), Some(second)) => first.cmp(&second),+ _ => std::cmp::Ordering::Equal,+ });+ let (mut remove, mut edit, mut toggle) = (Vec::new(), Vec::new(), Vec::new());+ for breakpoint in &breakpoints {+ let id = vec![json!(breakpoint.id())];+ let (remove_title, edit_title, toggle_title) = match (breakpoint.column(), breakpoint.base.enabled) {+ (Some(column), true) => (format!("Remove Inline Breakpoint on Column {column}"), format!("Edit Inline Breakpoint on Column {column}"), format!("Disable Inline Breakpoint on Column {column}")),+ (Some(column), false) => (format!("Remove Inline Breakpoint on Column {column}"), format!("Edit Inline Breakpoint on Column {column}"), format!("Enable Inline Breakpoint on Column {column}")),+ (None, enabled) => ("Remove Line Breakpoint".into(), "Edit Line Breakpoint".into(), if enabled { "Disable Line Breakpoint".into() } else { "Enable Line Breakpoint".into() }),+ };+ remove.push(action(self, remove_title, "_debug.gutter.removeBreakpoint", id.clone()));+ edit.push(action(self, edit_title, "_debug.gutter.editBreakpoint", id.clone()));+ toggle.push(action(self, toggle_title, "_debug.gutter.toggleBreakpoint", id));+ }+ actions.push(MenuAction::Submenu { title: "Remove Breakpoints".into(), actions: remove, checked: false });+ actions.push(MenuAction::Submenu { title: "Edit Breakpoints".into(), actions: edit, checked: false });+ actions.push(MenuAction::Submenu { title: "Enable/Disable Breakpoints".into(), actions: toggle, checked: false });+ }+ }+ if self.debug.state() == crate::debug::session::State::Stopped {+ actions.push(MenuAction::Separator);+ actions.push(action(self, "Run to Line".into(), "_debug.gutter.runToLine", vec![uri, json!(line)]));+ }+ actions+ }+fn line_breakpoints(&self, uri: &Value, line: u32) -> Vec<String> {let uri = crate::debug::uri_string(uri);self.debug.model.breakpoints_in(&uri).filter(|breakpoint| breakpoint.line_number() == line).map(|breakpoint| breakpoint.id().to_owned()).collect()@@ -178,24 +261,31 @@ impl Workbench {let breakpoint = model.breakpoints_in(&uri_string).find(|breakpoint| breakpoint.line_number() == line);let mut cell = div().id(("glyph-margin", index)).relative().w(px(width)).h(px(line_height)).flex_none().flex().items_center().justify_center();let frame = self.stack_frame_glyph(editor, line);- match breakpoint {- Some(breakpoint) => {+ let mut dot = None;+ match (breakpoint, frame) {+ // The breakpoint and frame decorations share one glyph element: codicon.css draws debug-stackframe's `::before`+ // (registered after the breakpoints') and debug.contribution.css adds a dot `::after` to the plain ones.+ // shortcut: debug-breakpoint-unsupported, registered after debug-stackframe, keeps its own glyph upstream; draw it if a debugger reports one.+ (Some(breakpoint), Some(frame)) => dot = stack_frame_dot(breakpoint_icon(breakpoint, model, debug_active, dirty).0, frame),+ (Some(breakpoint), None) => {let (icon, _) = breakpoint_icon(breakpoint, model, debug_active, dirty);cell = cell.child(div().absolute().inset_0().flex().items_center().justify_center().child(self.breakpoint_icon(icon, 16.)));}// breakpointEditorContribution.ts `onMouseMove`: the hint only where breakpoints can be set.- None if frame.is_none() && self.debug_view_hint_line() == Some((uri_string.clone(), index)) && self.can_set_breakpoints_in(editor) => {+ (None, None) if self.debug_view_hint_line() == Some((uri_string.clone(), index)) && self.can_set_breakpoints_in(editor) => {cell = cell.child(div().absolute().inset_0().flex().items_center().justify_center().opacity(0.4).child(self.breakpoint_icon("debug-hint", 16.)));}- None if frame.is_none() => cell = cell.children(self.test_glyph(editor, line, cx)),- None => {}+ (None, None) => cell = cell.children(self.test_glyph(editor, line, cx)),+ (None, Some(_)) => {}}if let Some(icon) = frame {cell = cell.child(div().absolute().inset_0().flex().items_center().justify_center().child(self.breakpoint_icon(icon, 16.)));}+ if let Some(color) = dot {+ cell = cell.child(div().absolute().inset_0().flex().items_center().justify_center().child(self.icon("debug-stackframe-dot", 16., 16., self.color(color))));+ }let uri = editor.document().uri();let hover_uri = uri_string.clone();- let menu_uri = uri.clone();cell.cursor_pointer().on_hover(cx.listener(move |workbench, hovered: &bool, _, cx| {let hint = &mut workbench.debug_view.hint;@@ -208,11 +298,16 @@ impl Workbench {})).on_mouse_down(MouseButton::Left, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| {cx.stop_propagation();+ // macOS takes Ctrl+click for a right click, which editorLineNumberMenu.ts `doShow` handles.+ if event.modifiers.control {+ workbench.show_line_number_context_menu(index, event.position, false, window, cx);+ return;+ }workbench.glyph_margin_clicked(&uri, line, event.modifiers.shift, window, cx);})).on_mouse_down(MouseButton::Right, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| {cx.stop_propagation();- workbench.show_glyph_margin_menu(&menu_uri, line, event.position, window, cx);+ workbench.show_line_number_context_menu(index, event.position, false, window, cx);})).into_any_element()}@@ -240,7 +335,7 @@ impl Workbench {frames}- fn stack_frame_glyph(&self, editor: &OpenEditor, line: u32) -> Option<&'static str> {+ pub(super) fn stack_frame_glyph(&self, editor: &OpenEditor, line: u32) -> Option<&'static str> {let frames = self.stack_frames_in(editor);let (_, is_top, _) = frames.into_iter().find(|(frame_line, _, session_focused)| *frame_line == line && *session_focused)?;Some(if is_top { "debug-stackframe" } else { "debug-stackframe-focused" })@@ -311,22 +406,6 @@ impl Workbench {}/// breakpointEditorContribution.ts `getContextMenuActions`.- fn show_glyph_margin_menu(&mut self, uri: &Value, line: u32, position: gpui::Point<gpui::Pixels>, window: &mut Window, cx: &mut Context<Self>) {- let ids = self.line_breakpoints(uri, line);- let command = |id: &str, title: &str| MenuAction::Command { id: id.into(), title: title.into(), enabled: true, checked: false, alt: None };- let actions = match ids.first().and_then(|id| self.debug.model.breakpoint(id)) {- Some(breakpoint) => {- let kind = if breakpoint.base.log_message.is_some() { "Logpoint" } else { "Breakpoint" };- let toggle = if breakpoint.base.enabled { format!("Disable {kind}") } else { format!("Enable {kind}") };- vec![command("_debug.gutter.removeBreakpoints", &format!("Remove {kind}")), command("_debug.gutter.editBreakpoint", &format!("Edit {kind}...")), command("_debug.gutter.toggleEnablement", &toggle)]- }- None => vec![command("_debug.gutter.addBreakpoint", "Add Breakpoint"), command("_debug.gutter.addConditionalBreakpoint", "Add Conditional Breakpoint..."), command("_debug.gutter.addLogpoint", "Add Logpoint...")],- };- let anchor = gpui::Bounds { origin: position, size: gpui::size(px(0.), px(0.)) };- let context = self.key_context(window);- self.show_context_menu_actions(actions, &context, anchor, vec![uri.clone(), json!(line)], window, cx);- }-/// `BreakpointWidget.show`: a zone of two lines below the line, the input focused with the breakpoint's value.pub(crate) fn show_breakpoint_widget(&mut self, line: u32, breakpoint: Option<String>, context: WidgetContext, window: &mut Window, cx: &mut Context<Self>) {self.close_breakpoint_widget(window, cx);@@ -335,21 +414,30 @@ impl Workbench {let existing = breakpoint.as_deref().and_then(|id| self.debug.model.breakpoint(id));let text = |value: Option<&String>| value.cloned().unwrap_or_default();let (condition, hit_count, log_message) = (text(existing.and_then(|bp| bp.base.condition.as_ref())), text(existing.and_then(|bp| bp.base.hit_condition.as_ref())), text(existing.and_then(|bp| bp.base.log_message.as_ref())));- // breakpointWidget.ts: an existing logpoint opens on its message, a hit count without a condition on it.- let context = match (existing.is_some(), context) {- (true, _) if !log_message.is_empty() => WidgetContext::LogMessage,- (true, _) if condition.is_empty() && !hit_count.is_empty() => WidgetContext::HitCount,+ // breakpointWidget.ts: an existing logpoint opens on its message, a hit count without a condition on it, a+ // triggered breakpoint on Wait for Breakpoint.+ let context = match (existing, context) {+ (Some(_), _) if !log_message.is_empty() => WidgetContext::LogMessage,+ (Some(_), _) if condition.is_empty() && !hit_count.is_empty() => WidgetContext::HitCount,+ (Some(existing), _) if existing.triggered_by.is_some() => WidgetContext::TriggerPoint,(_, context) => context,};+ // `createTriggerBreakpointInput`: the breakpoint's trigger, else the first candidate for a breakpoint without one.+ let candidates = trigger_candidates(&self.debug.model, breakpoint.as_deref());+ let triggered_by = match existing.and_then(|existing| existing.triggered_by.as_ref()) {+ Some(id) => candidates.iter().find(|candidate| candidate.id() == id),+ None => candidates.first(),+ }+ .map(|candidate| candidate.id().to_owned());let zone_id = editor.add_view_zone(Some(Position::new(line as usize - 1, 0)), 2. * viewport.line_height);let mut input = InputBox::default();input.set_value(match context {- WidgetContext::Condition => condition.clone(),+ WidgetContext::Condition | WidgetContext::TriggerPoint => condition.clone(),WidgetContext::HitCount => hit_count.clone(),WidgetContext::LogMessage => log_message.clone(),});let uri = editor.document().uri();- self.breakpoint_widget = Some(BreakpointWidget { model_uri: editor.document().uri_string(), uri, line, zone_id, breakpoint, context, input, condition, hit_count, log_message });+ self.breakpoint_widget = Some(BreakpointWidget { model_uri: editor.document().uri_string(), uri, line, zone_id, breakpoint, context, input, condition, hit_count, log_message, triggered_by });self.debug_view.widget_view.reset();window.focus(&self.debug_view.widget_focus, cx);cx.notify();@@ -367,14 +455,14 @@ impl Workbench {/// `BreakpointWidget.close(success: true)`: the typed values update the breakpoint or add one.fn accept_breakpoint_widget(&mut self, window: &mut Window, cx: &mut Context<Self>) {let Some(widget) = self.breakpoint_widget.as_mut() else { return };- let value = widget.input.value.clone();- match widget.context {- WidgetContext::Condition => widget.condition = value,- WidgetContext::HitCount => widget.hit_count = value,- WidgetContext::LogMessage => widget.log_message = value,- }+ widget.remember_input();let some = |text: &String| (!text.is_empty()).then(|| text.clone());- let (condition, hit_condition, log_message) = (some(&widget.condition), some(&widget.hit_count), some(&widget.log_message));+ let trigger_point = widget.context == WidgetContext::TriggerPoint;+ // Trigger points take no other conditions.+ let (condition, hit_condition, log_message, triggered_by) = match trigger_point {+ true => (None, None, None, widget.triggered_by.clone()),+ false => (some(&widget.condition), some(&widget.hit_count), some(&widget.log_message), None),+ };let (uri, line, breakpoint) = (widget.uri.clone(), widget.line, widget.breakpoint.clone());let change = match breakpoint {Some(id) => {@@ -382,9 +470,10 @@ impl Workbench {update.insert("condition".into(), json!(condition));update.insert("hitCondition".into(), json!(hit_condition));update.insert("logMessage".into(), json!(log_message));+ update.insert("triggeredBy".into(), json!(triggered_by));self.debug.model.update_breakpoints(&[(id, update)])}- None if condition.is_some() || hit_condition.is_some() || log_message.is_some() => self.debug.model.add_breakpoints(&uri, vec![BreakpointData { condition, hit_condition, log_message, ..BreakpointData::at(line) }]),+ None if trigger_point || condition.is_some() || hit_condition.is_some() || log_message.is_some() => self.debug.model.add_breakpoints(&uri, vec![BreakpointData { condition, hit_condition, log_message, triggered_by, ..BreakpointData::at(line) }]),None => crate::debug::BreakpointsChange::default(),};self.breakpoints_changed(change, true, cx);@@ -393,15 +482,10 @@ impl Workbench {fn switch_breakpoint_widget_context(&mut self, context: WidgetContext, window: &mut Window, cx: &mut Context<Self>) {let Some(widget) = self.breakpoint_widget.as_mut() else { return };- let value = widget.input.value.clone();- match widget.context {- WidgetContext::Condition => widget.condition = value,- WidgetContext::HitCount => widget.hit_count = value,- WidgetContext::LogMessage => widget.log_message = value,- }+ widget.remember_input();widget.context = context;let next = match context {- WidgetContext::Condition => widget.condition.clone(),+ WidgetContext::Condition | WidgetContext::TriggerPoint => widget.condition.clone(),WidgetContext::HitCount => widget.hit_count.clone(),WidgetContext::LogMessage => widget.log_message.clone(),};@@ -442,24 +526,15 @@ impl Workbench {let next = match widget.context {WidgetContext::Condition => WidgetContext::HitCount,WidgetContext::HitCount => WidgetContext::LogMessage,- WidgetContext::LogMessage => WidgetContext::Condition,+ WidgetContext::LogMessage => WidgetContext::TriggerPoint,+ WidgetContext::TriggerPoint => WidgetContext::Condition,};workbench.switch_breakpoint_widget_context(next, window, cx);}));- let input = div()- .flex_1()- .h(px(22.))- .ml(px(8.))- .mr(px(20.))- .px(px(4.))- .flex()- .bg(self.color("input.background"))- .on_key_down(cx.listener(|workbench, event: &KeyDownEvent, window, cx| match event.keystroke.key.as_str() {- "enter" => workbench.accept_breakpoint_widget(window, cx),- "escape" => workbench.close_breakpoint_widget(window, cx),- _ => {}- }))- .child(self.input_text(InputId::BreakpointWidget, InputLook { password: false, placeholder: Some(placeholder(widget.context).into()), focused }, cx));+ let content = match widget.context {+ WidgetContext::TriggerPoint => self.trigger_breakpoint_select(widget, cx),+ _ => self.breakpoint_widget_input(widget, focused, cx),+ };Some(div().absolute()@@ -474,11 +549,77 @@ impl Workbench {.flex().items_center().child(select)- .child(input)+ .child(content).into_any_element(),)}+ fn breakpoint_widget_input(&self, widget: &BreakpointWidget, focused: bool, cx: &mut Context<Self>) -> AnyElement {+ div()+ .flex_1()+ .h(px(22.))+ .ml(px(8.))+ .mr(px(20.))+ .px(px(4.))+ .flex()+ .bg(self.color("input.background"))+ .on_key_down(cx.listener(|workbench, event: &KeyDownEvent, window, cx| match event.keystroke.key.as_str() {+ "enter" => workbench.accept_breakpoint_widget(window, cx),+ "escape" => workbench.close_breakpoint_widget(window, cx),+ _ => {}+ }))+ .child(self.input_text(InputId::BreakpointWidget, InputLook { password: false, placeholder: Some(placeholder(widget.context).into()), focused }, cx))+ .into_any_element()+ }++ /// `createTriggerBreakpointInput`: a 300px select box of the candidates after a disabled None, then an OK button+ /// that accepts (breakpointWidget.css `.select-breakpoint-container`).+ fn trigger_breakpoint_select(&self, widget: &BreakpointWidget, cx: &mut Context<Self>) -> AnyElement {+ let selected = widget.triggered_by.as_deref().and_then(|id| self.debug.model.breakpoint(id)).map_or_else(|| "None".to_owned(), |breakpoint| self.trigger_label(breakpoint));+ let select = div()+ .id("breakpoint-widget-trigger-select")+ .w(px(300.))+ .h(px(22.))+ .px(px(6.))+ .flex()+ .items_center()+ .justify_between()+ .rounded(px(4.))+ .border_1()+ .border_color(self.color("dropdown.border"))+ .bg(self.color("dropdown.background"))+ .text_color(self.color("dropdown.foreground"))+ .cursor_pointer()+ .child(div().truncate().child(selected))+ .child(self.icon("chevron-down", 16., 14., self.color("dropdown.foreground")))+ .on_mouse_down(MouseButton::Left, cx.listener(|workbench, event: &MouseDownEvent, window, cx| {+ cx.stop_propagation();+ workbench.show_trigger_breakpoint_options(event.position, window, cx);+ }));+ let ok = self.comment_form_button("breakpoint-widget-ok".into(), "OK".into(), true, true, |workbench, window, cx| workbench.accept_breakpoint_widget(window, cx), cx);+ div().flex_1().ml(px(8.)).flex().items_center().gap(px(10.)).child(select).child(ok).into_any_element()+ }++ /// `buildBreakpointOptions`: `{relative path}: {line}`.+ fn trigger_label(&self, breakpoint: &Breakpoint) -> String {+ let path = std::path::Path::new(breakpoint.uri["path"].as_str().unwrap_or_default());+ format!("{}: {}", crate::quick_input::path_label(path, self.workspace()), breakpoint.line_number())+ }++ fn show_trigger_breakpoint_options(&mut self, position: gpui::Point<gpui::Pixels>, window: &mut Window, cx: &mut Context<Self>) {+ let Some(widget) = self.breakpoint_widget.as_ref() else { return };+ let candidates: Vec<(String, String)> = trigger_candidates(&self.debug.model, widget.breakpoint.as_deref()).into_iter().map(|breakpoint| (breakpoint.id().to_owned(), self.trigger_label(breakpoint))).collect();+ let selected = widget.triggered_by.clone();+ let mut actions = vec![MenuAction::Command { id: "_debug.breakpointWidget.selectTrigger".into(), title: "None".into(), enabled: false, checked: selected.is_none(), alt: None }];+ for (id, label) in candidates {+ let checked = selected.as_deref() == Some(id.as_str());+ actions.push(MenuAction::Command { id: self.bound_command("_debug.breakpointWidget.selectTrigger", vec![json!(id)]), title: label, enabled: true, checked, alt: None });+ }+ let anchor = gpui::Bounds { origin: position, size: gpui::size(px(0.), px(0.)) };+ let context = self.key_context(window);+ self.show_context_menu_actions(actions, &context, anchor, Vec::new(), window, cx);+ }+pub(super) fn edit_breakpoint_widget_input(&mut self, edit: impl FnOnce(&mut InputBox), cx: &mut Context<Self>) {if let Some(widget) = self.breakpoint_widget.as_mut() {edit(&mut widget.input);@@ -487,6 +628,138 @@ impl Workbench {}}+impl BreakpointWidget {+ /// `rememberInput`: the input's value for its text context.+ fn remember_input(&mut self) {+ let value = self.input.value.clone();+ match self.context {+ WidgetContext::Condition => self.condition = value,+ WidgetContext::HitCount => self.hit_count = value,+ WidgetContext::LogMessage => self.log_message = value,+ WidgetContext::TriggerPoint => {}+ }+ }+}++/// breakpointWidget.ts `availableBreakpoints`: the source breakpoints but the edited one and logpoints.+fn trigger_candidates<'a>(model: &'a DebugModel, own: Option<&str>) -> Vec<&'a Breakpoint> {+ model.breakpoints.iter().filter(|breakpoint| Some(breakpoint.id()) != own && breakpoint.base.log_message.is_none()).collect()+}+fn gutter_args(args: &[Value]) -> (Value, u32) {(args.first().cloned().unwrap_or_default(), args.get(1).and_then(Value::as_u64).unwrap_or(1) as u32)}++#[cfg(test)]+mod tests {+ use std::path::Path;++ use gpui::TestAppContext;+ use serde_json::json;++ use super::super::Workbench;+ use super::super::testing_gutter::tests::{command_titled, titles, workbench_with_tests};+ use super::WidgetContext;+ use crate::debug::BreakpointData;+ use crate::debug::session::Session;++ /// debug.contribution.css: a plain breakpoint under the stopped frame draws the frame's glyph with a dot, not its circle.+ #[gpui::test]+ fn a_breakpoint_under_the_stopped_frame_draws_the_stack_frame_dot(cx: &mut TestAppContext) {+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let themes = exthost::scan::scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();+ let theme = crate::theme::load_theme(&[themes], "Dark Modern").unwrap();+ let dir = std::env::temp_dir().join(format!("vsrustium-{}", crate::test_name()));+ std::fs::create_dir_all(&dir).unwrap();+ let file = dir.join("a.js");+ std::fs::write(&file, "x\n".repeat(10)).unwrap();+ let (workbench, cx) = cx.add_window_view(|_, cx| Workbench::new(theme, app_root.clone(), None, crate::languages::Languages::new(&[]), crate::default_settings(), crate::host_sync::HostSync::new(std::sync::mpsc::channel().0), cx));+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.debug.model.add_breakpoints(&json!({ "scheme": "file", "path": file.to_string_lossy() }), vec![BreakpointData::at(2)]);+ let mut session = Session::new("s".into(), 1, json!({ "name": "s", "type": "node", "request": "launch" }), json!({}), None, json!({}));+ session.set_threads(&[json!({ "id": 1, "name": "main" })]);+ let thread = session.thread_mut(1).unwrap();+ thread.stopped = true;+ thread.frames = vec![crate::debug::session::StackFrame { id: 3, source: json!({ "path": file.to_string_lossy() }), line: 2, column: 1, ..Default::default() }];+ workbench.debug.sessions = vec![session];+ let focus = super::super::debug_service::DebugFocus { session: Some("s".into()), thread: Some(1), frame: Some(3) };+ workbench.set_debug_focus(focus, super::super::debug_service::Reveal::TakingFocus, window, cx);+ });+ cx.run_until_parked();+ assert!(cx.debug_bounds("codicon-debug-stackframe").is_some(), "the frame's glyph");+ assert!(cx.debug_bounds("codicon-debug-stackframe-dot").is_some(), "the breakpoint's dot over it");+ assert!(cx.debug_bounds("codicon-circle-filled").is_none(), "no breakpoint circle");+ std::fs::remove_dir_all(dir).unwrap();+ }++ /// A debugger and an extension taking breakpoints in the open document's language.+ fn add_debugger(workbench: &mut Workbench) {+ workbench.debug.debuggers.push(crate::debug::configuration::Debugger { debug_type: "node".into(), contribution: json!({}), extension_id: "a.node".into() });+ let language = workbench.editors.active().unwrap().document().language_id.clone();+ let description = json!({ "contributes": { "breakpoints": [{ "language": language }] } });+ workbench.extensions.push(exthost::scan::ScannedExtension { id: "a.node".into(), location: "/node".into(), description });+ }++ fn line_menu(workbench: &gpui::Entity<Workbench>, line: usize, cx: &mut gpui::VisualTestContext) -> Vec<crate::menus::MenuAction> {+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.show_line_number_context_menu(line, gpui::point(gpui::px(10.), gpui::px(40.)), false, window, cx);+ let actions = workbench.context_menu.as_ref().expect("a context menu shows").levels[0].actions.clone();+ workbench.hide_context_menu(window, cx);+ actions+ })+ }++ /// editorLineNumberMenu.ts `doShow`: the debug generator's `2_debug` group follows the tests' `1_testing` one; Add+ /// Triggered Breakpoint... opens the widget on Wait for Breakpoint, which adds a breakpoint triggered by the first+ /// other one.+ #[gpui::test]+ fn the_gutter_menu_adds_a_triggered_breakpoint_after_the_tests_actions(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with_tests("debug-gutter-menu", &[("c\0t", "t", 1)], cx);+ let uri = workbench.update(cx, |workbench, _| {+ add_debugger(workbench);+ let uri = workbench.editors.active().unwrap().document().uri();+ workbench.debug.model.add_breakpoints(&uri, vec![BreakpointData::at(3)]);+ uri+ });+ let actions = line_menu(&workbench, 0, cx);+ assert_eq!(titles(&actions), ["Run Test", "Debug Test", "Execute Using Profile...", "Reveal in Test Explorer", "---", "Add Breakpoint", "Add Conditional Breakpoint...", "Add Logpoint...", "Add Triggered Breakpoint..."]);+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command(&command_titled(&actions, "Add Triggered Breakpoint..."), Vec::new(), window, cx)));+ cx.run_until_parked();+ let trigger = workbench.read_with(cx, |workbench, _| {+ let widget = workbench.breakpoint_widget.as_ref().expect("the widget shows");+ assert_eq!(widget.context, WidgetContext::TriggerPoint);+ widget.triggered_by.clone().expect("the first candidate")+ });+ workbench.update_in(cx, |workbench, window, cx| workbench.accept_breakpoint_widget(window, cx));+ let added = workbench.read_with(cx, |workbench, _| workbench.debug.model.breakpoints_in(&crate::debug::uri_string(&uri)).find(|breakpoint| breakpoint.line_number() == 1).map(|breakpoint| breakpoint.triggered_by.clone()));+ assert_eq!(added, Some(Some(trigger)));+ }++ /// `getContextMenuActions`: one breakpoint's actions, submenus for several, Run to Line while stopped.+ #[gpui::test]+ fn the_gutter_menu_acts_on_the_lines_breakpoints(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with_tests("debug-gutter-breakpoints", &[], cx);+ workbench.update(cx, |workbench, _| {+ add_debugger(workbench);+ let uri = workbench.editors.active().unwrap().document().uri();+ workbench.debug.model.add_breakpoints(&uri, vec![BreakpointData { log_message: Some("m".into()), ..BreakpointData::at(1) }]);+ workbench.debug.model.add_breakpoints(&uri, vec![BreakpointData { column: Some(9), ..BreakpointData::at(3) }, BreakpointData { column: Some(1), ..BreakpointData::at(3) }]);+ });+ assert_eq!(titles(&line_menu(&workbench, 0, cx)), ["Remove Logpoint", "Edit Logpoint...", "Disable Logpoint"]);+ let several = line_menu(&workbench, 2, cx);+ assert_eq!(titles(&several), ["Remove Breakpoints >", "Edit Breakpoints >", "Enable/Disable Breakpoints >"]);+ let crate::menus::MenuAction::Submenu { actions, .. } = &several[0] else { panic!("a submenu") };+ assert_eq!(titles(actions), ["Remove Inline Breakpoint on Column 1", "Remove Inline Breakpoint on Column 9"]);++ workbench.update_in(cx, |workbench, window, cx| {+ let mut session = Session::new("s".into(), 1, json!({ "name": "s", "type": "node", "request": "launch" }), json!({}), None, json!({}));+ session.set_threads(&[json!({ "id": 1, "name": "main" })]);+ session.thread_mut(1).unwrap().stopped = true;+ session.initialized = true;+ workbench.debug.sessions = vec![session];+ let focus = super::super::debug_service::DebugFocus { session: Some("s".into()), thread: Some(1), frame: None };+ workbench.set_debug_focus(focus, super::super::debug_service::Reveal::No, window, cx);+ });+ assert_eq!(titles(&line_menu(&workbench, 1, cx)), ["Add Breakpoint", "Add Conditional Breakpoint...", "Add Logpoint...", "Add Triggered Breakpoint...", "---", "Run to Line"]);+ }+}diff --git a/native/crates/app/src/workbench/code_actions.rs b/native/crates/app/src/workbench/code_actions.rsindex 7144cb50a68..0d2feec0a20 100644--- a/native/crates/app/src/workbench/code_actions.rs+++ b/native/crates/app/src/workbench/code_actions.rs@@ -611,6 +611,7 @@ impl Workbench {};let number = line + 1;let count = lines.len();+ let decorated = self.glyph_margin_decorated(editor, number as u32);let mut effective = number;let mut gutter = false;if !line_has_space {@@ -619,7 +620,7 @@ impl Workbench {let previous = empty_or_indented(number - 1);let next = !end_line && empty_or_indented(number + 1);let current = empty_or_indented(number);- if !next && !previous {+ if !next && !previous && !decorated {gutter = true;} else if previous || end_line {effective -= 1;@@ -627,7 +628,8 @@ impl Workbench {effective += 1;}} else if number == 1 && (number == count || !empty_or_indented(number + 1) && !empty_or_indented(number)) {- gutter = true;+ // With a glyph there the light bulb goes inline on line 1, over its first column.+ gutter = !decorated;} else if number < count && !is_folded(number + 1) {effective += 1;} else if (utf16_column(&lines[line], position.column) + 1) as f32 * space_width < 22. {@@ -648,6 +650,17 @@ impl Workbench {self.code_actions.lightbulb = Some(LightBulb { model_id: editor.model_id, line, column, set, icon, color, title });}+ /// `hasDecoration`: another glyph margin decoration on the 1-based line, a breakpoint+ /// (breakpointEditorContribution.ts), a stack frame (callStackEditorContribution.ts) or a test (testingDecorations.ts).+ fn glyph_margin_decorated(&self, editor: &OpenEditor, line: u32) -> bool {+ let uri = editor.document().uri_string();+ let path = editor.document().path.to_string_lossy().into_owned();+ let tests_shown = self.setting("testing.gutterEnabled") != false && editor.document().scheme == "file";+ self.debug.model.breakpoints_in(&uri).any(|breakpoint| breakpoint.line_number() == line)+ || self.stack_frame_glyph(editor, line).is_some()+ || tests_shown && !self.tests_at_line(&path, line).is_empty()+ }+/// `computeLightBulbInfo`: the icon for AI and preferred quick fixes and the title with the keybinding./// The gutter variants (`gutter-lightbulb*`) are the same codicons.fn lightbulb_info(&self, set: &CodeActionSet) -> (&'static str, &'static str, String) {diff --git a/native/crates/app/src/workbench/code_actions/tests.rs b/native/crates/app/src/workbench/code_actions/tests.rsindex 8ce1c96dc46..37a6ff1af6a 100644--- a/native/crates/app/src/workbench/code_actions/tests.rs+++ b/native/crates/app/src/workbench/code_actions/tests.rs@@ -157,6 +157,22 @@ fn an_automatic_request_shows_the_light_bulb_and_cmd_period_applies_from_the_menassert!(released.contains(&json!(1)), "the replaced automatic list is released: {released:?}");}+/// lightBulbWidget.ts `update`: line 1 without room puts the light bulb in the glyph margin, unless another glyph+/// (`hasDecoration`) is there; then it sits inline at the line's start.+#[gpui::test]+fn a_glyph_on_line_1_keeps_the_light_bulb_inline(cx: &mut TestAppContext) {+ let (workbench, cx, receiver) = open("let x\nlet y", cx);+ workbench.update(cx, |workbench, _| {+ let uri = workbench.editors.active().unwrap().document().uri();+ workbench.debug.model.add_breakpoints(&uri, vec![crate::debug::BreakpointData::at(1)]);+ });+ answer(&receiver, json!([edit_action("Add a", "a")]), cx);+ workbench.read_with(cx, |workbench, _| {+ let lightbulb = workbench.code_actions.lightbulb.as_ref().expect("an action shows the light bulb");+ assert_eq!((lightbulb.line, lightbulb.column), (0, Some(0)));+ });+}+/// actionWidget.ts: the list takes the focus, so typed keys navigate it (listWidget.ts `TypeNavigationController`)/// rather than edit the text, and the widget hides when the focus leaves it.#[gpui::test]diff --git a/native/crates/app/src/workbench/comment_node.rs b/native/crates/app/src/workbench/comment_node.rsindex 6f9cf2e842f..53ebf48f358 100644--- a/native/crates/app/src/workbench/comment_node.rs+++ b/native/crates/app/src/workbench/comment_node.rs@@ -22,6 +22,8 @@ mod tests;const EDITING: u64 = 0;/// review.css `.comment-reactions`: 8px above the 25px row.pub(super) const REACTIONS_ROW: f32 = 8. + 25.;+/// review.css `.review-widget .action-item`: each reaction and the picker are action items 4px after the previous.+const ACTION_ITEM_MARGIN: f32 = 4.;impl Workbench {/// `CommentNode.update` on a mode change: a comment switched to Editing opens its edit form with its text, one@@ -247,7 +249,8 @@ impl Workbench {let count = reaction["count"].as_u64();let button = div().id(gpui::SharedString::from(format!("comment-reaction-{controller}-{thread}-{}-{index}", comment["uniqueIdInThread"])))- .mr(px(7.))+ .debug_selector(move || format!("comment-reaction-{index}"))+ .ml(px(ACTION_ITEM_MARGIN)).px(px(4.)).py(px(1.)).flex()@@ -272,6 +275,8 @@ impl Workbench {let picker = self.icon("reactions", 26., 16., self.foreground_or("icon.foreground")).id(gpui::SharedString::from(format!("comment-reaction-picker-{controller}-{thread}-{}", comment["uniqueIdInThread"])))+ .debug_selector(|| "comment-reaction-picker".into())+ .ml(px(ACTION_ITEM_MARGIN)).h(px(16.)).mt(px(3.)).cursor_pointer()diff --git a/native/crates/app/src/workbench/comment_node/tests.rs b/native/crates/app/src/workbench/comment_node/tests.rsindex ccab2f3d8cd..c22619b7cb9 100644--- a/native/crates/app/src/workbench/comment_node/tests.rs+++ b/native/crates/app/src/workbench/comment_node/tests.rs@@ -64,6 +64,29 @@ fn a_reaction_tooltip_names_its_count_or_reactors() {assert_eq!(reaction_tooltip(&reaction(5, vec!["Ann", "Bob"]), true), "Toggle reaction, Ann, Bob and 3 more reacted with +1");}+/// review.css `.review-widget .action-item`: a reaction sits 4px into the comment's contents and the picker 4px after it.+#[gpui::test]+fn reactions_are_action_items_4px_apart(cx: &mut TestAppContext) {+ let (workbench, cx, _, dir) = open(cx, "comment-reaction-row", "one\ntwo\n");+ let resource = json!({ "scheme": "file", "path": dir.join("a.txt").to_string_lossy() });+ let request = |method: &str, args: Vec<Value>, cx: &mut VisualTestContext| {+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.handle_comments_request(method, &args, window, cx)));+ };+ request("$registerCommentController", vec![json!(1), json!("review"), json!("Review"), json!("test.ext")], cx);+ request("$updateCommentControllerFeatures", vec![json!(1), json!({ "reactionHandler": true })], cx);+ let range = json!({ "startLineNumber": 1, "startColumn": 1, "endLineNumber": 1, "endColumn": 4 });+ request("$createCommentThread", vec![json!(1), json!(7), json!("t"), resource.clone(), range, json!([]), json!({ "value": "test.ext" }), json!(false)], cx);+ let comment = json!({ "uniqueIdInThread": 1, "body": "Looks good", "userName": "Ann", "commentReactions": [{ "label": "+1", "count": 2 }] });+ request("$updateCommentThread", vec![json!(1), json!(7), json!("t"), resource, json!({ "comments": [comment], "collapseState": 1 })], cx);+ cx.run_until_parked();+ let node = cx.debug_bounds("comment-node-0").expect("the zone shows its comment");+ let reaction = cx.debug_bounds("comment-reaction-0").expect("the reaction with a count shows");+ let picker = cx.debug_bounds("comment-reaction-picker").expect("the reaction handler adds the picker");+ // The node's 20px padding, then the contents' 20px.+ assert_eq!(f32::from(reaction.left() - node.left()), 20. + 20. + 4.);+ assert_eq!(f32::from(picker.left() - reaction.right()), 4.);+}+/// The picker registers one `reaction.command.<label>` per reaction; the next picker replaces them.#[gpui::test]fn the_reaction_picker_registers_a_command_per_reaction(cx: &mut TestAppContext) {diff --git a/native/crates/app/src/workbench/content_hover.rs b/native/crates/app/src/workbench/content_hover.rsindex 7456e855d3f..1d8da815d8b 100644--- a/native/crates/app/src/workbench/content_hover.rs+++ b/native/crates/app/src/workbench/content_hover.rs@@ -290,7 +290,7 @@ impl Workbench {};if show {let anchor = match mouse.target {- MouseTarget::Text { line, visible } => anchor_at(editor, line, visible),+ MouseTarget::Text { line, visible } => anchor_at(editor, line, visible).or_else(|| self.inline_completions_empty_area_anchor(editor, line)),MouseTarget::Widget | MouseTarget::Other => None,};if self.start_showing_or_update_hover(anchor, Mode::Delayed, HoverSource::Mouse, false, Some(mouse.position), cx) {diff --git a/native/crates/app/src/workbench/context_menu.rs b/native/crates/app/src/workbench/context_menu.rsindex e580407fcb9..da7e1c169c5 100644--- a/native/crates/app/src/workbench/context_menu.rs+++ b/native/crates/app/src/workbench/context_menu.rs@@ -69,7 +69,7 @@ pub struct ContextMenu {/// None when nothing had focus, as a title bar right-click in a window without editors.pub(super) focus_to_return: Option<FocusHandle>,/// Counts the menus shown; a new count restarts the open animation.- shown: usize,+ pub(super) shown: usize,_enable_mouse_up: Task<()>,_blur: Subscription,_window_deactivated: Subscription,@@ -134,6 +134,7 @@ impl Workbench {});self.context_menus_shown += 1;self.editor_groups.title_menu_group = None;+ self.keybindings_editor.more_menu_open = false;self.context_menu = Some(ContextMenu {levels: vec![MenuLevel { actions, origin, width, focused: None, parent: None }],keybindings,diff --git a/native/crates/app/src/workbench/debug_commands.rs b/native/crates/app/src/workbench/debug_commands.rsindex 4ff5c56a9af..63a57434e58 100644--- a/native/crates/app/src/workbench/debug_commands.rs+++ b/native/crates/app/src/workbench/debug_commands.rs@@ -318,14 +318,22 @@ impl Workbench {let Some(editor) = self.editors.active() else { return Outcome::done() };let head = editor.selections[0].head;let line = head.line as u32 + 1;- let (uri, uri_string, path) = (editor.document().uri(), editor.document().uri_string(), editor.document().path.clone());+ let (uri, path) = (editor.document().uri(), editor.document().path.clone());let on_focused_frame = self.debug.focused_frame().is_some_and(|frame| frame.line == line && frame.path().map(PathBuf::from) == Some(path.clone()));let column = on_focused_frame.then_some(head.column as u32 + 1);+ self.run_to_line(&uri, line, column, window, cx);+ Outcome::done()+ }++ /// debugService.ts `runTo`, from Run to Cursor and the gutter's Run to Line.+ pub(super) fn run_to_line(&mut self, uri: &Value, line: u32, column: Option<u32>, window: &mut Window, cx: &mut Context<Self>) {+ let uri_string = crate::debug::uri_string(uri);+ let path = PathBuf::from(uri["path"].as_str().unwrap_or_default());let exists = self.debug.model.breakpoints_in(&uri_string).any(|breakpoint| breakpoint.line_number() == line && (column.is_none() || breakpoint.column() == column));let mut breakpoint = None;let mut sends = Vec::new();if !exists {- let change = self.debug.model.add_breakpoints(&uri, vec![BreakpointData { column, ..BreakpointData::at(line) }]);+ let change = self.debug.model.add_breakpoints(uri, vec![BreakpointData { column, ..BreakpointData::at(line) }]);breakpoint = change.added.first().cloned();self.breakpoints_changed(change, false, cx);let sessions: Vec<String> = self.debug.sessions.iter().map(|session| session.id.clone()).collect();@@ -348,7 +356,6 @@ impl Workbench {let _ = this.update_in(cx, |workbench, window, cx| workbench.run_to(breakpoint, &path, window, cx));}).detach();- Outcome::done()}/// The rest of `runTo` once the breakpoint is in place: it is removed at the next stop or end.@@ -501,6 +508,9 @@ impl Workbench {}context.insert("breakpointsExist".into(), json!(!self.debug.model.breakpoints.is_empty()));context.insert("watchExpressionsExist".into(), json!(!self.debug.model.watch_expressions.is_empty()));+ context.insert("variablesFocused".into(), json!(self.debug_view.list_focus[super::debug_view::VARIABLES_VIEW].is_focused(window)));+ context.insert("watchExpressionsFocused".into(), json!(self.debug_view.list_focus[super::debug_view::WATCH_VIEW].is_focused(window)));+ context.insert("expressionSelected".into(), json!(self.debug_view.editing.is_some()));context.insert("loadedScriptsSupported".into(), json!(focused.is_some_and(|session| session.capabilities["supportsLoadedSourcesRequest"] == true)));context.insert("stepBackSupported".into(), json!(focused.is_some_and(|session| session.capabilities["supportsStepBack"] == true)));context.insert("restartFrameSupported".into(), json!(focused.is_some_and(|session| session.capabilities["supportsRestartFrame"] == true)));diff --git a/native/crates/app/src/workbench/debug_console.rs b/native/crates/app/src/workbench/debug_console.rsindex 8130a30b19e..b14fad0eea6 100644--- a/native/crates/app/src/workbench/debug_console.rs+++ b/native/crates/app/src/workbench/debug_console.rs@@ -255,7 +255,10 @@ impl Workbench {div().id("repl-session-select").relative()- .min_w(px(100.))+ // actionbar.css `.select-container`: `flex: 1` up to 170px. shortcut: fixed 170px, where the reference+ // shrinks to 60px in a panel too narrow for its actions; flex it if a narrow panel matters.+ .w(px(170.))+ .overflow_hidden().h(px(24.)).flex().items_center()@@ -367,6 +370,14 @@ impl Workbench {}pub(super) fn register_debug_console_commands(&mut self) {+ // debugViewlet.ts, in the Run and Debug container's Views submenu.+ self.commands.register("debug.toggleReplIgnoreFocus", |workbench, _, window, cx| {+ match workbench.panel_view_visible(DEBUG_PANEL_ID) {+ true => workbench.close_panel_view(DEBUG_PANEL_ID, cx),+ false => workbench.open_debug_console(false, window, cx),+ }+ Outcome::done()+ });self.commands.register("repl.action.filter", |workbench, _, window, cx| {window.focus(&workbench.debug_console.filter_focus, cx);Outcome::done()diff --git a/native/crates/app/src/workbench/debug_hover.rs b/native/crates/app/src/workbench/debug_hover.rsindex 4ab055411cc..dd544a14e27 100644--- a/native/crates/app/src/workbench/debug_hover.rs+++ b/native/crates/app/src/workbench/debug_hover.rs@@ -41,6 +41,8 @@ const INDENT: f32 = 8.;/// contentWidgets.ts: a widget keeps 22px from the page's top and bottom.const PAGE_PADDING: f32 = 22.;const FIND_PADDING: f32 = 30.;+/// The find input's width in the reference's debug hover, 19px wider than in a view pane (ui-pair `debug/hover-find.json`).+const FIND_INPUT_WIDTH: f32 = 174.5;pub(super) struct DebugHover {/// `hoverPosition`: the empty anchor under the mouse and the mouse there.@@ -507,7 +509,7 @@ impl Workbench {.debug_selector(|| "debug-hover-tree".into()).track_scroll(&self.debug_hover.tree_scroll).flex().flex_col().h(px(height)).pt(px(padding)).overflow_y_scroll().cursor_pointer().children(rows);let find = find_open.then(|| {- let look = TreeFindLook { input: InputId::DebugHoverFind, message: self.debug_hover_find_message(), filter_mode: self.debug_hover_find_filter_mode(), fuzzy: self.debug_hover_find_fuzzy() };+ let look = TreeFindLook { input: InputId::DebugHoverFind, message: self.debug_hover_find_message(), filter_mode: self.debug_hover_find_filter_mode(), fuzzy: self.debug_hover_find_fuzzy(), input_width: FIND_INPUT_WIDTH };self.tree_find_widget(look, |workbench, window, cx| workbench.close_debug_hover_find(window, cx), window, cx)});let tree = div().relative().child(rows).children(find);diff --git a/native/crates/app/src/workbench/debug_service.rs b/native/crates/app/src/workbench/debug_service.rsindex c7370561050..60b899c6a8b 100644--- a/native/crates/app/src/workbench/debug_service.rs+++ b/native/crates/app/src/workbench/debug_service.rs@@ -816,7 +816,7 @@ impl Workbench {workbench.enable_dependent_breakpoints(&session_id, &hit, cx);}if focus_now {- workbench.focus_after_stop(&session_id, id, window, cx);+ workbench.focus_after_stop(&session_id, id, &body["reason"], window, cx);}cx.notify();});@@ -905,8 +905,8 @@ impl Workbench {}/// The focus after a stop: the focused session or none focused takes the stopped thread- /// (debugService.ts `onDidStop` with `focusStackFrame`), and `debug.openDebug: openOnDebugBreak` shows the view.- fn focus_after_stop(&mut self, session_id: &str, thread_id: i64, window: &mut Window, cx: &mut Context<Self>) {+ /// (debugService.ts `onDidStop` with `focusStackFrame`), and `debug.openDebug: openOnDebugBreak` shows the view on a breakpoint.+ fn focus_after_stop(&mut self, session_id: &str, thread_id: i64, reason: &Value, window: &mut Window, cx: &mut Context<Self>) {let focused = self.debug.focus.session.as_deref();let focused_is_running = self.debug.focused_session().is_none_or(|session| session.state(self.debug.focus.thread) != State::Stopped);if focused.is_none() || focused == Some(session_id) || focused_is_running {@@ -915,7 +915,8 @@ impl Workbench {let reveal = if self.setting("debug.focusEditorOnBreak") == json!(false) { Reveal::PreservingFocus } else { Reveal::TakingFocus };self.set_debug_focus(target, reveal, window, cx);}- if self.setting("debug.openDebug") == "openOnDebugBreak" {+ let suppressed = self.debug.session(session_id).is_some_and(|session| session.options["suppressDebugView"] == true);+ if reason == "breakpoint" && self.setting("debug.openDebug") == "openOnDebugBreak" && !suppressed {self.show_debug_view(cx);}if self.setting("debug.focusWindowOnBreak") != false {@@ -2115,4 +2116,37 @@ mod tests {assert_eq!(workbench.read_with(cx, |workbench, _| workbench.extensions_viewlet.search.value.clone()), "@category:debuggers 'Plain Text'");std::fs::remove_dir_all(dir).unwrap();}++ /// debugSession.ts `handleStop`: `openOnDebugBreak` opens the view only for a `breakpoint` stop, and not with `suppressDebugView`.+ #[gpui::test]+ fn only_a_breakpoint_stop_opens_the_run_and_debug_view(cx: &mut gpui::TestAppContext) {+ use super::super::search_view::SideBarView;+ let app_root = std::path::Path::new(env!("VSCODE_SRC")).to_path_buf();+ let themes = exthost::scan::scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();+ let theme = crate::theme::load_theme(&[themes], "Dark Modern").unwrap();+ let (sender, host) = std::sync::mpsc::channel();+ let (workbench, cx) = cx.add_window_view(|_, cx| Workbench::new(theme, app_root.clone(), None, crate::languages::Languages::new(&[]), crate::default_settings(), crate::host_sync::HostSync::new(sender), cx));+ let mut view_after_stop = |reason: &str, options: Value| {+ workbench.update_in(cx, |workbench, _, _| {+ let mut session = crate::debug::session::Session::new("s".into(), 1, json!({ "name": "s", "type": "node", "request": "launch" }), json!({}), None, options);+ session.initialized = true;+ workbench.debug.sessions = vec![session];+ workbench.side_bar_view = SideBarView::Explorer;+ });+ let accept = |message: Value| exthost::session::ForwardedRequest { req: 1, proxy: "MainThreadDebugService", method: "$acceptDAMessage".into(), args: vec![json!(1), message] };+ let stopped = json!({ "type": "event", "seq": 0, "event": "stopped", "body": { "reason": reason, "threadId": 1 } });+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.handle_debug_request(accept(stopped), window, cx)));+ for (command, body) in [("threads", json!({ "threads": [{ "id": 1, "name": "main" }] })), ("stackTrace", json!({ "stackFrames": [] }))] {+ cx.run_until_parked();+ let request = host.try_iter().filter(|message| message.method == "$sendDAMessage").map(|message| message.args[1].clone()).find(|request| request["command"] == command).unwrap();+ let response = json!({ "type": "response", "seq": 0, "request_seq": request["seq"], "success": true, "command": command, "body": body });+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.handle_debug_request(accept(response), window, cx)));+ }+ cx.run_until_parked();+ workbench.read_with(cx, |workbench, _| workbench.side_bar_view)+ };+ assert_eq!(view_after_stop("debugger statement", json!({})), SideBarView::Explorer);+ assert_eq!(view_after_stop("breakpoint", json!({ "suppressDebugView": true })), SideBarView::Explorer);+ assert_eq!(view_after_stop("breakpoint", json!({})), SideBarView::Debug);+ }}diff --git a/native/crates/app/src/workbench/debug_toolbar.rs b/native/crates/app/src/workbench/debug_toolbar.rsindex abb3d96b3da..a2937096fc0 100644--- a/native/crates/app/src/workbench/debug_toolbar.rs+++ b/native/crates/app/src/workbench/debug_toolbar.rs@@ -99,10 +99,22 @@ impl Workbench {}let storage = self.profile_storage.lock().unwrap();let x = storage.get(POSITION_KEY).and_then(|value| value.parse::<f32>().ok()).filter(|x| !x.is_nan()).unwrap_or(0.5);- let y = storage.get(Y_KEY).and_then(|value| value.parse::<f32>().ok()).unwrap_or(0.);+ let y = storage.get(Y_KEY).and_then(|value| value.parse::<f32>().ok()).unwrap_or_else(|| self.debug_toolbar_y_default());(x, y)}+ /// debugToolBar.ts `yDefault`: layout.ts `mainContainerOffset.top`, below the banner and the title bar.+ fn debug_toolbar_y_default(&self) -> f32 {+ self.banner_height() + self.title_bar_height(false)+ }++ /// debugToolBar.ts `yRange`: from the top to the bottom of the title bar and the editor tabs.+ fn debug_toolbar_y_max(&self) -> f32 {+ let title_bar = if self.setting("window.commandCenter") != Value::Bool(false) { 35. } else { 28. };+ let tabs = if self.setting("workbench.editor.showTabs") == "none" { 0. } else { 35. };+ title_bar + tabs+ }+fn store_debug_toolbar_position(&mut self, x: f32, y: f32) {let mut storage = self.profile_storage.lock().unwrap();storage.set(POSITION_KEY, x.to_string());@@ -131,8 +143,7 @@ impl Workbench {}let window_width = f32::from(window.viewport_size().width);let (x, y) = self.debug_toolbar_position();- // debugToolBar.ts `yRange`: from the top to the bottom of the title bar and the editor tabs.- let y = y.clamp(0., 28. + 35.);+ let y = y.clamp(0., self.debug_toolbar_y_max());let left = (x * window_width - width / 2.).clamp(0., (window_width - width).max(0.));let mut bar = div().id("debug-toolbar")@@ -158,7 +169,7 @@ impl Workbench {cx.stop_propagation();// Double click on the gripper centers the toolbar again (#8250).if event.click_count == 2 {- workbench.store_debug_toolbar_position(0.5, 0.);+ workbench.store_debug_toolbar_position(0.5, workbench.debug_toolbar_y_default());cx.notify();return;}@@ -182,7 +193,7 @@ impl Workbench {}let context = self.key_context(window);let actions = self.debug_toolbar_actions(&context, window.modifiers().alt);- let mut bar = div().debug_selector(|| "command-center-debug".into()).flex().items_center().gap(px(4.)).mr(px(8.)).on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation());+ let mut bar = div().debug_selector(|| "command-center-debug".into()).flex().items_center().gap(px(4.)).on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation());for (command, title, enabled) in actions {bar = bar.child(self.debug_toolbar_item(command, title, enabled, &context, &[], window, cx));}@@ -358,7 +369,8 @@ impl Workbench {}let (folder, name) = self.selected_launch();let mut text = name.unwrap_or_default();- if let Some(folder) = folder.filter(|_| !text.is_empty() && self.workspace_folders().len() > 1) {+ // debugConfigurationManager.ts `getLaunches()` ends with the user settings launch, so it always counts more than one.+ if let Some(folder) = folder.filter(|_| !text.is_empty()) {text = format!("{text} ({})", folder.file_name().unwrap_or_default().to_string_lossy());}let entry = crate::main_thread_status_bar::StatusEntry {@@ -434,7 +446,8 @@ mod tests {#[gpui::test]fn the_stop_dropdown_opens_the_debug_toolbar_stop_menu(cx: &mut TestAppContext) {let (workbench, cx) = stopped(cx);- assert!(cx.debug_bounds("debug-toolbar").is_some(), "the toolbar floats by default");+ let toolbar = cx.debug_bounds("debug-toolbar").expect("the toolbar floats by default");+ assert_eq!(toolbar.top(), gpui::px(35.), "debugToolBar.ts `yDefault`: below the title bar");let chevron = cx.debug_bounds("debug-toolbar-stop-dropdown").expect("Stop has a dropdown with terminateDebuggeeSupported");cx.simulate_click(chevron.center(), gpui::Modifiers::none());let (origin, ids) = workbench.read_with(cx, |workbench, _| {@@ -449,6 +462,19 @@ mod tests {assert_eq!(ids, ["workbench.action.debug.disconnect"]);}+ /// debugService.ts `onDidChangeCallStack`: Run and Debug's activity badge counts the sessions without a parent.+ #[gpui::test]+ fn the_run_and_debug_activity_counts_the_root_sessions(cx: &mut TestAppContext) {+ let (workbench, cx) = stopped(cx);+ workbench.update(cx, |workbench, _| {+ let mut child = crate::debug::session::Session::new("c".into(), 2, json!({ "name": "c", "type": "node", "request": "launch" }), json!({}), None, json!({}));+ child.parent = Some("s".into());+ workbench.debug.sessions.push(child);+ });+ let badges = workbench.read_with(cx, |workbench, _| workbench.container_badges("workbench.view.debug"));+ assert!(matches!(badges[..], [crate::workbench::activity::Badge::Number(1)]), "{badges:?}");+ }+/// debugActionViewItems.ts `FocusSessionActionViewItem`: with two sessions the select lists them and focuses the chosen one.#[gpui::test]fn the_focus_session_select_focuses_the_chosen_session(cx: &mut TestAppContext) {@@ -509,7 +535,9 @@ mod tests {set_toolbar_location(&workbench, "commandCenter", cx);let actions = cx.debug_bounds("command-center-debug").expect("the command center shows the debug actions");let label = cx.debug_bounds("command-center-label").unwrap();- assert!(actions.right() <= label.left(), "{actions:?} {label:?}");+ let spacer = cx.debug_bounds("command-center-spacer").expect("commandCenterControl.ts's spacer between the groups");+ assert!(actions.right() <= spacer.left() && spacer.right() <= label.left(), "{actions:?} {spacer:?} {label:?}");+ assert_eq!(actions.size.width, label.size.width, "compact mode's toolbars share the width");assert!(workbench.read_with(cx, |workbench, _| workbench.command_center_debugging()), "statusbarColorProvider.ts colors the command center");assert!(cx.debug_bounds("debug-toolbar").is_none(), "no floating toolbar");}diff --git a/native/crates/app/src/workbench/debug_view.rs b/native/crates/app/src/workbench/debug_view.rsindex ff8c689932d..7438490c8c6 100644--- a/native/crates/app/src/workbench/debug_view.rs+++ b/native/crates/app/src/workbench/debug_view.rs@@ -430,7 +430,7 @@ impl Workbench {/// A tree row; listWidget.ts `MouseController` moves the list focus to a clicked or right-clicked row and the/// selection to a clicked one.- pub(super) fn debug_row(&self, key: String, depth: usize, twistie: Option<bool>, selected: bool, list_focused: bool, cx: &Context<Self>) -> gpui::Stateful<Div> {+ 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 row = div()@@ -442,7 +442,8 @@ impl Workbench {.flex().items_center().cursor_pointer()- .pl(px(INDENT * depth as f32 + 4.))+ // abstractTree.ts `DefaultIndent` (8px) plus the twistie's translateX(3px) (tree.css).+ .pl(px(INDENT * depth as f32 + 11.)).on_mouse_down(MouseButton::Left, cx.listener(move |workbench, _: &MouseDownEvent, _, cx| {workbench.debug_view.focused_row = Some(clicked.clone());workbench.debug_view.selected = Some(clicked.clone());@@ -452,14 +453,15 @@ impl Workbench {workbench.debug_view.focused_row = Some(right_clicked.clone());cx.notify();}));- let mut row = self.list_row_selection(row, selected, is_focus, list_focused);+ let row = self.list_row_selection(row, selected, is_focus, list_focused);let foreground = self.foreground_or("icon.foreground");- row = match twistie {- Some(true) => row.child(self.icon("chevron-down", 16., 16., foreground)),- Some(false) => row.child(self.icon("chevron-right", 16., 16., foreground)),- None => row.child(div().w(px(16.)).flex_none()),- };- row+ // tree.css `.monaco-tl-twistie`: 16px and `padding-right: 6px` less the 3px shift, before the contents.+ let twistie = div().w(px(19.)).flex_none();+ row.child(match twistie_expanded {+ Some(true) => twistie.child(self.icon("chevron-down", 16., 16., foreground)),+ Some(false) => twistie.child(self.icon("chevron-right", 16., 16., foreground)),+ None => twistie,+ })}/// debugExpressionRenderer.ts `renderExpressionValue`: numbers, strings and booleans in their token colors.@@ -491,7 +493,11 @@ impl Workbench {true => variable.name.clone(),false => format!("{} =", variable.name),};- label = label.child(div().text_color(self.color("debugTokenExpression.name")).when(dimmed, |name| name.opacity(0.5)).child(self.find_highlighted_text(name, highlights)));+ // Only the debug hover passes matches: outside a `.pane-body`, style.css recolors them with `list.highlightForeground`.+ let color = self.color("list.highlightForeground");+ let byte = |chars: usize| name.char_indices().nth(chars).map_or(name.len(), |(byte, _)| byte);+ let styles: Vec<_> = highlights.iter().map(|range| (byte(range.start)..byte(range.end), gpui::HighlightStyle { color: Some(color.into()), ..Default::default() })).collect();+ label = label.child(div().text_color(self.color("debugTokenExpression.name")).when(dimmed, |name| name.opacity(0.5)).child(gpui::StyledText::new(name).with_highlights(styles)));}label.children(lazy_button).child(div().when(!variable.name.is_empty(), |value| value.ml(px(6.))).text_color(self.value_color(variable)).overflow_hidden().text_ellipsis().child(variable.value.clone()))}@@ -773,6 +779,19 @@ impl Workbench {div().flex().min_w_0().ml(px(10.4)).mr(px(12.)).justify_end().items_center().overflow_hidden().child(name).child(badge)}+ /// breakpointsView.ts `updateSize` and debugViewlet.ts `updateBreakpointsMaxSize`: the body fits up to+ /// `MAX_VISIBLE_BREAKPOINTS` (9) rows and grows no further while another debug view is expanded.+ pub(super) fn limit_breakpoints_pane(&mut self) {+ let model = &self.debug.model;+ let new_function = usize::from(self.debug_view.editing == Some(Editing::NewFunctionBreakpoint));+ let rows = model.exception_breakpoints_for(self.debug.focus.session.as_deref()).count() + model.function_breakpoints.len() + new_function + model.breakpoints.len() + model.instruction_breakpoints.len();+ let minimum = (9. * ROW_HEIGHT).min(rows as f32 * ROW_HEIGHT);+ let Some(view) = self.panes_mut(super::view_panes::PaneContainer::Debug).view.as_mut() else { return };+ let Some(index) = view.ids().iter().position(|&id| id == BREAKPOINTS_VIEW) else { return };+ let all_others_collapsed = (0..view.ids().len()).all(|other| other == index || !view.is_expanded(other));+ view.set_body_limits(index, minimum, if all_others_collapsed { f32::INFINITY } else { minimum });+ }+fn breakpoint_rows(&self, list_focused: bool, window: &Window, cx: &mut Context<Self>) -> Vec<gpui::AnyElement> {let mut rows = Vec::new();let model = &self.debug.model;@@ -794,7 +813,7 @@ impl Workbench {let icon = if !breakpoint.base.enabled || !model.breakpoints_activated { "debug-breakpoint-function-disabled" } else { "debug-breakpoint-function" };rows.push(self.debug_row(format!("function/{id}"), 0, None, self.row_selected(&format!("function/{id}")), list_focused, cx)- .child(self.breakpoint_icon(icon, 16.))+ .child(self.breakpoint_row_icon(icon)).child(self.debug_checkbox(&id, breakpoint.base.enabled, cx)).child(div().child(breakpoint.name.clone())).into_any_element(),@@ -814,7 +833,7 @@ impl Workbench {let uri = breakpoint.uri.clone();rows.push(self.debug_row(format!("breakpoint/{id}"), 0, None, self.row_selected(&format!("breakpoint/{id}")), list_focused, cx)- .child(self.breakpoint_icon(icon, 16.))+ .child(self.breakpoint_row_icon(icon)).child(self.debug_checkbox(&id, breakpoint.base.enabled, cx)).child(div().flex_none().child(name)).child(div().flex_1().min_w_0().ml(px(6.)).overflow_hidden().whitespace_nowrap().text_ellipsis().text_size(px(12.)).text_color(description).child(folder))@@ -840,7 +859,7 @@ impl Workbench {};rows.push(self.debug_row(format!("instruction/{id}"), 0, None, self.row_selected(&format!("instruction/{id}")), list_focused, cx)- .child(self.breakpoint_icon(icon, 16.))+ .child(self.breakpoint_row_icon(icon)).child(self.debug_checkbox(&id, breakpoint.base.enabled, cx)).child(div().child(format!("0x{:x}", breakpoint.address))).into_any_element(),@@ -878,12 +897,21 @@ impl Workbench {self.icon(file, size, size, self.color(color))}+ /// debugViewlet.css `.breakpoint > .codicon`, 19px wide in the twistie's place (`.breakpoint { margin-left: -19px }`).+ fn breakpoint_row_icon(&self, icon: &str) -> Div {+ div().w(px(19.)).ml(px(-19.)).flex_none().flex().justify_center().child(self.breakpoint_icon(icon, 16.))+ }+/// The enablement checkbox of a breakpoint row (breakpointsView.ts `createCheckbox`).fn debug_checkbox(&self, id: &str, enabled: bool, cx: &mut Context<Self>) -> Div {let id = id.to_owned();let border = self.color("checkbox.border");let background = self.color("checkbox.background");- let mut checkbox = div().id(gpui::SharedString::from(format!("check-{id}"))).size(px(16.)).mx(px(4.)).rounded(px(3.)).border_1().border_color(border).bg(background).flex().items_center().justify_center();+ // debugViewlet.css `.breakpoint .monaco-custom-toggle.monaco-checkbox`: 18px, `margin-right: 4px`.+ let mut checkbox = div().id(gpui::SharedString::from(format!("check-{id}"))).debug_selector({+ let id = id.clone();+ move || format!("check-{id}")+ }).size(px(18.)).flex_none().mr(px(4.)).rounded(px(3.)).border_1().border_color(border).bg(background).flex().items_center().justify_center();if enabled {checkbox = checkbox.child(self.icon("check", 14., 14., self.color("checkbox.foreground")));}@@ -1071,6 +1099,38 @@ mod tests {use crate::languages::Languages;use crate::theme::load_theme;+ /// breakpointsView.ts `updateSize`: beside expanded debug views the Breakpoints body is as tall as its rows, and the+ /// others share the rest by weight, as `restoreViewSizes` runs after it.+ #[gpui::test]+ fn the_breakpoints_pane_is_as_tall_as_its_rows(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = super::super::variable_menu::tests::stopped_session(cx, json!({}));+ workbench.update(cx, |workbench, cx| {+ workbench.debug.model.add_breakpoints(&json!({ "scheme": "file", "path": "/app.js" }), vec![crate::debug::BreakpointData::at(5)]);+ workbench.show_debug_view(cx);+ });+ cx.update(|window, cx| drop(window.draw(cx)));+ let sizes = workbench.read_with(cx, |workbench, _| {+ let view = workbench.panes(super::super::view_panes::PaneContainer::Debug).view.as_ref().unwrap();+ view.ids().iter().copied().zip(view.sizes().iter().copied()).collect::<Vec<_>>()+ });+ assert_eq!(sizes, [(VARIABLES_VIEW, 392.), (WATCH_VIEW, 238.), (CALL_STACK_VIEW, 294.), (BREAKPOINTS_VIEW, super::super::view_panes::HEADER_SIZE + ROW_HEIGHT)]);+ }++ /// debugViewlet.css: a breakpoint's icon takes the twistie's place (`margin-left: -19px`), so its checkbox lines up+ /// with the exception rows' 30px into the row.+ #[gpui::test]+ fn a_breakpoint_checkbox_starts_where_the_twistie_ends(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = super::super::variable_menu::tests::stopped_session(cx, json!({}));+ let id = workbench.update(cx, |workbench, cx| {+ workbench.debug.model.add_breakpoints(&json!({ "scheme": "file", "path": "/app.js" }), vec![crate::debug::BreakpointData::at(5)]);+ workbench.show_debug_view(cx);+ workbench.debug.model.breakpoints[0].id().to_owned()+ });+ cx.update(|window, cx| drop(window.draw(cx)));+ let row = cx.debug_bounds(format!("breakpoint/{id}").leak()).expect("the breakpoint row");+ let checkbox = cx.debug_bounds(format!("check-{id}").leak()).expect("the breakpoint's checkbox");+ assert_eq!(checkbox.left() - row.left(), px(30.));+ }#[gpui::test]fn every_section_header_shows_while_a_session_runs(cx: &mut TestAppContext) {let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();@@ -1185,6 +1245,21 @@ mod tests {assert!((width - bold).abs() < px(0.5), "debugViewlet.css `.debug-pane .scope`: {width:?} for bold 11px {bold:?}");}+ /// abstractTree.ts `DefaultIndent` 8px, then tree.css's 16px twistie with its 6px padding: a scope's label starts+ /// 30px into its row, as ui-pair `debug/visualizer.json` local.png measures in the reference.+ #[gpui::test]+ fn a_scope_label_starts_after_the_tree_s_twistie(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = super::super::variable_menu::tests::stopped_session(cx, json!({}));+ workbench.update(cx, |workbench, cx| {+ workbench.debug.scopes = vec![Variable { name: "Local: main".into(), variables_reference: 4, ..Variable::default() }];+ workbench.show_debug_view(cx);+ });+ cx.update(|window, cx| drop(window.draw(cx)));+ let row = cx.debug_bounds("scope/Local: main").expect("the scope row");+ let label = cx.debug_bounds("scope/Local: main/label").expect("the scope row's label");+ assert_eq!(label.left() - row.left(), px(30.));+ }+/// debug.contribution.css: a watch row's `.expression` label is 11px monospace on macOS.#[gpui::test]fn watch_expression_labels_use_the_monospace_font(cx: &mut TestAppContext) {diff --git a/native/crates/app/src/workbench/debug_visualizers.rs b/native/crates/app/src/workbench/debug_visualizers.rsindex 01e8fa733ef..4fb58d51761 100644--- a/native/crates/app/src/workbench/debug_visualizers.rs+++ b/native/crates/app/src/workbench/debug_visualizers.rs@@ -434,7 +434,8 @@ impl Workbench {}}-/// `v.iconClass`, `ThemeIcon.asClassName`'s `codicon codicon-{id}`; without one the action has no icon.+/// `v.iconClass`, `ThemeIcon.asClassName`'s `codicon codicon-{id}`; without one the action has no icon, as+/// variablesView.ts's `class: v.iconClass || 'debug-viz-icon'` ignores a Uri `iconPath` and no CSS styles `debug-viz-icon`.fn visualizer_icon(visualizer: &Value) -> Option<String> {let class = visualizer["iconClass"].as_str()?;class.split(' ').find_map(|part| part.strip_prefix("codicon-")).map(str::to_owned)@@ -528,6 +529,7 @@ mod tests {let applicable = workbench.read_with(cx, |workbench, _| workbench.debug.visualizers.applicable.clone());assert_eq!(applicable, HashMap::from([(("s".to_owned(), 4, "x".to_owned()), vec![tree_visualizer()])]));assert_eq!(visualizer_icon(&tree_visualizer()).as_deref(), Some("graph"));+ assert_eq!(visualizer_icon(&json!({ "iconPath": { "dark": { "path": "/x/icon.svg" } } })), None, "variablesView.ts draws no `iconPath`");}/// variablesView.ts `useVisualizer` on a tree: the row shows the tree's item, its children come fromdiff --git a/native/crates/app/src/workbench/editor_groups.rs b/native/crates/app/src/workbench/editor_groups.rsindex 09f15851dd6..a4295634620 100644--- a/native/crates/app/src/workbench/editor_groups.rs+++ b/native/crates/app/src/workbench/editor_groups.rs@@ -927,22 +927,25 @@ impl Workbench {}let workbench = cx.entity();let guard = canvas(- |_, _, _| (),- move |bounds, _, window, _| {+ // A hitbox, not the bounds: the modal part's overlay over the group takes the mouse and the wheel.+ |bounds, window, _| window.insert_hitbox(bounds, gpui::HitboxBehavior::Normal),+ move |_, hitbox, window, _| {let pressed = workbench.clone();- window.on_mouse_event(move |event: &MouseDownEvent, phase, window, cx| {- if phase == DispatchPhase::Capture && bounds.contains(&event.position) {+ let pressed_hitbox = hitbox.clone();+ window.on_mouse_event(move |_: &MouseDownEvent, phase, window, cx| {+ if phase == DispatchPhase::Capture && pressed_hitbox.is_hovered(window) {pressed.update(cx, |workbench, cx| workbench.focus_group(group, window, cx));}});- window.on_mouse_event(move |event: &MouseMoveEvent, phase, _, cx| {- if phase == DispatchPhase::Capture && event.pressed_button.is_none() && bounds.contains(&event.position) {+ let moved_hitbox = hitbox.clone();+ window.on_mouse_event(move |event: &MouseMoveEvent, phase, window, cx| {+ if phase == DispatchPhase::Capture && event.pressed_button.is_none() && moved_hitbox.is_hovered(window) {cx.stop_propagation();}});let scrolled = workbench.clone();window.on_mouse_event(move |event: &ScrollWheelEvent, phase, window, cx| {- if phase == DispatchPhase::Capture && bounds.contains(&event.position) {+ if phase == DispatchPhase::Capture && hitbox.should_handle_scroll(window) {cx.stop_propagation();scrolled.update(cx, |workbench, cx| workbench.with_group(group, |workbench| workbench.editor_wheel(event, window, cx)));}diff --git a/native/crates/app/src/workbench/editor_menus.rs b/native/crates/app/src/workbench/editor_menus.rsindex e6f12904796..10b549c78e7 100644--- a/native/crates/app/src/workbench/editor_menus.rs+++ b/native/crates/app/src/workbench/editor_menus.rs@@ -187,12 +187,15 @@ impl Workbench {let mut context = self.key_context(window);context.insert("editorLineNumber".into(), json!(line + 1));let arg = json!({ "lineNumber": line + 1, "uri": document_uri(editor) });- let mut actions = self.test_gutter_actions(line as u32 + 1, window);- let menu = crate::menus::menu_actions(&self.menus, MenuId::EditorLineNumberContext, &context);- if !actions.is_empty() && !menu.is_empty() {- actions.push(MenuAction::Separator);+ // editorLineNumberMenu.ts `doShow`: the generators' groups sorted by name (`1_testing`, `2_debug`), then the menu.+ let groups = [self.test_gutter_actions(line as u32 + 1, window), self.debug_gutter_actions(line as u32 + 1), crate::menus::menu_actions(&self.menus, MenuId::EditorLineNumberContext, &context)];+ let mut actions = Vec::new();+ for group in groups.into_iter().filter(|group| !group.is_empty()) {+ if !actions.is_empty() {+ actions.push(MenuAction::Separator);+ }+ actions.extend(group);}- actions.extend(menu);self.show_context_menu_actions(actions, &context, point_anchor(pointer), vec![arg], window, cx);}diff --git a/native/crates/app/src/workbench/editor_message.rs b/native/crates/app/src/workbench/editor_message.rsindex e1ebe908379..92e250e3663 100644--- a/native/crates/app/src/workbench/editor_message.rs+++ b/native/crates/app/src/workbench/editor_message.rs@@ -155,7 +155,7 @@ impl Workbench {let run = TextRun { len: text.len(), font: gpui::font(UI_FONT), color: gpui::black(), background_color: None, underline: None, strikethrough: None };let text_width = f32::from(window.text_system().shape_line(text.into(), px(13.), &[run], None).width);let width = text_width + 2. * 4. + 2.;- let layout = layout_in_page(anchor_left - editor.scroll.left + content_left, anchor_top, self.editors.viewport.line_height, width, self.text_area_bounds.get(), window.viewport_size().map(f32::from));+ let layout = layout_in_page(anchor_left - editor.scroll.left + content_left, anchor_top, self.editors.viewport.line_height, Size { width, height: MESSAGE_HEIGHT + ANCHOR_HEIGHT }, self.text_area_bounds.get(), window.viewport_size().map(f32::from));let widget = self.message_box(message, layout.below, cx);// messageController.ts: `marginLeft = -6px` puts the anchor arrow's tip 4px right of the cursor.let widget = div().absolute().left(px(layout.left - 6.)).top(px(layout.top)).child(widget);@@ -242,8 +242,8 @@ pub(super) struct MessageLayout {/// then BELOW: the widget shifts to stay 15px inside the window and within its own width of the editor, and goes/// below the line when its top would be less than 22px from the window's top. `left` is from the editor's left,/// `anchor_top` the line's top in the editor and `line_height` its height, `editor` the editor's window bounds.-pub(super) fn layout_in_page(left: f32, anchor_top: f32, line_height: f32, width: f32, editor: Bounds<f32>, window: Size<f32>) -> MessageLayout {- let height = MESSAGE_HEIGHT + ANCHOR_HEIGHT;+pub(super) fn layout_in_page(left: f32, anchor_top: f32, line_height: f32, size: Size<f32>, editor: Bounds<f32>, window: Size<f32>) -> MessageLayout {+ let Size { width, height } = size;let left = horizontal_in_page(left, width, editor, window);let above_top = anchor_top - height;let fits_above = editor.origin.y + above_top >= 22.;diff --git a/native/crates/app/src/workbench/editor_type_picker.rs b/native/crates/app/src/workbench/editor_type_picker.rsindex f0f0c4dbc93..4dac6716895 100644--- a/native/crates/app/src/workbench/editor_type_picker.rs+++ b/native/crates/app/src/workbench/editor_type_picker.rs@@ -189,7 +189,8 @@ impl Workbench {}fn editor_type_control_key(&self) -> String {- let active = self.editors.active().map(|editor| (editor.model_id, self.active_editor_type().map(|(_, current)| current), self.editors.active_diff().is_some()));+ // The group's active editor (its tab), not the model it edits: a merge editor over a file opened before is a new editor.+ let active = self.editors.active_tab().map(|editor| (editor.model_id, self.active_editor_type().map(|(_, current)| current), self.editors.active_diff().is_some()));format!("{active:?} {} {}", self.setting("breadcrumbs.showEditorType"), self.setting("workbench.editor.hiddenEditorTypes"))}diff --git a/native/crates/app/src/workbench/editor_view.rs b/native/crates/app/src/workbench/editor_view.rsindex 153819fe35d..37d70a73756 100644--- a/native/crates/app/src/workbench/editor_view.rs+++ b/native/crates/app/src/workbench/editor_view.rs@@ -410,17 +410,26 @@ impl Workbench {actions.extend(self.terminal_editor_title_action(bar, cx).map(|action| (0., action)));let resource = self.editors.pane_editor().map(|editor| editor.document().uri()).into_iter().collect::<Vec<_>>();let foreground = self.color("icon.foreground");- // preferences.contribution.ts `_workbench.openUserSettingsEditor` (order 1) on a user settings.json outside a+ // preferences.contribution.ts Open Settings (UI) (order 1) on a user, workspace or folder settings file outside a// diff editor, and editor.contribution.ts Toggle Layout of a side by side editor, left of Split Editor.- let settings_file = self.editors.active_diff().is_none() && self.editors.pane_editor().is_some_and(|editor| self.is_user_settings_file(&editor.document().path));- let side_by_side = self.editors.side_group().is_some();- for (order, icon, title, command, shown) in [(1., "go-to-file", "Open Settings (UI)", "workbench.action.openSettings2", settings_file), (f64::MAX, "editor-layout", "Toggle Layout", "workbench.action.toggleSplitEditorInGroupLayout", side_by_side)] {- if shown {- let button = self.icon(icon, 22., 16., foreground).id(title).cursor_pointer().on_click(cx.listener(move |workbench, _, window, cx| drop(workbench.execute_command(command, Vec::new(), window, cx))));+ let settings_ui = self.editors.pane_editor().filter(|_| self.editors.active_diff().is_none()).and_then(|editor| {+ let document = editor.document();+ match self.is_user_settings_file(&document.path) {+ true => Some(("workbench.action.openSettings2", Vec::new())),+ false => self.open_workspace_settings_ui_action(&document.scheme, &document.path),+ }+ });+ let toggle_layout = self.editors.side_group().is_some().then(|| ("workbench.action.toggleSplitEditorInGroupLayout", Vec::new()));+ for (order, icon, title, action) in [(1., "go-to-file", "Open Settings (UI)", settings_ui), (f64::MAX, "editor-layout", "Toggle Layout", toggle_layout)] {+ if let Some((command, args)) = action {+ let button = self.icon(icon, 22., 16., foreground).id(title).debug_selector(move || command.into()).cursor_pointer().on_click(cx.listener(move |workbench, _, window, cx| drop(workbench.execute_command(command, args.clone(), window, cx))));actions.push((order, self.title_action(bar, &actions.len().to_string(), button, cx)));}}- for item in self.menus.iter().filter(|item| item.menu == crate::menus::MenuId::EditorTitle && item.group == "navigation" && item.when.as_ref().is_none_or(|when| when.evaluate(&context))) {+ let mut navigation: Vec<_> = self.menus.iter().filter(|item| item.menu == crate::menus::MenuId::EditorTitle && item.group == "navigation" && item.when.as_ref().is_none_or(|when| when.evaluate(&context))).collect();+ // `MenuInfo.compareMenuItems`: equal orders sort by title (the stable sort by order below keeps it).+ navigation.sort_by(|a, b| crate::command_palette::locale_compare(&a.title, &b.title));+ for item in navigation {match &item.entry {crate::menus::Entry::Command { id, .. } => {let button = self.command_button(id, item.title.clone(), resource.clone(), foreground, cx);@@ -581,8 +590,13 @@ impl Workbench {let foreground = if active && readonly { self.foreground_or("tab.activeForeground") } else { action_foreground };// textFileService.ts decorations: a deleted file's label is struck through in `list.errorForeground`.let orphaned = editor.document().scheme == "file" && self.text_files.orphaned.contains(&editor.document().path);- // multiEditorTabsControl.ts: the label takes the file's decorations per `workbench.editor.decorations`.- let decoration = (editor.document().scheme == "file").then(|| self.file_decoration(&editor.document().path, false)).flatten();+ // multiEditorTabsControl.ts: the label takes the decorations of the input's resource per `workbench.editor.decorations`;+ // a merge editor's resource is its result.+ let (scheme, path) = match self.editors.merges.get(&editor.model_id) {+ Some(merge) => (&merge.result.scheme, &merge.result.path),+ None => (&editor.document().scheme, &editor.document().path),+ };+ let decoration = (scheme == "file").then(|| self.file_decoration(path, false)).flatten();let decoration_color = self.decoration_color(decoration.as_ref(), self.setting("workbench.editor.decorations.colors") != json!(false));// multiEditorTabsControl.ts: no badges in compact sticky tabs, for lack of room.let badge = self.decoration_badge(decoration.as_ref(), foreground).filter(|_| !compact && self.setting("workbench.editor.decorations.badges") != json!(false));@@ -1369,6 +1383,7 @@ impl Workbench {.children(self.editor_message_widget(editor, metrics.content_left(), metrics.char_width, window, cx)).children(self.standalone_color_picker_widget(editor, metrics.content_left(), metrics.char_width, cx)).children(self.ghost_text_lines(editor, metrics.content_left()))+ .children(self.inline_completions_hints_widget(editor, metrics.content_left(), metrics.char_width, window, cx)).children(self.inspect_tokens_widget(editor, metrics.content_left(), metrics.char_width, window))}),)@@ -2240,7 +2255,9 @@ impl Workbench {return;}workbench.editor_message_mouse_moved(index, cx);- workbench.content_hover.row_target = Some((index, visible_at(workbench, event.position.x)));+ let hover_x = layout_x_at(workbench, event.position.x);+ let hovered = workbench.editors.active().map_or(hover_x, |editor| editor.line_layout(index).model_x(hover_x));+ workbench.content_hover.row_target = Some((index, hovered));workbench.definition_link_mouse_moved(index, visible_at(workbench, event.position.x), event.modifiers, event.pressed_button.is_some(), cx);match event.pressed_button {Some(MouseButton::Left) if workbench.text_drag.is_some() => workbench.drag_text(index, visible_at(workbench, event.position.x), event.modifiers.alt, cx),@@ -2865,8 +2882,8 @@ impl Workbench {} else if let Some(editor) = self.active_text_editor_control().filter(|editor| !self.shows_webview(editor) && !self.playground_active() && !matches!(editor.document().scheme.as_str(), super::extension_editor::EXTENSION_EDITOR_SCHEME | super::welcome_page::WALKTHROUGH_SCHEME | super::disassembly_view::DISASSEMBLY_SCHEME | MULTI_DIFF_EDITOR_SCHEME | TERMINAL_EDITOR_SCHEME)) {// WalkThroughPart has no `getControl`: its focused snippet gives the status bar no editor entries.let [selection, indentation, encoding, eol, language] = Self::editor_status_entries(editor, &self.languages);- // `toEditorWithEncodingSupport` of a MultiDiffEditorInput is null: no encoding entry.- let encoding = self.editors.active_multi_diff().is_none().then_some(encoding);+ // `toEditorWithEncodingSupport` of a MultiDiffEditorInput or a MergeEditorInput is null: no encoding entry.+ let encoding = (self.editors.active_multi_diff().is_none() && self.editors.active_merge().is_none()).then_some(encoding);items.extend([selection, indentation].into_iter().chain(encoding).chain([eol, language]));}items.extend(self.media_preview_status_entries());@@ -3598,4 +3615,26 @@ mod tests {assert!(cx.debug_bounds("split-button-primary-port.debug").is_some(), "the command run from the dropdown is the primary");std::fs::remove_dir_all(dir).unwrap();}++ /// menuService.ts `compareMenuItems`: git's Open Changes and merge-conflict's Next Conflict share `navigation@2` and sort by title.+ #[gpui::test]+ fn editor_title_actions_of_one_order_sort_by_title(cx: &mut TestAppContext) {+ use crate::menus::{Entry, MenuId, MenuItem};+ let (dir, workbench, cx) = workbench_in("editor-title-order", "{}", cx);+ cx.simulate_resize(gpui::size(gpui::px(1024.), gpui::px(768.)));+ let file = dir.join("a.txt");+ std::fs::write(&file, "one\n").unwrap();+ workbench.update_in(cx, |workbench, window, cx| {+ for (id, title, icon) in [("port.openChange", "Open Changes", "compare-changes"), ("port.next", "Next Conflict", "arrow-down")] {+ let entry = Entry::Command { id: id.into(), precondition: None, toggled: None, alt: None };+ workbench.menus.push(MenuItem { menu: MenuId::EditorTitle, entry, title: title.into(), group: "navigation".into(), order: 2., when: None });+ workbench.command_icons.insert(id.into(), crate::menus::CommandIcon::Codicon(icon.into()));+ }+ workbench.open_file(file.clone(), true, window, cx);+ });+ cx.run_until_parked();+ let x = |cx: &mut VisualTestContext, selector: &'static str| cx.debug_bounds(selector).unwrap_or_else(|| panic!("{selector} draws")).left();+ assert!(x(cx, "codicon-arrow-down") < x(cx, "codicon-compare-changes"), "Next Conflict before Open Changes");+ std::fs::remove_dir_all(dir).unwrap();+ }}diff --git a/native/crates/app/src/workbench/editor_view/merge_editor_view.rs b/native/crates/app/src/workbench/editor_view/merge_editor_view.rsindex 0f99bd14f67..4a983275d06 100644--- a/native/crates/app/src/workbench/editor_view/merge_editor_view.rs+++ b/native/crates/app/src/workbench/editor_view/merge_editor_view.rs@@ -21,8 +21,8 @@ use crate::quick_input::{Entry, Item, Kind, QuickInput};use crate::workbench::host_requests::uri_parts;use crate::workbench::hover::{HoverContent, HoverOptions};-/// mergeEditor.css `.code-view > .title` height.-const TITLE_HEIGHT: f32 = 24.;+/// mergeEditor.css `.code-view > .header` height.+const TITLE_HEIGHT: f32 = 30.;/// mergeEditor.css `.code-view > .container > .gutter`.const GUTTER_WIDTH: f32 = 24.;/// mergeEditor.css `.merge-accept-gutter-marker`: 28px wide with a 4px left margin.@@ -408,6 +408,9 @@ impl Workbench {let merge = self.editors.active_merge_mut().expect("synced above");if std::mem::take(&mut merge.reset_pending) {self.reset_merge_result(cx);+ // The reference resets the result model before its code editor attaches: the cursor stays at Ln 1, Col 1.+ let result = self.editors.active_merge().expect("synced above").result.clone();+ self.editors.model_mut(&result.scheme, &result.path).expect("synced above").set_selections(vec![crate::editor::Selection::caret(Position::new(0, 0))]);}let zones = self.merge_view_zones();let height = |zone: &Zone| self.merge_zone_height(zone.kind);@@ -842,10 +845,12 @@ impl Workbench {.collect()}- /// `.code-view > .title`: the label, its description and detail, with their `$(icon)`s as codicons.+ /// codeEditorView.ts `.header` and mergeEditor.css: the 13px title, then the 12px description and detail with+ /// their `$(icon)`s as codicons; an input's detail follows a half-transparent "•".fn merge_title(&self, title: &str, description: Option<&str>, detail: Option<&str>) -> Div {let (foreground, dim) = (self.color("foreground"), self.color("descriptionForeground"));- let label = |text: &str, color: Rgba| self.highlighted_label(text, &[], color, 14., color).text_color(color);+ let label = |text: &str, color: Rgba, icon_size: f32| self.highlighted_label(text, &[], color, icon_size, color).text_color(color);+ let detail = detail.map(|detail| div().flex().items_center().text_size(px(12.)).text_color(dim).child(div().opacity(0.5).pr(px(3.)).child("\u{2022}")).child(label(detail, dim, 13.)));div().h(px(TITLE_HEIGHT)).flex_none()@@ -856,9 +861,9 @@ impl Workbench {.overflow_hidden().whitespace_nowrap().text_size(px(13.))- .child(label(title, foreground).flex_none())- .children(description.map(|description| label(description, dim).flex_none()))- .children(detail.map(|detail| label(detail, dim)))+ .child(label(title, foreground, 14.).flex_none())+ .children(description.map(|description| label(description, dim, 14.).flex_none().text_size(px(12.))))+ .children(detail)}/// resultCodeEditorView.ts title: "Result", the result's path, the remaining conflicts counter and Reset. Complete@@ -868,25 +873,29 @@ impl Workbench {let counter = if count == 1 { "1 Conflict Remaining".to_string() } else { format!("{count} Conflicts Remaining") };let path = self.merge_result_path(result);// mergeEditor.css `.code-view.result > .header > .description`: the path alone shrinks, cut with an ellipsis.- let path = div().debug_selector(|| "merge-result-path".into()).min_w_0().overflow_hidden().text_ellipsis().text_color(self.color("descriptionForeground")).child(path);+ let path = div().debug_selector(|| "merge-result-path".into()).min_w_0().overflow_hidden().text_ellipsis().text_size(px(12.)).text_color(self.color("descriptionForeground")).child(path);self.merge_title("Result", None, None).child(path).child(+ // The counter is an ActionBar's `.action-label`: 11px with 3px of padding (actionbar.css).div().id("merge-counter").debug_selector(|| "merge-counter".into()).flex_none().ml_auto()+ .px(px(3.))+ .text_size(px(11.)).text_color(self.color("descriptionForeground")).when(count > 0, |counter| counter.cursor_pointer().on_click(cx.listener(|workbench, _, _, cx| workbench.go_to_unhandled_conflict(true, cx)))).child(counter),)- .children(self.merge_result_toolbar(window, cx))+ // mergeEditor.css `.header > span`: the toolbar's 6px right padding; its buttons touch.+ .child(div().flex().flex_none().pr(px(6.)).children(self.merge_result_toolbar(merge, window, cx)))}/// codeEditorView.ts `TitleMenu` of `MergeInputResultToolbar` (`mergeEditor/result/title`): the `primary` group/// as icon buttons, Reset sorted among them, the other groups behind "More Actions...".- fn merge_result_toolbar(&self, window: &Window, cx: &mut Context<Self>) -> Vec<gpui::Stateful<Div>> {+ fn merge_result_toolbar(&self, merge: &MergeInput, window: &Window, cx: &mut Context<Self>) -> Vec<gpui::Stateful<Div>> {let menu = crate::menus::MenuId::MergeInputResultToolbar;let context = self.key_context(window);let foreground = self.color("icon.foreground");@@ -904,18 +913,25 @@ impl Workbench {if !secondary.is_empty() {let bounds = std::rc::Rc::new(std::cell::Cell::new(gpui::Bounds::default()));let measured = bounds.clone();+ // style.css `.action-item.active`: the button of the open menu.+ let open = self.context_menu.is_some() && merge.more_menu == Some(self.context_menus_shown);let more = self.icon("toolbar-more", 22., 16., foreground).id("merge-result-more").debug_selector(|| "merge-result-more".into()).flex_none().rounded(px(4.))+ .when(open, |button| button.bg(self.color("toolbar.activeBackground"))).cursor_pointer().hover(|button| button.bg(self.color("toolbar.hoverBackground"))).child(self.hover_target("merge-result-more-hover", HoverContent::Text("More Actions...".into()), HoverOptions::mouse())).on_mouse_down(MouseButton::Left, cx.listener(move |workbench, _: &gpui::MouseDownEvent, window, cx| {cx.stop_propagation();workbench.show_dropdown_menu_actions(secondary.clone(), &context, bounds.get(), Vec::new(), window, cx);+ let shown = workbench.context_menus_shown;+ if let Some(merge) = workbench.editors.active_merge_mut() {+ merge.more_menu = Some(shown);+ }})).child(gpui::canvas(move |element_bounds, _, _| measured.set(element_bounds), |_, _, _, _| {}).absolute().size_full());buttons.push(more);@@ -951,7 +967,7 @@ impl Workbench {Input::Two => ("merge.acceptAllInput2", "mergeEditor.compareInput2WithBase", "Accept All Current Changes from Right", "merge-input2-action"),};// `MergeInput1Toolbar` and `MergeInput2Toolbar`: Accept All and Compare With Base.- let toolbar = div().ml_auto().flex().child(self.merge_toolbar_button(accept_all, "check-all", accept_title, cx)).child(self.merge_toolbar_button(compare, "git-compare", "Compare With Base", cx));+ let toolbar = div().ml_auto().pr(px(6.)).flex().child(self.merge_toolbar_button(accept_all, "check-all", accept_title, cx)).child(self.merge_toolbar_button(compare, "git-compare", "Compare With Base", cx));let pane = div().flex().flex_col().child(self.merge_title(&input_title(merge, input), data.description.as_deref(), data.detail.as_deref()).child(toolbar));let (Some(editor), Some(model)) = (merge.input_editors[input as usize].as_ref(), merge.model.as_ref()) else { return pane };let show_non_conflicting = self.merge_show_non_conflicting();diff --git a/native/crates/app/src/workbench/editor_view/merge_editor_view/tests.rs b/native/crates/app/src/workbench/editor_view/merge_editor_view/tests.rsindex e3a666ca439..1c446329c4c 100644--- a/native/crates/app/src/workbench/editor_view/merge_editor_view/tests.rs+++ b/native/crates/app/src/workbench/editor_view/merge_editor_view/tests.rs@@ -55,12 +55,16 @@ fn open_merge_editor_resets_the_conflict_and_accepts_incoming(cx: &mut TestAppCo});run(&workbench, cx, "_open.mergeEditor", vec![args]);- let (name, result, unhandled) = workbench.read_with(cx, |workbench, _| {+ let (name, result, unhandled, cursor) = workbench.read_with(cx, |workbench, _| {let name = workbench.editor_name(&workbench.editors.editors[0]);- let result = workbench.editors.active().unwrap().document().lines.join("\n");- (name, result, workbench.editors.active_merge().unwrap().model.as_ref().unwrap().unhandled_count())+ let result = workbench.merge_result().unwrap();+ let unhandled = workbench.editors.active_merge().unwrap().model.as_ref().unwrap().unhandled_count();+ (name, result.document().lines.join("\n"), unhandled, result.selection().head)});assert_eq!(name, "Merging: result.txt");+ assert_eq!(cursor, Position::new(0, 0), "the reset leaves the result's cursor at Ln 1, Col 1");+ assert!(cx.debug_bounds("editor-status-workbench.action.editor.changeEOL").is_some(), "the result's status entries show");+ assert!(cx.debug_bounds("editor-status-workbench.action.editor.changeEncoding").is_none(), "`toEditorWithEncodingSupport` of a merge editor is null");// mergeEditorInputModel.ts: conflict markers reset the result to base with the conflict unhandled.assert_eq!(result, "one\ntwo\nthree");assert_eq!(unhandled, 1);@@ -105,6 +109,9 @@ fn open_merge_editor_resets_the_conflict_and_accepts_incoming(cx: &mut TestAppCocx.simulate_click(more, gpui::Modifiers::none());let titles = workbench.read_with(cx, |workbench, _| workbench.context_menu.as_ref().expect("More Actions opens its menu").levels[0].actions.iter().map(|action| format!("{action:?}")).collect::<Vec<_>>().join(" "));assert!(titles.contains("test.secondary"), "{titles}");+ // style.css `.action-item.active`: "..." draws `toolbar.activeBackground` while its menu is open.+ let open = workbench.read_with(cx, |workbench, _| workbench.editors.active_merge().unwrap().more_menu == Some(workbench.context_menus_shown));+ assert!(open, "the merge result's More Actions is active while its menu shows");workbench.update_in(cx, |workbench, window, cx| workbench.hide_context_menu(window, cx));cx.run_until_parked();let action = cx.debug_bounds("merge-result-action-test.result").expect("the result title shows the contributed command").center();diff --git a/native/crates/app/src/workbench/editor_view/multi_diff_editor_view/tests.rs b/native/crates/app/src/workbench/editor_view/multi_diff_editor_view/tests.rsindex e5d91f67924..5b7f18c021e 100644--- a/native/crates/app/src/workbench/editor_view/multi_diff_editor_view/tests.rs+++ b/native/crates/app/src/workbench/editor_view/multi_diff_editor_view/tests.rs@@ -382,6 +382,15 @@ fn the_content_menu_floats_over_the_diffs(cx: &mut TestAppContext) {let window = cx.update(|window, _| window.viewport_size());assert_eq!(f32::from(menu.size.height), 28.);assert!(f32::from(window.width - menu.right()) >= 28., "28px from the diffs' right edge");+ let bottom = menu.bottom();+ workbench.update(cx, |workbench, _| {+ let entry = crate::menus::Entry::Command { id: "port.undo".into(), precondition: None, toggled: None, alt: None };+ workbench.menus.push(crate::menus::MenuItem { menu: crate::menus::MenuId::MultiDiffEditorContent, entry, title: "Undo".into(), group: "navigation".into(), order: 1., when: None });+ });+ draw(cx);+ let menu = cx.debug_bounds("multi-diff-floating-menu").unwrap();+ // The reference's toolbar of two actions: 30px high, as far from the bottom as the single button.+ assert_eq!((f32::from(menu.size.height), menu.bottom()), (30., bottom));std::fs::remove_dir_all(dir).unwrap();}diff --git a/native/crates/app/src/workbench/explorer_find.rs b/native/crates/app/src/workbench/explorer_find.rsindex 8c7432e522f..4d3e61497fe 100644--- a/native/crates/app/src/workbench/explorer_find.rs+++ b/native/crates/app/src/workbench/explorer_find.rs@@ -27,7 +27,7 @@ const FIND_DELAY: Duration = Duration::from_millis(250);/// `searchInWorkspace`: the file search's `maxResults`.const MAX_FILE_RESULTS: usize = 512;/// The input's width in the reference: `.monaco-tree-type-filter-input` is the widget's flex 1.-const INPUT_WIDTH: f32 = 155.5;+pub(super) const INPUT_WIDTH: f32 = 155.5;pub struct ExplorerFind {pub focus: FocusHandle,@@ -57,6 +57,7 @@ pub(super) struct TreeFindLook {pub message: Option<String>,pub filter_mode: bool,pub fuzzy: bool,+ pub input_width: f32,}struct FindResult {@@ -378,13 +379,13 @@ impl Workbench {pub(super) fn explorer_find_widget(&self, window: &Window, cx: &mut Context<Self>) -> Option<Div> {let find = &self.explorer.find;- let look = TreeFindLook { input: InputId::ExplorerFind, message: find.message.clone(), filter_mode: self.explorer_find_filter_mode(), fuzzy: self.explorer_find_fuzzy() };+ let look = TreeFindLook { input: InputId::ExplorerFind, message: find.message.clone(), filter_mode: self.explorer_find_filter_mode(), fuzzy: self.explorer_find_fuzzy(), input_width: INPUT_WIDTH };find.open.then(|| self.tree_find_widget(look, |workbench, window, cx| workbench.close_explorer_find(window, cx), window, cx))}/// tree.css `.monaco-tree-type-filter`: the input with its toggles and the close action, at the tree's top right.pub(super) fn tree_find_widget(&self, look: TreeFindLook, close: fn(&mut Workbench, &mut Window, &mut Context<Workbench>), window: &Window, cx: &mut Context<Self>) -> Div {- let TreeFindLook { input: input_id, message, filter_mode, fuzzy } = look;+ let TreeFindLook { input: input_id, message, filter_mode, fuzzy, input_width } = look;let focused = self.input_focus(input_id).is_focused(window);let border = match (&message, focused) {(Some(_), _) => self.color("inputValidation.warningBorder"),@@ -402,7 +403,7 @@ impl Workbench {// Over the input's bottom border, half a point left of its outer edge as in the reference capture..top(px(21.)).left(px(-1.5))- .w(px(INPUT_WIDTH + 1.))+ .w(px(input_width + 1.)).p(px(4.8)).text_size(px(12.)).line_height(px(17.))@@ -417,7 +418,7 @@ impl Workbench {.debug_selector(|| "tree-find-input".into()).relative().flex_none()- .w(px(INPUT_WIDTH))+ .w(px(input_width)).h(px(23.)).flex().bg(self.color("input.background"))diff --git a/native/crates/app/src/workbench/floating_menu.rs b/native/crates/app/src/workbench/floating_menu.rsindex eff1887b00a..5e9bd8eaf76 100644--- a/native/crates/app/src/workbench/floating_menu.rs+++ b/native/crates/app/src/workbench/floating_menu.rs@@ -39,8 +39,10 @@ impl Workbench {/// style.css `.multi-diff-root-floating-menu`: 28px from the right (`spacing-size280`), 24px from the bottom.pub(super) fn multi_diff_floating_menu(&self, context: &HashMap<String, serde_json::Value>, resource: serde_json::Value, window: &Window, cx: &mut Context<Self>) -> Option<AnyElement> {let actions = self.content_menu_actions(MenuId::MultiDiffEditorContent, context);+ let single = actions.len() == 1;let widget = self.floating_toolbar("multi-diff-floating-menu", actions, resource, window, cx)?;- Some(widget.right(px(28.)).bottom(px(24.)).into_any_element())+ // The reference's `.monaco-toolbar` over the diffs is 26px high, not 22px as in an editor: 30px with the padding.+ Some(widget.when(!single, |widget| widget.h(px(30.))).right(px(28.)).bottom(px(24.)).into_any_element())}/// The absolutely placed toolbar of `actions`, none without actions; the caller places it.diff --git a/native/crates/app/src/workbench/hover.rs b/native/crates/app/src/workbench/hover.rsindex ca6800e2410..a82d9e52947 100644--- a/native/crates/app/src/workbench/hover.rs+++ b/native/crates/app/src/workbench/hover.rs@@ -317,13 +317,39 @@ impl Workbench {self.show_hover(false, window, cx);return;}- let delay = Duration::from_millis(self.setting("workbench.hover.delay").as_u64().unwrap_or(1500));+ let delay = self.hover_delay();self.hovers.pending = Some(cx.spawn_in(window, async move |workbench, cx| {cx.background_executor().timer(delay).await;let _ = workbench.update_in(cx, |workbench, window, cx| workbench.show_hover(true, window, cx));}));}+ fn hover_delay(&self) -> Duration {+ Duration::from_millis(self.setting("workbench.hover.delay").as_u64().unwrap_or(1500))+ }++ /// setupManagedHover's `onFocus`: an action item the keyboard focused shows its hover after the delay while it+ /// keeps the focus. A composite bar item's `setupDelayedHover` (its `group`) shows none on focus.+ pub(super) fn hover_focused_action_item(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ let Some(focused) = window.focused(cx) else { return };+ let Some(id) = self.focused_action_bar_item(window).and_then(|bounds| self.painted_hover_within(bounds)) else { return };+ let Some((_, target)) = self.hovers.painted.borrow().get(&id).cloned() else { return };+ if target.options.group.is_some() {+ return;+ }+ self.hovers.target = Some(target);+ self.hovers.dismissed = false;+ let delay = self.hover_delay();+ self.hovers.pending = Some(cx.spawn_in(window, async move |workbench, cx| {+ cx.background_executor().timer(delay).await;+ let _ = workbench.update_in(cx, |workbench, window, cx| {+ if focused.is_focused(window) {+ workbench.show_hover(true, window, cx);+ }+ });+ }));+ }+/// The pointer left the target: a pending hover is cancelled, a shown one hides once the mouse tracker's delay passes.pub(super) fn leave_hover_target(&mut self, cx: &mut Context<Self>) {if self.hovers.target.take().is_none() {diff --git a/native/crates/app/src/workbench/hover/tests.rs b/native/crates/app/src/workbench/hover/tests.rsindex f32878fe8e6..c14d96c8ccd 100644--- a/native/crates/app/src/workbench/hover/tests.rs+++ b/native/crates/app/src/workbench/hover/tests.rs@@ -909,3 +909,48 @@ fn the_title_bar_toolbars_are_tab_stops_in_the_dom_order(cx: &mut TestAppContextlet outline = workbench.update_in(cx, |workbench, _, cx| workbench.drawn_action_bar_item_bounds("activity", "workbench.view.explorer", cx));assert_eq!(Some(outline), cx.debug_bounds("workbench.view.explorer"));}++/// hoverService.ts `setupManagedHover` `onFocus`: an action the keyboard focuses shows its hover after the delay and a+/// focus moving on hides it; an activity bar item's `setupDelayedHover` shows none on focus.+#[gpui::test]+fn a_keyboard_focused_action_shows_its_hover(cx: &mut TestAppContext) {+ let (workbench, cx) = open_workbench("hover-focused-action", cx);+ cx.update(|window, _| window.activate_window());+ cx.run_until_parked();+ let after_delay = |cx: &mut gpui::VisualTestContext| {+ cx.run_until_parked();+ let before = workbench.update(cx, |workbench, _| workbench.hovers.shown_text().map(str::to_owned));+ cx.executor().advance_clock(Duration::from_millis(1500));+ cx.run_until_parked();+ (before, workbench.update(cx, |workbench, _| workbench.hovers.shown_text().map(str::to_owned)))+ };++ workbench.update_in(cx, |workbench, window, cx| assert!(workbench.focus_action_bar("activity", window, cx)));+ assert_eq!(after_delay(cx), (None, None));+ cx.simulate_keystrokes("shift-tab");+ assert_eq!(after_delay(cx), (None, Some("Customize Layout...".to_string())));+ cx.simulate_keystrokes("right");+ let (before, after) = after_delay(cx);+ assert_eq!(before, None);+ assert!(after.is_some_and(|text| text.starts_with("Toggle Primary Side Bar")));+}++#[gpui::test]+fn a_focused_activity_item_draws_the_reference_focus_indicator(cx: &mut TestAppContext) {+ let (workbench, cx) = open_workbench("activity-focus-indicator", cx);+ cx.update(|window, _| window.activate_window());+ workbench.update_in(cx, |workbench, window, cx| assert!(workbench.focus_action_bar("activity", window, cx)));+ cx.run_until_parked();+ let (scale, border, indicator) = workbench.update_in(cx, |workbench, window, _| (window.scale_factor(), workbench.theme.color("focusBorder").unwrap(), workbench.theme.color("activityBar.activeBorder").unwrap()));+ let outline_radii = |cx: &mut gpui::VisualTestContext| cx.read_rendered_frame(|scene, _| scene.quads.iter().filter(|quad| quad.border_color == border.into() && quad.border_widths.top.0 > 0. && quad.bounds.size.width.0 <= 38. * scale).map(|quad| quad.corner_radii.top_left.0 / scale).collect::<Vec<_>>());+ let left_bars = |cx: &mut gpui::VisualTestContext| cx.read_rendered_frame(|scene, _| scene.quads.iter().filter(|quad| quad.background == indicator.into() && quad.bounds.size.width.0 == 2. * scale).count());++ assert_eq!((outline_radii(cx), left_bars(cx)), (vec![], 1), "the unchecked Explorer item: the left indicator");+ workbench.update_in(cx, |workbench, window, cx| {+ drop(workbench.execute_command("workbench.view.explorer", Vec::new(), window, cx));+ assert!(workbench.focus_action_bar("activity", window, cx));+ });+ cx.run_until_parked();+ let radii = outline_radii(cx);+ assert_eq!((!radii.is_empty() && radii.iter().all(|radius| *radius == 4.), left_bars(cx)), (true, 0), "the checked Explorer item: a rounded outline {radii:?}");+}diff --git a/native/crates/app/src/workbench/inlay_hints.rs b/native/crates/app/src/workbench/inlay_hints.rsindex 1936fe8d2f6..587b508f302 100644--- a/native/crates/app/src/workbench/inlay_hints.rs+++ b/native/crates/app/src/workbench/inlay_hints.rs@@ -195,8 +195,8 @@ impl Workbench {fn schedule_inlay_hints(&mut self, delay: Duration, cx: &mut Context<Self>) {let Some(editor) = self.editors.active().filter(|editor| Some(editor.model_id) == self.inlay_hints.model_id) else { return };let handles = self.inlay_hint_handles(editor);- // `_update` returns without a provider (inlayHintsController.ts:189), so no scroll asks.- if handles.is_empty() {+ // `_update` returns while off or without a provider (inlayHintsController.ts:180, :184), before its scroll listener.+ if handles.is_empty() || self.suggest_setting(editor, "editor.inlayHints.enabled") == "off" {return;}let debounce_key = format!("{}{handles:?}", editor.document().uri());diff --git a/native/crates/app/src/workbench/inlay_hints/tests.rs b/native/crates/app/src/workbench/inlay_hints/tests.rsindex 952714c74b3..4f839fd1190 100644--- a/native/crates/app/src/workbench/inlay_hints/tests.rs+++ b/native/crates/app/src/workbench/inlay_hints/tests.rs@@ -164,3 +164,28 @@ fn a_scroll_redraws_the_editor_only(cx: &mut TestAppContext) {assert_eq!(notified.get(), 0, "the answer draws the editor part alone");std::fs::remove_dir_all(dir).unwrap();}++/// `_update` returns while `editor.inlayHints.enabled` is `off` (inlayHintsController.ts:180), before its scroll listener.+#[gpui::test]+fn a_scroll_asks_nothing_while_hints_are_off(cx: &mut TestAppContext) {+ let app_root = std::path::Path::new(env!("VSCODE_SRC")).to_path_buf();+ let dir = std::env::temp_dir().join(format!("code-gpui-inlay-hints-off-{}", std::process::id()));+ std::fs::create_dir_all(&dir).unwrap();+ std::fs::write(dir.join("a.txt"), "let x = 1;\n").unwrap();+ let workspace = config::workspace::Workspace::folder(dir.clone());+ let settings = Arc::new(Mutex::new(Settings::load(Registry::with_extensions(&[]), dir.join("User"), Some(workspace.clone()))));+ let (sender, receiver) = std::sync::mpsc::channel::<HostMessage>();+ let (workbench, cx) = cx.add_window_view(|window, cx| {+ let mut workbench = Workbench::new(dark_modern(), app_root.clone(), Some(workspace), Languages::new(&[]), settings, HostSync::new(sender), cx);+ workbench.open_file(dir.join("a.txt"), true, window, cx);+ workbench.update_user_setting("editor.inlayHints.enabled", json!("off"));+ workbench.language_features.register(REGISTER, vec![json!(1), json!("*"), json!(null), json!(2)]);+ workbench.inlay_hints_registrations_changed(cx);+ workbench+ });+ workbench.update(cx, |workbench, cx| workbench.inlay_hints_scrolled(cx));+ cx.executor().advance_clock(Duration::from_secs(1));+ cx.run_until_parked();+ assert_eq!(receiver.try_iter().filter(|message| message.method == "$provideInlayHints").count(), 0);+ std::fs::remove_dir_all(dir).unwrap();+}diff --git a/native/crates/app/src/workbench/inline_completions.rs b/native/crates/app/src/workbench/inline_completions.rsindex b01b29696e2..3e21ef5e79c 100644--- a/native/crates/app/src/workbench/inline_completions.rs+++ b/native/crates/app/src/workbench/inline_completions.rs@@ -4,14 +4,19 @@// The AI parts (inline edits, next edit suggestions, the chat agent's completions) are removed by decision; a list// item with `isInlineEdit` is dropped.+use std::cell::Cell;use std::collections::HashMap;+use std::rc::Rc;use std::time::Duration;-use gpui::{AnyElement, ClickEvent, Context, Div, MouseButton, Stateful, Task, Window, div, prelude::*, px};+use gpui::{AnyElement, BoxShadow, ClickEvent, Context, Div, MouseButton, Size, Stateful, Task, Window, canvas, deferred, div, point, prelude::*, px, rgba};use serde_json::{Value, json};use super::Workbench;use super::content_hover::{Anchor, Part, PartContent, Participant};+use super::content_hover_view::RADIUS;+use super::editor_message::layout_in_page;+use super::peek_view::UI_FONT;use super::hover::{HoverContent, HoverOptions};use crate::menus::{ALWAYS_SHOW_INLINE_TOOLBAR, MenuAction, MenuId, menu_actions, menu_group_actions};use super::editor_view::EDITOR_FONT;@@ -67,6 +72,10 @@ pub(super) struct InlineCompletions {suggest_item: Option<SuggestItem>,/// `isShiftKeyPressed`: the suggest item previews the other of insert and replace.shift: bool,+ /// `InlineCompletionsHintsWidget.position`: the primary ghost text's first column, the leftmost one while it+ /// stays on its line.+ hints_position: Option<Position>,+ hints_size: Rc<Cell<Option<Size<f32>>>>,}#[derive(PartialEq)]@@ -170,6 +179,7 @@ impl Workbench {self.commands.register(ALWAYS_SHOW_INLINE_TOOLBAR, |workbench, _, _, cx| {let always = workbench.setting(SHOW_TOOLBAR) == "always";workbench.update_setting(SHOW_TOOLBAR, json!(if always { "onHover" } else { "always" }));+ workbench.ask_explicitly_for_the_hints(cx);cx.notify();Outcome::done()});@@ -477,6 +487,11 @@ impl Workbench {self.quick_suggest_inline_completions_changed(cx);return;}+ let first = ghosts.first().filter(|ghost| !ghost.parts.is_empty()).map(|ghost| Position::new(ghost.line, ghost.parts[0].column));+ self.inline_completions.hints_position = match (first, self.inline_completions.hints_position) {+ (Some(first), Some(session)) if session.line == first.line => Some(Position::new(first.line, first.column.min(session.column))),+ (first, _) => first,+ };self.inline_completions.ghosts = ghosts.clone();let line_height = self.editors.viewport.line_height;let Some(editor) = self.editors.active_mut() else { return };@@ -510,6 +525,16 @@ impl Workbench {}cx.notify();self.quick_suggest_inline_completions_changed(cx);+ self.ask_explicitly_for_the_hints(cx);+ }++ /// inlineCompletionsHintsWidget.ts "request explicit": the always shown toolbar's count needs every item.+ fn ask_explicitly_for_the_hints(&mut self, cx: &mut Context<Self>) {+ let Some(editor) = self.editors.active() else { return };+ let shown = self.inline_completions.hints_position.is_some() && self.suggest_setting(editor, SHOW_TOOLBAR) == "always";+ if shown && !self.inline_completions.fetched.as_ref().is_some_and(|fetched| fetched.explicit) {+ self.trigger_inline_completions_explicitly(cx);+ }}/// `canShowQuickSuggest`: a visible inline suggestion (`inlineSuggestionVisible`) lets the suggest widget open by@@ -835,21 +860,28 @@ impl Workbench {}/// hoverParticipant.ts `computeSync` with inlineCompletionsController.ts `shouldShowHoverAt`: one part while- /// `editor.inlineSuggest.showToolbar` is `onHover` and the anchor starts at a part of the primary ghost text.- // shortcut: the char after a mid-line ghost text anchors the hover too (upstream: only the injected text), upgrade- // when the mouse target tells injected text apart.+ /// `editor.inlineSuggest.showToolbar` is `onHover` and the anchor's range contains a part of the primary ghost text:+ /// the injected text, the char before it and the char after it.pub(super) fn inline_completions_hover_parts(&self, editor: &OpenEditor, anchor: Anchor) -> Vec<Part> {if self.suggest_setting(editor, SHOW_TOOLBAR) != "onHover" || self.inline_completions.model_id != Some(editor.model_id) {return Vec::new();}let Some(ghost) = self.inline_completions.ghosts.first() else { return Vec::new() };- if ghost.line != anchor.line || !ghost.parts.iter().any(|part| part.column == anchor.start) {+ if ghost.line != anchor.line || !ghost.parts.iter().any(|part| (anchor.start..=anchor.end).contains(&part.column)) {return Vec::new();}let (start, end) = (Position::new(anchor.line, anchor.start), Position::new(anchor.line, anchor.end));vec![Part { participant: Participant::InlineCompletions, ordinal: 0, start, end, content: PartContent::InlineCompletions, source: None }]}+ /// hoverParticipant.ts `suggestHoverAnchor` for `CONTENT_EMPTY`: the empty area after line `line` anchors at+ /// its end while a part of the primary ghost text is there.+ pub(super) fn inline_completions_empty_area_anchor(&self, editor: &OpenEditor, line: usize) -> Option<Anchor> {+ let end = editor.document().lines.get(line)?.chars().count();+ let ghost = self.inline_completions.ghosts.first().filter(|_| self.inline_completions.model_id == Some(editor.model_id))?;+ (ghost.line == line && ghost.parts.iter().any(|part| part.column == end)).then_some(Anchor { model_id: editor.model_id, line, start: end, end })+ }+/// inlineCompletionsHintsWidget.ts `InlineSuggestionHintsContentWidget` without its border: Previous, the/// `n/count` label and Next, then `MenuId.InlineSuggestionToolbar`'s `primary*` groups with their keybindings;/// its other groups, the list's commands and `MenuId.InlineCompletionsActions` behind "...".@@ -866,9 +898,12 @@ impl Workbench {.p(px(4.)).flex().items_center()+ // actionbar.css: the labels' 11px under the hover's 19.5px line height.+ .text_size(px(11.))+ .line_height(px(19.5)).text_color(self.color("editorHoverWidget.foreground")).child(self.inline_hint_button("editor.action.inlineSuggest.showPrevious", "Previous", "chevron-left", cycles, &context, cx))- .child(div().id("inline-suggestion-count").debug_selector(|| "inline-suggestion-count".into()).min_w(px(19.)).flex().justify_center().children(count.map(|count| format!("{}/{count}", selected + 1))))+ .child(div().id("inline-suggestion-count").debug_selector(|| "inline-suggestion-count".into()).min_w(px(19. + 2. * 3.)).p(px(3.)).flex().justify_center().children(count.map(|count| format!("{}/{count}", selected + 1)))).child(self.inline_hint_button("editor.action.inlineSuggest.showNext", "Next", "chevron-right", cycles, &context, cx));for action in menu_group_actions(&self.menus, MenuId::InlineSuggestionToolbar, &context, |group| group.starts_with("primary")) {let MenuAction::Command { id, title, enabled, .. } = action else { continue };@@ -907,12 +942,63 @@ impl Workbench {let args = command["command"]["arguments"].as_array().cloned().unwrap_or_default();workbench.commands.register(format!("{LIST_COMMAND}{index}"), move |workbench, _, window, cx| workbench.execute_command(&id, args.clone(), window, cx));}- workbench.show_dropdown_menu_actions(secondary.clone(), &context, bounds.get(), Vec::new(), window, cx);+ workbench.show_context_menu_actions(secondary.clone(), &context, bounds.get(), Vec::new(), window, cx);})).child(gpui::canvas(move |element_bounds, _, _| measured.set(element_bounds), |_, _, _, _| {}).absolute().size_full());toolbar.child(more)}+ /// `InlineSuggestionHintsContentWidget` with its border while `editor.inlineSuggest.showToolbar` is `always`:+ /// ABOVE the hints position, else BELOW (`allowEditorOverflow`), left of the ghost text there.+ pub(super) fn inline_completions_hints_widget(&self, editor: &OpenEditor, content_left: f32, char_width: f32, window: &Window, cx: &mut Context<Self>) -> Option<AnyElement> {+ let position = self.inline_completions.hints_position.filter(|_| self.inline_completions.model_id == Some(editor.model_id))?;+ if self.suggest_setting(editor, SHOW_TOOLBAR) != "always" || editor.folding.is_hidden(position.line) {+ return None;+ }+ let view_line = editor.position_view_line(position, false);+ let anchor_left = editor.segment_pixel_left(editor.segment(view_line), position.column, char_width);+ let anchor_top = editor.line_top(view_line, self.editors.viewport) - editor.scroll.top;+ let measured = self.inline_completions.hints_size.get();+ let size = measured.unwrap_or(Size { width: 0., height: 0. });+ let layout = layout_in_page(anchor_left - editor.scroll.left + content_left, anchor_top, self.editors.viewport.line_height, size, self.text_area_bounds.get(), window.viewport_size().map(f32::from));+ let hints_size = self.inline_completions.hints_size.clone();+ let measure = canvas(+ move |bounds, window, cx| {+ // Size inside the border: the reference box ends 2px into the line (bottom 70, line top 68), its cached height 2px short.+ let size = bounds.size.map(f32::from);+ if hints_size.get() != Some(size) {+ super::part_view::redraw_after_frame(window, cx);+ }+ hints_size.set(Some(size));+ },+ |_, _, _, _| (),+ )+ .absolute()+ .inset_0();+ let high_contrast = self.theme.kind.is_high_contrast();+ let widget = div()+ .id("inline-suggestion-hints")+ .debug_selector(|| "inline-suggestion-hints".into())+ .absolute()+ .left(px(layout.left))+ .top(px(layout.top))+ .border_1()+ .border_color(self.color("editorHoverWidget.border"))+ .rounded(px(RADIUS))+ .font_family(UI_FONT)+ .cursor_default()+ .occlude()+ .when(measured.is_none(), |widget| widget.invisible())+ .when(high_contrast, |widget| widget.bg(self.color("editorHoverWidget.background")))+ .when(!high_contrast, |widget| {+ // --vscode-shadow-lg under frostedGlass.css's `.monaco-hover`.+ widget.child(self.frosted_glass("editorHoverWidget.background", RADIUS)).shadow(vec![BoxShadow { color: rgba(0x00000024).into(), offset: point(px(0.), px(0.)), blur_radius: px(12.), spread_radius: px(0.), inset: false }])+ })+ .child(self.inline_completions_hover_toolbar(window, cx))+ .child(measure);+ Some(deferred(widget).with_priority(1).into_any_element())+ }+/// `createCommandAction`: an icon button whose tooltip appends its keybinding; actionbar.css dims it disabled.fn inline_hint_button(&self, command: &'static str, label: &str, icon: &str, enabled: bool, context: &HashMap<String, Value>, cx: &mut Context<Self>) -> Stateful<Div> {let tooltip = self.keybindings.resolver.append_keybinding(label, command, context);@@ -933,7 +1019,7 @@ impl Workbench {let keys = self.keybindings.resolver.lookup_primary_keybinding(&id, context).map(|item| item.keybinding.iter().flat_map(|chord| chord.key_caps()).collect::<Vec<_>>()).unwrap_or_default();// `unthemedKeybindingLabelOptions`: the key borders take the text's color.let border = self.color("editorHoverWidget.foreground");- let key = |key: String| div().mx(px(2.)).px(px(3.)).py(px(2.)).border_1().border_color(border).rounded(px(3.)).text_size(px(8.)).line_height(px(10.)).child(key);+ let key = |key: String| div().min_w(px(12. + 2. * 3. + 2.)).flex().justify_center().px(px(3.)).py(px(2.)).border_1().border_color(border).rounded(px(3.)).text_size(px(8.)).line_height(px(10.)).child(key);let selector = format!("inline-suggestion-{id}");let item = div().id(selector.clone())@@ -944,7 +1030,7 @@ impl Workbench {.mr(px(2.)).rounded(px(4.)).child(title)- .when(!keys.is_empty(), |item| item.child(div().flex().items_center().ml(px(4.)).opacity(0.6).children(keys.into_iter().map(key))));+ .when(!keys.is_empty(), |item| item.child(div().flex().items_center().gap(px(4.)).ml(px(4.)).p(px(3.)).opacity(0.6).children(keys.into_iter().map(key))));if !enabled {return item.opacity(0.4);}diff --git a/native/crates/app/src/workbench/inline_completions/tests.rs b/native/crates/app/src/workbench/inline_completions/tests.rsindex 2f0c49fe618..09d9f947bc4 100644--- a/native/crates/app/src/workbench/inline_completions/tests.rs+++ b/native/crates/app/src/workbench/inline_completions/tests.rs@@ -800,6 +800,26 @@ fn an_item_for_another_line_is_not_reused(cx: &mut TestAppContext) {assert_eq!(view(&workbench, cx), "hello\nhello[world]");}+/// inlineCompletionsHintsWidget.ts with `showToolbar: always`: the toolbar shows above the ghost text and asks for+/// every item explicitly.+#[gpui::test]+fn the_always_shown_toolbar_sits_above_the_ghost_text(cx: &mut TestAppContext) {+ let (workbench, cx, receiver) = open_with_provider(cx, "inline-hints-always", "x\nfoo");+ workbench.update(cx, |workbench, _| workbench.update_setting("editor.inlineSuggest.showToolbar", json!("always")));+ type_text(&workbench, cx, "b");+ let items = json!([{ "insertText": "foobar", "range": range(2, 1, 2, 5), "idx": 0 }]);+ assert_eq!(asked(&provide(&receiver, items.clone(), cx)), [(2, 5, 0)]);+ assert_eq!(asked(&answer(&receiver, json!({ "items": items }), cx)), [(2, 5, 1)], "the toolbar asks explicitly");+ for _ in 0..3 {+ cx.update(|window, _| window.refresh());+ cx.run_until_parked();+ }+ let hints = cx.debug_bounds("inline-suggestion-hints").expect("the toolbar shows");+ let line_top = workbench.read_with(cx, |workbench, _| workbench.text_area_bounds.get().origin.y + workbench.editors.viewport.line_height);+ assert_eq!(hints.bottom(), px(line_top + 2.), "the reference's box ends 2px into line 2");+ assert_eq!(hints.size.height, px(1. + 4. + 25.5 + 4. + 1.), "the labels without keybindings inside the 4px padding and the border");+}+/// hintsWidget/hoverParticipant.ts: a hover over the ghost text asks for every item and shows the toolbar of/// inlineCompletionsHintsWidget.ts: Previous, the count and Next, `MenuId.InlineSuggestionToolbar`'s primary items,/// then behind "..." its secondary items, a separator, the list's commands and `MenuId.InlineCompletionsActions`.@@ -830,15 +850,38 @@ fn the_hover_over_the_ghost_text_shows_the_inline_suggestion_toolbar(cx: &mut Teassert!(cx.debug_bounds(selector).is_some(), "{selector} is drawn");}assert!(cx.debug_bounds("inline-suggestion-editor.action.inlineSuggest.acceptNextLine").is_none(), "Accept Line is secondary");+ // The reference's DOM: the count's 19.5px line inside its label's 3px padding.+ assert_eq!(cx.debug_bounds("inline-suggestion-count").unwrap().size.height, px(25.5));let more = cx.debug_bounds("inline-suggestion-more").expect("the toolbar has a ...");cx.simulate_mouse_down(more.center(), gpui::MouseButton::Left, gpui::Modifiers::default());cx.run_until_parked();- let titles = workbench.read_with(cx, |workbench, _| {+ let (titles, left) = workbench.read_with(cx, |workbench, _| {let menu = workbench.context_menu.as_ref().expect("the ... menu shows");- menu.levels[0].actions.iter().map(|action| match action {+ let titles = menu.levels[0].actions.iter().map(|action| match action {MenuAction::Command { title, .. } => title.clone(),_ => "-".into(),- }).collect::<Vec<_>>()+ }).collect::<Vec<_>>();+ (titles, menu.levels[0].origin.x)});assert_eq!(titles, ["Accept Line", "Always Show Toolbar", "-", "Port List Command", "Port Inline Action"]);+ assert_eq!(left, more.left(), "the dropdown's default `AnchorAlignment.LEFT`");+}++#[gpui::test]+fn the_chars_around_the_ghost_text_and_the_empty_area_after_it_anchor_the_hover(cx: &mut TestAppContext) {+ use crate::workbench::content_hover::Anchor;+ let (workbench, cx, receiver) = open_with_provider(cx, "inline-hover-anchors", "foo");+ type_text(&workbench, cx, "b");+ provide_list(&receiver, json!({ "items": [{ "insertText": "foobar", "range": range(1, 1, 1, 5) }] }), cx);+ assert_eq!(view(&workbench, cx), "foob[ar]");+ workbench.read_with(cx, |workbench, _| {+ let editor = workbench.editors.active().unwrap();+ let parts_at = |start, end| workbench.inline_completions_hover_parts(editor, Anchor { model_id: editor.model_id, line: 0, start, end }).len();+ // inlineCompletionsController.ts `shouldShowHoverAt`: `Range.containsPosition` takes both ends.+ assert_eq!(parts_at(3, 4), 1, "the char before the ghost text");+ assert_eq!(parts_at(4, 4), 1, "the ghost text");+ assert_eq!(parts_at(2, 3), 0, "a char off it");+ assert_eq!(workbench.inline_completions_empty_area_anchor(editor, 0), Some(Anchor { model_id: editor.model_id, line: 0, start: 4, end: 4 }));+ assert_eq!(workbench.inline_completions_empty_area_anchor(editor, 1), None);+ });}diff --git a/native/crates/app/src/workbench/keybindings_editor_view.rs b/native/crates/app/src/workbench/keybindings_editor_view.rsindex 03d40f3d124..b22cea38935 100644--- a/native/crates/app/src/workbench/keybindings_editor_view.rs+++ b/native/crates/app/src/workbench/keybindings_editor_view.rs@@ -106,6 +106,7 @@ pub(super) struct ModalHeader {pub title: &'static str,pub json_title: &'static str,pub json_command: &'static str,+ pub json_args: Vec<Value>,/// A text editor's file icon, name and description, drawn in place of `icon` and `title`.pub resource: Option<AnyElement>,/// The arguments of the editor actions: a text editor's resource.@@ -116,6 +117,8 @@ pub struct KeybindingsEditor {pub open: bool,/// The modal editor part's maximized state, which the Settings editor in it shares.pub(super) maximized: bool,+ /// The modal header's `...` showed the open context menu.+ pub(super) more_menu_open: bool,/// The size of the editor area group that shows the Settings or Keyboard Shortcuts editor, measured last frame.pub(super) group_pane_size: std::rc::Rc<std::cell::Cell<(f32, f32)>>,model: Model,@@ -177,6 +180,7 @@ impl KeybindingsEditor {KeybindingsEditor {open: false,maximized: false,+ more_menu_open: false,group_pane_size: Default::default(),model: Model::default(),model_generation: 0,@@ -883,7 +887,7 @@ impl Workbench {/// The modal editor part: the dimmed window, the dialog with its header, and the Keyboard Shortcuts editor.pub(super) fn keybindings_editor_widget(&mut self, window: &mut Window, cx: &mut Context<Self>) -> AnyElement {- let header = ModalHeader { icon: "record-keys", title: "Keyboard Shortcuts", json_title: "Open Keyboard Shortcuts (JSON)", json_command: "workbench.action.openGlobalKeybindingsFile", resource: None, args: Vec::new() };+ let header = ModalHeader { icon: "record-keys", title: "Keyboard Shortcuts", json_title: "Open Keyboard Shortcuts (JSON)", json_command: "workbench.action.openGlobalKeybindingsFile", json_args: Vec::new(), resource: None, args: Vec::new() };let focus = self.keybindings_editor.modal_focus.clone();self.modal_editor_part(header, &focus, window, cx, |workbench, width, height, window, cx| workbench.keybindings_editor_pane(width, height, window, cx).into_any_element())}@@ -983,7 +987,7 @@ impl Workbench {fn modal_header(&self, header: ModalHeader, context: HashMap<String, Value>, cx: &mut Context<Self>) -> impl IntoElement + use<> {let foreground = self.foreground_or("titleBar.activeForeground");let (mut editor_actions, more) = self.modal_editor_menu_actions(&header.args, context, foreground, cx);- let action = |name: &'static str, title: &'static str, command: &'static str| {+ let action = |name: &'static str, title: &'static str, command: &'static str, args: Vec<Value>| {self.icon(name, 22., 16., foreground).id(command).debug_selector(move || command.into())@@ -992,7 +996,7 @@ impl Workbench {.hover(|item| item.bg(self.color("toolbar.hoverBackground"))).child(self.action_hover(title, command, super::hover::HoverOptions::mouse())).on_click(cx.listener(move |workbench, _, window, cx| {- let outcome = workbench.execute_command(command, Vec::new(), window, cx);+ let outcome = workbench.execute_command(command, args.clone(), window, cx);super::keyboard::report_failure(outcome, cx);}))};@@ -1027,16 +1031,16 @@ impl Workbench {if !header.json_command.is_empty() {// preferences.contribution.ts: Open Keyboard Shortcuts (JSON) has no order, the others order 1.let order = if header.json_command == "workbench.action.openGlobalKeybindingsFile" { 0. } else { 1. };- editor_actions.push((order, header.json_title.to_string(), action("go-to-file", header.json_title, header.json_command)));+ editor_actions.push((order, header.json_title.to_string(), action("go-to-file", header.json_title, header.json_command, header.json_args)));}// menuService.ts compareMenuItems: by order, then by title.editor_actions.sort_by(|a, b| a.0.total_cmp(&b.0).then_with(|| crate::command_palette::locale_compare(&a.1, &b.1)));let shown = !editor_actions.is_empty() || more.is_some();- row.children(editor_actions.into_iter().map(|(_, _, action)| action)).children(more).when(shown, |row| row.child(div().mx(px(4.)).w(px(1.)).h(px(16.)).bg(foreground).opacity(0.3)))+ row.when(shown, |row| row.child(div().flex().items_center().gap(px(4.)).children(editor_actions.into_iter().map(|(_, _, action)| action)).children(more))).when(shown, |row| row.child(div().mx(px(4.)).w(px(1.)).h(px(16.)).bg(foreground).opacity(0.3)))})- .child(action("open-in-product", "Open Modal Editor in Main Window", "workbench.action.moveModalEditorToMain"))- .child(action(if self.keybindings_editor.maximized { "screen-normal" } else { "screen-full" }, maximize_title, "workbench.action.toggleModalEditorMaximized").ml(px(4.)))- .child(action("close", "Close Modal Editor", CLOSE_MODAL_COMMAND).ml(px(4.)))+ .child(action("open-in-product", "Open Modal Editor in Main Window", "workbench.action.moveModalEditorToMain", Vec::new()))+ .child(action(if self.keybindings_editor.maximized { "screen-normal" } else { "screen-full" }, maximize_title, "workbench.action.toggleModalEditorMaximized", Vec::new()).ml(px(4.)))+ .child(action("close", "Close Modal Editor", CLOSE_MODAL_COMMAND, Vec::new()).ml(px(4.)))}/// modalEditorPart.ts `createEditorActions(MenuId.ModalEditorEditorTitle)`: the menu's `navigation` items with@@ -1045,10 +1049,14 @@ impl Workbench {let menu = crate::menus::MenuId::ModalEditorEditorTitle;let mut buttons = Vec::new();for item in self.menus.iter().filter(|item| item.menu == menu && item.group == "navigation" && item.when.as_ref().is_none_or(|when| when.evaluate(&context))) {- // shortcut: a submenu gets no dropdown button, port SubmenuItemActionViewItem when an extension needs one.- let crate::menus::Entry::Command { id, .. } = &item.entry else { continue };+ // A submenu is a dropdown (`SubmenuEntryActionViewItem`), left out while it has no actions.+ let (id, button) = match &item.entry {+ crate::menus::Entry::Command { id, .. } => (id.clone(), self.command_button(id, item.title.clone(), args.to_vec(), foreground, cx)),+ crate::menus::Entry::Submenu { submenu, .. } if crate::menus::menu_actions(&self.menus, *submenu, &context).is_empty() => continue,+ crate::menus::Entry::Submenu { submenu, .. } => (format!("{submenu:?}"), self.submenu_button(*submenu, self.submenu_icons.get(submenu), item.title.clone(), context.clone(), args.to_vec(), foreground, cx)),+ };let selector = format!("modal-editor-action-{id}");- buttons.push((item.order, item.title.clone(), self.command_button(id, item.title.clone(), args.to_vec(), foreground, cx).debug_selector(move || selector)));+ buttons.push((item.order, item.title.clone(), button.debug_selector(move || selector)));}let secondary = crate::menus::menu_group_actions(&self.menus, menu, &context, |group| group != "navigation");if secondary.is_empty() {@@ -1057,17 +1065,20 @@ impl Workbench {let bounds = std::rc::Rc::new(std::cell::Cell::new(gpui::Bounds::default()));let measured = bounds.clone();let args = args.to_vec();+ let open = self.context_menu.is_some() && self.keybindings_editor.more_menu_open;let more = self.icon("toolbar-more", 22., 16., foreground).id("modal-editor-more").debug_selector(|| "modal-editor-more".into()).rounded(px(4.))+ .when(open, |button| button.bg(self.color("toolbar.activeBackground"))).cursor_pointer().hover(|button| button.bg(self.color("toolbar.hoverBackground"))).child(self.hover_target("modal-editor-more-hover", super::hover::HoverContent::Text("More Actions...".into()), super::hover::HoverOptions::mouse())).on_mouse_down(MouseButton::Left, cx.listener(move |workbench, _: &gpui::MouseDownEvent, window, cx| {cx.stop_propagation();- workbench.show_dropdown_menu_actions(secondary.clone(), &context, bounds.get(), args.clone(), window, cx);+ workbench.show_context_menu_actions(secondary.clone(), &context, bounds.get(), args.clone(), window, cx);+ workbench.keybindings_editor.more_menu_open = true;})).child(gpui::canvas(move |element_bounds, _, _| measured.set(element_bounds), |_, _, _, _| {}).absolute().size_full());(buttons, Some(more))diff --git a/native/crates/app/src/workbench/keyboard.rs b/native/crates/app/src/workbench/keyboard.rsindex 76581806762..d32101a44e0 100644--- a/native/crates/app/src/workbench/keyboard.rs+++ b/native/crates/app/src/workbench/keyboard.rs@@ -312,6 +312,7 @@ impl Workbench {cx.stop_propagation();if !self.hovers.is_sticky() {self.dismiss_hover(cx);+ self.hover_focused_action_item(window, cx);}}}@@ -616,6 +617,7 @@ impl Workbench {}self.scm_key_context(window, &mut context);self.debug_context(window, &mut context);+ self.testing_service_context(&mut context);self.testing_continuous_context(&mut context);self.keybindings_editor_context(window, &mut context);self.settings_editor_context(window, &mut context);diff --git a/native/crates/app/src/workbench/modal_editor_group.rs b/native/crates/app/src/workbench/modal_editor_group.rsindex cfb7c831376..4bb8dafaaea 100644--- a/native/crates/app/src/workbench/modal_editor_group.rs+++ b/native/crates/app/src/workbench/modal_editor_group.rs@@ -36,10 +36,19 @@ impl Workbench {self.open_file_in_active_group(scheme, path, true, window, cx);}- /// The Settings, Keyboard Shortcuts, Profiles or Workspace Trust editor (`path`) in the modal group, pinned,- /// activated where it is already.+ /// The Settings, Keyboard Shortcuts, Profiles or Workspace Trust editor (`path`) in the modal group, else in the+ /// active group, pinned, activated where it is already.pub(super) fn open_preferences_editor(&mut self, path: &str, window: &mut Window, cx: &mut Context<Self>) {- self.enter_modal_group(window, cx);+ // preferencesService.ts: Settings takes `getEditorGroupFromOptions`, Keyboard Shortcuts `MODAL_GROUP`, Profiles+ // and Workspace Trust `RequiresModal`; editorGroupFinder.ts lets `useModal: off` win over the last two.+ let modal = match path {+ SETTINGS_EDITOR_PATH => self.uses_modal_group(),+ _ => self.setting("workbench.editor.useModal") != json!("off"),+ };+ match modal {+ true => self.enter_modal_group(window, cx),+ false => self.leave_side_group(),+ }let path = Path::new(path);match self.editors.editors.iter().position(|editor| editor.document().is(PREFERENCES_EDITOR_SCHEME, path)) {Some(index) => self.editors.activate(index),@@ -230,13 +239,12 @@ impl Workbench {_ => Some(self.keybindings_editor_widget(window, cx)),};}- let (resource, json_title, json_command, uri) = self.with_group(MODAL_GROUP, |workbench| {+ let (resource, (json_title, json_command, json_args), uri) = self.with_group(MODAL_GROUP, |workbench| {let editor = workbench.editors.active().expect("an open modal group has an active editor");- let path = editor.document().path.clone();- let (json_title, json_command) = workbench.modal_editor_title_action(&path);- (workbench.modal_resource_label(editor), json_title, json_command, editor.document().uri())+ let document = editor.document();+ (workbench.modal_resource_label(editor), workbench.modal_editor_title_action(&document.scheme, &document.path), document.uri())});- let header = ModalHeader { icon: "", title: "", json_title, json_command, resource: Some(resource), args: vec![uri] };+ let header = ModalHeader { icon: "", title: "", json_title, json_command, json_args, resource: Some(resource), args: vec![uri] };let focus = self.editor_focus.clone();Some(self.modal_editor_part(header, &focus, window, cx, |workbench, _, _, window, cx| {let body = |workbench: &mut Self, window: &mut Window, cx: &mut Context<Self>| {@@ -261,15 +269,18 @@ impl Workbench {}))}- /// `ModalEditorEditorTitle`: preferences.contribution.ts's Open Settings (UI) on a settings file and Open Keyboard- /// Shortcuts on keybindings.json.- fn modal_editor_title_action(&self, path: &std::path::Path) -> (&'static str, &'static str) {+ /// `ModalEditorEditorTitle`: preferences.contribution.ts's Open Settings (UI) on a user, workspace or folder+ /// settings file and Open Keyboard Shortcuts on keybindings.json.+ fn modal_editor_title_action(&self, scheme: &str, path: &Path) -> (&'static str, &'static str, Vec<Value>) {if self.keybindings.user_file.as_deref() == Some(path) {- return ("Open Keyboard Shortcuts", "workbench.action.openGlobalKeybindings");+ return ("Open Keyboard Shortcuts", "workbench.action.openGlobalKeybindings", Vec::new());+ }+ if self.is_user_settings_file(path) {+ return ("Open Settings (UI)", "workbench.action.openSettings2", Vec::new());}- match self.is_user_settings_file(path) {- true => ("Open Settings (UI)", "workbench.action.openSettings2"),- false => ("", ""),+ match self.open_workspace_settings_ui_action(scheme, path) {+ Some((command, args)) => ("Open Settings (UI)", command, args),+ None => ("", "", Vec::new()),}}diff --git a/native/crates/app/src/workbench/modal_editor_group/tests.rs b/native/crates/app/src/workbench/modal_editor_group/tests.rsindex 0fadceb5b06..a2415041a41 100644--- a/native/crates/app/src/workbench/modal_editor_group/tests.rs+++ b/native/crates/app/src/workbench/modal_editor_group/tests.rs@@ -1,7 +1,7 @@use std::path::Path;use exthost::scan::scan_extension;-use gpui::TestAppContext;+use gpui::{TestAppContext, px};use crate::editor::MODAL_GROUP;use crate::host_sync::HostSync;@@ -67,6 +67,17 @@ fn use_modal_off_opens_keybindings_json_in_the_active_group(cx: &mut TestAppContassert_eq!(workbench.editors.id, 0);assert!(!workbench.modal_group_open());});++ // preferencesService.ts:392 and editorGroupFinder.ts: the preferences editors open as tabs of the active group.+ for command in ["workbench.action.openSettings2", "workbench.action.openGlobalKeybindings", "workbench.profiles.actions.manageProfiles", "workbench.trust.manage"] {+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command(command, vec![], window, cx)));+ cx.run_until_parked();+ }+ workbench.read_with(cx, |workbench, _| {+ assert!(!workbench.modal_group_open());+ let paths: Vec<_> = workbench.editors.group_tabs(0).0.iter().map(|editor| editor.document().path.to_string_lossy().into_owned()).collect();+ assert_eq!(paths, [keybindings.to_string_lossy().as_ref(), "/settingseditor", "/keybindingseditor", "/profileseditor", "/workspacetrusteditor"]);+ });}/// preferencesService.ts `openGlobalKeybindingSettings(true)` with `workbench.settings.openDefaultKeybindings`: the@@ -127,22 +138,40 @@ fn the_modal_header_shows_the_modal_editor_title_menu(cx: &mut TestAppContext) {let entry = Entry::Command { id: id.into(), precondition: None, toggled: None, alt: None };workbench.menus.push(MenuItem { menu: MenuId::ModalEditorEditorTitle, entry, title: id.into(), group: group.into(), order: 0., when: crate::contextkey::Expr::deserialize(when) });}+ let entry = Entry::Command { id: "port.inside".into(), precondition: None, toggled: None, alt: None };+ workbench.menus.push(MenuItem { menu: MenuId::Test, entry, title: "port.inside".into(), group: String::new(), order: 1., when: None });+ let entry = Entry::Submenu { submenu: MenuId::Test, toggled: None };+ workbench.menus.push(MenuItem { menu: MenuId::ModalEditorEditorTitle, entry, title: "port.submenu".into(), group: "navigation".into(), order: 2., when: None });});run(&workbench, "workbench.action.openGlobalKeybindingsFile", cx);let modal = cx.debug_bounds("modal-editor-action-port.modal").expect("port.modal is drawn");let open = cx.debug_bounds("workbench.action.openGlobalKeybindings").expect("Open Keyboard Shortcuts is drawn");assert!(modal.left() < open.left(), "order 0 before order 1");+ // modalEditorPart.css: `.actions-container { gap: 4px }`.+ let tie = cx.debug_bounds("modal-editor-action-port.tie").expect("port.tie is drawn");+ assert_eq!(tie.left() - modal.right(), px(4.));assert!(cx.debug_bounds("modal-editor-action-port.hidden").is_none());let more = cx.debug_bounds("modal-editor-more").expect("the overflow holds port.modalMore");cx.simulate_click(more.center(), gpui::Modifiers::default());let titles = workbench.read_with(cx, |workbench, _| {let menu = workbench.context_menu.as_ref().expect("the overflow menu shows");+ // dropdown.ts: `AnchorAlignment.LEFT` without an `anchorAlignmentProvider`.+ assert_eq!(menu.levels[0].origin.x, more.left());menu.levels[0].actions.iter().filter_map(|action| match action {MenuAction::Command { title, .. } => Some(title.clone()),_ => None,}).collect::<Vec<_>>()});assert_eq!(titles, ["port.modalMore"]);+ cx.simulate_keystrokes("escape");+ // menuEntryActionViewItem.ts `SubmenuEntryActionViewItem`: a submenu is a dropdown of its actions.+ let submenu = cx.debug_bounds("modal-editor-action-Test").expect("the submenu's dropdown");+ assert!(open.left() < submenu.left(), "order 2 after order 1");+ cx.simulate_click(submenu.center(), gpui::Modifiers::default());+ workbench.read_with(cx, |workbench, _| {+ let menu = workbench.context_menu.as_ref().expect("the dropdown opens the submenu");+ assert!(matches!(&menu.levels[0].actions[..], [MenuAction::Command { title, .. }] if title == "port.inside"));+ });cx.simulate_keystrokes("escape");run(&workbench, "workbench.action.openGlobalKeybindings", cx);@@ -178,6 +207,74 @@ fn settings_json_joins_the_settings_editor_in_the_modal_group(cx: &mut TestAppCoworkbench.read_with(cx, |workbench, _| assert!(!workbench.modal_group_open() && !workbench.settings_editor.open));}+/// preferences.contribution.ts `updatePreferencesEditorMenuItem(ForWorkspaceFolders)`: a folder's settings.json and the+/// workspace file get Open Settings (UI) in the modal's header and the editor title, opening the folder's and the+/// workspace's settings.+#[gpui::test]+fn workspace_settings_files_get_open_settings_ui(cx: &mut TestAppContext) {+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();+ let theme = load_theme(&[themes], "Dark Modern").unwrap();+ let dir = std::env::temp_dir().join(format!("code-gpui-modal-workspace-settings-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&dir);+ for folder in ["a", "b"] {+ std::fs::create_dir_all(dir.join(folder).join(".vscode")).unwrap();+ std::fs::write(dir.join(folder).join(".vscode/settings.json"), "{}").unwrap();+ }+ let workspace_file = dir.join("w.code-workspace");+ std::fs::write(&workspace_file, r#"{ "folders": [{ "path": "a" }, { "path": "b" }] }"#).unwrap();+ let workspace = config::workspace::Workspace::from_file(workspace_file.clone());+ let settings = config::service::Settings::load(config::registry::Registry::with_extensions(&[]), dir.join("User"), Some(workspace.clone()));+ let (workbench, cx) = cx.add_window_view(|_, cx| {+ Workbench::new(theme, app_root.clone(), Some(workspace), Languages::new(&[]), std::sync::Arc::new(std::sync::Mutex::new(settings)), HostSync::new(std::sync::mpsc::channel().0), cx)+ });+ let open = |path: std::path::PathBuf, cx: &mut gpui::VisualTestContext| {+ workbench.update_in(cx, |workbench, window, cx| workbench.open_preferences_file("file", path, window, cx));+ cx.run_until_parked();+ };++ open(dir.join("b/.vscode/settings.json"), cx);+ let folder_action = cx.debug_bounds("_workbench.action.openFolderSettings").expect("the folder settings get Open Settings (UI)");+ cx.simulate_click(folder_action.center(), gpui::Modifiers::default());+ workbench.read_with(cx, |workbench, _| {+ assert!(workbench.settings_editor.open);+ assert_eq!((workbench.settings_editor.target, workbench.settings_editor.folder.clone()), (config::service::Target::WorkspaceFolder, Some(dir.join("b"))));+ });++ open(workspace_file, cx);+ let workspace_action = cx.debug_bounds("workbench.action.openWorkspaceSettings").expect("the workspace file gets Open Settings (UI)");+ cx.simulate_click(workspace_action.center(), gpui::Modifiers::default());+ workbench.read_with(cx, |workbench, _| assert_eq!(workbench.settings_editor.target, config::service::Target::Workspace));++ run(&workbench, "workbench.action.closeModalEditor", cx);+ workbench.update_in(cx, |workbench, window, cx| workbench.open_file(dir.join("a/.vscode/settings.json"), true, window, cx));+ cx.run_until_parked();+ workbench.read_with(cx, |workbench, _| assert!(!workbench.modal_group_open()));+ assert!(cx.debug_bounds("_workbench.action.openFolderSettings").is_some(), "the editor title has Open Settings (UI) too");+ std::fs::remove_dir_all(dir).unwrap();+}++/// modalEditorPart.ts: the modal's overlay is in front of the main part, so a wheel over the Settings editor scrolls+/// its list, not the text editor of the main part's group below it.+#[gpui::test]+fn a_wheel_over_the_settings_modal_scrolls_the_settings_list(cx: &mut TestAppContext) {+ let (workbench, cx, dir) = preferences_window(cx, "wheel");+ let file = dir.join("a.txt");+ std::fs::write(&file, (0..400).map(|line| format!("line {line}\n")).collect::<String>()).unwrap();+ workbench.update_in(cx, |workbench, window, cx| workbench.open_file(file, true, window, cx));+ run(&workbench, "workbench.action.openSettings2", cx);+ let sash = cx.debug_bounds("settings-sash").expect("the Settings editor is drawn");+ let over_list = sash.center() + gpui::point(gpui::px(100.), gpui::px(0.));+ cx.simulate_event(gpui::ScrollWheelEvent { position: over_list, delta: gpui::ScrollDelta::Pixels(gpui::point(gpui::px(0.), gpui::px(-60.))), ..Default::default() });+ cx.run_until_parked();+ workbench.update(cx, |workbench, _| {+ assert_eq!(workbench.with_group(0, |workbench| workbench.editors.active().unwrap().scroll.top), 0.);+ let top = workbench.settings_editor.tree.logical_scroll_top();+ assert!(top.item_ix > 0 || top.offset_in_item > gpui::px(0.), "the settings list scrolled");+ });+ std::fs::remove_dir_all(dir).unwrap();+}+/// editorCommands.ts `MoveModalEditorToMainWindowAction`: the modal's editors join the main part's group, its active/// editor active and focused there; the Settings editor draws in that group once settings.json closes.#[gpui::test]diff --git a/native/crates/app/src/workbench/outline_find.rs b/native/crates/app/src/workbench/outline_find.rsindex 5297a74c861..7aa12842723 100644--- a/native/crates/app/src/workbench/outline_find.rs+++ b/native/crates/app/src/workbench/outline_find.rs@@ -214,7 +214,7 @@ impl Workbench {if !self.outline_pane.find.open {return None;}- let look = TreeFindLook { input: InputId::OutlineFind, message: self.outline_find_message(), filter_mode: self.outline_pane.view_state.filter_on_type, fuzzy: self.outline_find_fuzzy() };+ let look = TreeFindLook { input: InputId::OutlineFind, message: self.outline_find_message(), filter_mode: self.outline_pane.view_state.filter_on_type, fuzzy: self.outline_find_fuzzy(), input_width: super::explorer_find::INPUT_WIDTH };Some(self.tree_find_widget(look, |workbench, window, cx| workbench.close_outline_find(window, cx), window, cx))}diff --git a/native/crates/app/src/workbench/panel.rs b/native/crates/app/src/workbench/panel.rsindex 660ecf83081..c53b69fe1a5 100644--- a/native/crates/app/src/workbench/panel.rs+++ b/native/crates/app/src/workbench/panel.rs@@ -493,6 +493,8 @@ impl Workbench {/// composite title), several as panes with the container's "..." (`MenuId.ViewContainerTitle`).fn panel_container_content(&mut self, container: &'static str, window: &mut Window, cx: &mut Context<Self>) -> (AnyElement, Option<AnyElement>) {if container == super::extensions_view::VIEWLET_ID {+ let height = self.composite_bar(self.container_location(container)).content_bounds.get().size.height;+ self.layout_extensions_panes(f32::from(height), cx);return (self.extensions_view(window, cx).into_any_element(), Some(self.extensions_title_actions(cx).into_any_element()));}let mut views: Vec<&'static str> = self.views_in(container).into_iter().filter(|view| self.movable_view_shown(view)).map(|view| view.id).collect();@@ -510,7 +512,7 @@ impl Workbench {let content = self.composite_bar(part).content_bounds.get().size;let size = f32::from(if horizontal { content.width } else { content.height });let panes_of = super::view_locations::pane_container(container);- self.layout_panes(panes_of, size, views.iter().map(|&view| (view, self.contributed_view_collapsed(view))).collect(), horizontal, cx);+ self.layout_panes(panes_of, size, views.iter().map(|&view| (view, self.view_collapsed_by_default(view))).collect(), horizontal, cx);let panes = views.into_iter().map(|view| self.movable_view_pane(view, window, cx)).collect();let ordered = self.ordered_panes(&self.panes(panes_of).view.as_ref().expect("laid out above").ids(), panes, window, cx);let more = self.has_view_toggle(panes_of.key()).then(|| self.action_bar_item(container, "more", self.view_container_more_actions(panes_of.key(), cx), cx).into_any_element());diff --git a/native/crates/app/src/workbench/part_navigation.rs b/native/crates/app/src/workbench/part_navigation.rsindex 961aa17c203..a117e6454f9 100644--- a/native/crates/app/src/workbench/part_navigation.rs+++ b/native/crates/app/src/workbench/part_navigation.rs@@ -119,6 +119,9 @@ impl Workbench {let container = if part == Part::SideBar { self.side_bar_container() } else { self.active_container_in(part) };// The extensions viewlet is no view container in the port; its open command focuses its search box.let Some(container) = container else { return drop(self.execute_command("workbench.view.extensions", Vec::new(), window, cx)) };+ if container == super::extensions_view::VIEWLET_ID {+ return self.open_extensions_viewlet(window, cx);+ }let views = self.views_in(container);if let Some(view) = views.iter().find(|view| self.is_view_visible(view.id)).or(views.first()) {drop(self.execute_command(&format!("{}.focus", view.id), Vec::new(), window, cx));diff --git a/native/crates/app/src/workbench/preferences.rs b/native/crates/app/src/workbench/preferences.rsindex aaf9e282020..a8845762223 100644--- a/native/crates/app/src/workbench/preferences.rs+++ b/native/crates/app/src/workbench/preferences.rs@@ -52,6 +52,19 @@ impl Workbench {(target, false) => Some(default_settings_resource(target)),}}++ /// preferences.contribution.ts `updatePreferencesEditorMenuItem(ForWorkspaceFolders)`: the command and arguments+ /// of Open Settings (UI) on a workspace file or a folder's settings.json.+ pub(super) fn open_workspace_settings_ui_action(&self, scheme: &str, path: &Path) -> Option<(&'static str, Vec<Value>)> {+ match unsupported_settings::settings_file_target(&self.settings.lock().unwrap(), scheme, path)? {+ (Target::Workspace, _) => Some(("workbench.action.openWorkspaceSettings", Vec::new())),+ (Target::WorkspaceFolder, _) => {+ let folder = path.parent().and_then(Path::parent).expect("a folder's settings.json is in its .vscode");+ Some(("_workbench.action.openFolderSettings", vec![crate::editor::uri_value("file", folder)]))+ }+ _ => None,+ }+ }}/// `sanitizeOpenSettingsArgs`: the query, the setting to reveal (`revealSetting.key`, `.edit`) and `openToSide`.diff --git a/native/crates/app/src/workbench/profiles_editor_view.rs b/native/crates/app/src/workbench/profiles_editor_view.rsindex ccc0c4ef9be..8f064aa3003 100644--- a/native/crates/app/src/workbench/profiles_editor_view.rs+++ b/native/crates/app/src/workbench/profiles_editor_view.rs@@ -676,7 +676,7 @@ impl Workbench {}pub(super) fn profiles_editor_widget(&mut self, window: &mut Window, cx: &mut Context<Self>) -> AnyElement {- let header = ModalHeader { icon: "settings", title: "Profiles", json_title: "", json_command: "", resource: None, args: Vec::new() };+ let header = ModalHeader { icon: "settings", title: "Profiles", json_title: "", json_command: "", json_args: Vec::new(), resource: None, args: Vec::new() };let focus = self.user_data_profiles.editor.focus.clone().expect("the editor is open");self.modal_editor_part(header, &focus, window, cx, |workbench, width, height, window, cx| workbench.profiles_editor_pane(width, height, window, cx))}diff --git a/native/crates/app/src/workbench/quick_access/tests.rs b/native/crates/app/src/workbench/quick_access/tests.rsindex c8b3922f164..2e7fc2734fc 100644--- a/native/crates/app/src/workbench/quick_access/tests.rs+++ b/native/crates/app/src/workbench/quick_access/tests.rs@@ -322,6 +322,13 @@ fn the_debug_picker_lists_and_starts_the_launch_configurations(cx: &mut TestAppCcx.simulate_keystrokes("enter");cx.run_until_parked();assert_eq!(workbench.read_with(cx, |workbench, _| (workbench.quick_inputs.current().is_none(), workbench.debug.selected.clone())), (true, Some((Some(folder.clone()), "Launch lazy.js".into()))), "the pick is selected and started");+ // debugStatus.ts: `getLaunches()` always holds the user settings launch too, so the folder's name follows.+ let status = workbench.update(cx, |workbench, _| {+ workbench.debug.first_session_started = true;+ workbench.update_debug_status();+ workbench.status_entries.iter().find(|entry| entry.entry_id == "status.debug").map(|entry| entry.text.clone())+ });+ assert_eq!(status.as_deref(), Some("$(debug-alt-small) Launch lazy.js (folder)"));std::fs::remove_dir_all(dir).unwrap();}diff --git a/native/crates/app/src/workbench/readonly/tests.rs b/native/crates/app/src/workbench/readonly/tests.rsindex 881fab77d4a..a29b58a0e08 100644--- a/native/crates/app/src/workbench/readonly/tests.rs+++ b/native/crates/app/src/workbench/readonly/tests.rs@@ -128,11 +128,11 @@ fn the_message_goes_above_the_cursor_unless_the_window_top_is_too_close() {let editor = gpui::Bounds { origin: gpui::point(300., 80.), size: size(800., 600.) };let window = size(1200., 800.);// 22px clearance: the 32px tall widget above line 1 at window y 80 starts at 48.- assert_eq!(layout_in_page(70., 0., 18., 200., editor, window), MessageLayout { left: 70., top: -32., below: false });+ assert_eq!(layout_in_page(70., 0., 18., size(200., 32.), editor, window), MessageLayout { left: 70., top: -32., below: false });let high = gpui::Bounds { origin: gpui::point(300., 40.), ..editor };- assert_eq!(layout_in_page(70., 0., 18., 200., high, window), MessageLayout { left: 70., top: 18., below: true });+ assert_eq!(layout_in_page(70., 0., 18., size(200., 32.), high, window), MessageLayout { left: 70., top: 18., below: true });// 15px from the window's right edge: 300 + 1000 + 200 passes 1185.- assert_eq!(layout_in_page(1000., 100., 18., 200., editor, window), MessageLayout { left: 685., top: 68., below: false });+ assert_eq!(layout_in_page(1000., 100., 18., size(200., 32.), editor, window), MessageLayout { left: 685., top: 68., below: false });}/// filesConfigurationService.test.ts: "updateReadonly only notifies when the session override changes" anddiff --git a/native/crates/app/src/workbench/scm_actions/tests.rs b/native/crates/app/src/workbench/scm_actions/tests.rsindex 5ce7b32f859..07704962b0f 100644--- a/native/crates/app/src/workbench/scm_actions/tests.rs+++ b/native/crates/app/src/workbench/scm_actions/tests.rs@@ -383,9 +383,9 @@ fn a_hovered_row_shows_its_inline_actions(cx: &mut TestAppContext) {workbench.set_part_hidden(crate::workbench::layout::Part::SideBar, false, cx);});cx.run_until_parked();- for (row, command, right) in [("scm-group-0-2", "git.stageAll", 8. + 18. + 4. + 11.), ("scm-resource-0-2-1", "git.stage", 8. + 11.)] {+ for (row, command, right) in [("scm-group-0-2", "git.stageAll", 4. + 19. + 6. + 11.), ("scm-resource-0-2-1", "git.stage", 8. + 11.)] {let bounds = cx.debug_bounds(row).unwrap_or_else(|| panic!("the view shows {row}"));- // The 22px button's center: past the row's 8px padding and, on the group row, its count badge.+ // The 22px button's center: past the row's padding (4px on a group, 8px on a resource) and the group's count badge.let button = gpui::point(bounds.right() - gpui::px(right), bounds.center().y);cx.simulate_mouse_move(button, None, gpui::Modifiers::none());cx.run_until_parked();@@ -395,6 +395,34 @@ fn a_hovered_row_shows_its_inline_actions(cx: &mut TestAppContext) {}}+/// scmViewPane.ts `ResourceGroupRenderer` and `ResourceRenderer`: the count badge 4px from the row's end, as+/// countBadge.css sizes it, and a resource's label hover as labels.ts titles it, its path then the decoration's tooltip.+#[gpui::test]+fn a_changes_row_draws_its_count_and_hovers_its_path(cx: &mut TestAppContext) {+ let (workbench, _receiver, cx) = workbench_in("scm-row-count-hover", cx);+ cx.simulate_resize(gpui::size(gpui::px(1024.), gpui::px(768.)));+ request(&workbench, cx, "$registerSourceControl", register(0, "/w/repo"));+ let raw = json!([1, { "scheme": "file", "path": "/w/repo/a.ts" }, [null, null], "Modified", false, false, "", null, null, null]);+ request(&workbench, cx, "$registerGroups", vec![json!(0), json!([[2, "workingTree", "Changes", {}, false]]), json!([[2, [[0, 0, [raw]]]]])]);+ workbench.update_in(cx, |workbench, window, cx| {+ let mut decorations = workbench.decorations.borrow_mut();+ decorations.register(9);+ let data = crate::decorations::DecorationData { weight: 0, bubble: false, tooltip: Some("Modified".into()), letter: Some("M".into()), color: None };+ decorations.set(9, "/w/repo/a.ts", Some(data));+ drop(decorations);+ drop(workbench.execute_command("workbench.view.scm", Vec::new(), window, cx));+ workbench.set_part_hidden(crate::workbench::layout::Part::SideBar, false, cx);+ });+ cx.run_until_parked();+ let (row, badge) = (cx.debug_bounds("scm-group-0-2").unwrap(), cx.debug_bounds("scm-group-count-0-2").unwrap());+ assert_eq!((f32::from(row.right() - badge.right()), f32::from(badge.size.width), f32::from(badge.size.height)), (4., 19., 19.));+ let resource = cx.debug_bounds("scm-resource-0-2-1").unwrap();+ cx.simulate_mouse_move(resource.center(), None, gpui::Modifiers::none());+ cx.executor().advance_clock(std::time::Duration::from_millis(1500));+ cx.run_until_parked();+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.hovers.shown_text().map(str::to_owned)).as_deref(), Some("/w/repo/a.ts \u{2022} Modified"));+}+/// scmHistoryViewPane.ts `_onContextMenu`: each `scm/historyItemRef/context` command the item's refs show is a/// submenu of those refs, grouped by category, and an entry runs the command with the ref id last.#[gpui::test]@@ -438,3 +466,28 @@ fn a_history_item_menu_offers_each_ref_action_per_ref(cx: &mut TestAppContext) {workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("git.graph.checkout.refs/tags/v1", args.clone(), window, cx)));assert_eq!(ran.borrow().as_slice(), [[args, vec![json!("refs/tags/v1")]].concat()]);}++/// activity.ts `SCMActiveResourceContextKeyController`: git's editor title Open Changes shows while a group lists the+/// active editor's resource (`scmActiveResourceHasChanges`).+#[gpui::test]+fn the_active_resource_has_changes_while_a_group_lists_it(cx: &mut TestAppContext) {+ let (workbench, _receiver, cx) = workbench_in("scm-active-resource", cx);+ let dir = std::env::temp_dir().join(format!("code-gpui-scm-active-resource-repo-{}", std::process::id()));+ std::fs::create_dir_all(&dir).unwrap();+ std::fs::write(dir.join("a.txt"), "a\n").unwrap();+ let root = dir.to_string_lossy().to_string();+ request(&workbench, cx, "$registerSourceControl", register(3, &root));+ workbench.update_in(cx, |workbench, window, cx| workbench.open_file(dir.join("a.txt"), true, window, cx));+ cx.run_until_parked();+ let keys = |cx: &mut VisualTestContext| {+ workbench.update_in(cx, |workbench, window, _| {+ let context = workbench.key_context(window);+ (context.get("scmActiveResourceHasChanges").cloned(), context.get("scmActiveResourceRepository").cloned())+ })+ };+ assert_eq!(keys(cx), (Some(json!(false)), Some(json!("scm3"))));+ let raw = json!([1, { "scheme": "file", "path": format!("{root}/a.txt") }, [null, null], "Modified", false, false, "", null, null, null]);+ request(&workbench, cx, "$registerGroups", vec![json!(3), json!([[2, "workingTree", "Changes", {}, false]]), json!([[2, [[0, 0, [raw]]]]])]);+ assert_eq!(keys(cx), (Some(json!(true)), Some(json!("scm3"))));+ std::fs::remove_dir_all(dir).unwrap();+}diff --git a/native/crates/app/src/workbench/scm_view.rs b/native/crates/app/src/workbench/scm_view.rsindex 90829bdb801..72426a8f1b6 100644--- a/native/crates/app/src/workbench/scm_view.rs+++ b/native/crates/app/src/workbench/scm_view.rs@@ -456,14 +456,7 @@ impl Workbench {if self.scm.active_editor.as_ref() == Some(&key) {return;}- let repository = self- .scm- .model- .providers- .iter()- .filter(|provider| provider.root_uri["scheme"] == json!(key.0) && provider.root_uri["path"].as_str().is_some_and(|root| key.1.starts_with(root)))- .max_by_key(|provider| provider.root_uri["path"].as_str().map_or(0, str::len))- .map(|provider| provider.handle);+ let repository = self.scm_repository_of(&key.0, &key.1).map(|provider| provider.handle);self.scm.active_editor = Some(key);if repository.is_some() && repository != self.scm.active {self.scm.active = repository;@@ -471,6 +464,28 @@ impl Workbench {}}+ /// `scmService.getRepository`: the deepest repository root holding the resource.+ fn scm_repository_of(&self, scheme: &str, path: &std::path::Path) -> Option<&Provider> {+ self.scm+ .model+ .providers+ .iter()+ .filter(|provider| provider.root_uri["scheme"] == json!(scheme) && provider.root_uri["path"].as_str().is_some_and(|root| path.starts_with(root)))+ .max_by_key(|provider| provider.root_uri["path"].as_str().map_or(0, str::len))+ }++ /// activity.ts `SCMActiveResourceContextKeyController`: the active editor's repository and whether one of its+ /// groups lists the editor's resource.+ fn scm_active_resource_context(&self, context: &mut HashMap<String, Value>) {+ let Some(document) = self.editors.pane_editor().map(|editor| editor.document()) else { return };+ let Some(provider) = self.scm_repository_of(&document.scheme, &document.path) else { return };+ let is_resource = |resource: &Resource| resource.uri["scheme"] == json!(document.scheme) && resource.uri["path"].as_str().is_some_and(|path| document.path == std::path::Path::new(path));+ let has_changes = provider.groups.iter().any(|group| group.resources.iter().any(is_resource));+ context.insert("scmActiveResourceHasChanges".into(), json!(has_changes));+ // mainThreadSCM.ts `MainThreadSCMProvider.id`, not the extension's `id`.+ context.insert("scmActiveResourceRepository".into(), json!(format!("scm{}", provider.handle)));+ }+/// activity.ts `_updateStatusBar`: the active repository's `statusBarCommands` as `status.scm.<index>` entries.fn refresh_scm_status_entries(&mut self) {self.status_entries.retain(|entry| !entry.entry_id.starts_with("status.scm."));@@ -587,6 +602,7 @@ impl Workbench {/// The key context while the view has focus: the repository and the input's state.pub(in crate::workbench) fn scm_key_context(&self, window: &Window, context: &mut HashMap<String, Value>) {+ self.scm_active_resource_context(context);let Some(provider) = self.active_scm_provider() else { return };context.insert("scm.providerCount".into(), json!(self.scm.model.providers.len()));if self.scm.input_focus.is_focused(window) {@@ -982,16 +998,21 @@ impl Workbench {let actions = self.inline_actions(MenuId::ScmResourceGroupContext, None, &context, vec![Self::group_arg(provider, group)], foreground, cx);let key = (provider.handle, group.handle);let selected = self.scm.selected == Some((provider.handle, group.handle, None));+ // countBadge.css under fontRamp.css: 19px high and wide at least, 10px text, 6px after the actions.+ let badge_selector = format!("scm-group-count-{}-{}", provider.handle, group.handle);let badge = div()- .ml(px(4.))- .min_w(px(18.))- .h(px(18.))- .px(px(5.))- .rounded(px(11.))+ .debug_selector(move || badge_selector)+ .flex_none()+ .ml(px(6.))+ .min_w(px(19.))+ .h(px(19.))+ .px(px(6.))+ .rounded_full().flex().items_center().justify_center()- .text_size(px(11.))+ .text_size(px(10.))+ .line_height(px(11.)).bg(self.color("badge.background")).text_color(self.color("badge.foreground")).child(group.resources.len().to_string());@@ -1006,7 +1027,8 @@ impl Workbench {// abstractTree.ts `indentSize`: the twistie 8px further in than the input row's and the actions, and the// label after the twistie's 6px padding (tree.css), measured against the reference with ui-pair..pl(px(INDENT * (1 + level) as f32 + 3.))- .pr(px(8.))+ // scm.css `.resource-group`: 4px right padding.+ .pr(px(4.)).flex().items_center().rounded(px(4.))@@ -1046,7 +1068,16 @@ impl Workbench {let context = self.scm_context(provider, Some(group), Some(resource), window);let args = vec![Self::resource_arg(provider, group, resource)];let actions = self.inline_actions(MenuId::ScmResourceStateContext, None, &context, args.clone(), foreground, cx);- let decoration = self.scm_decoration(&path);+ let decoration = self.file_decoration(&path, false);+ // labels.ts titles the label with its path, then the decoration's tooltip.+ let title = match decoration.as_ref().and_then(|decoration| decoration.tooltip.as_deref()) {+ Some(tooltip) => format!("{} \u{2022} {tooltip}", crate::quick_input::path_label(&path, None)),+ None => crate::quick_input::path_label(&path, None),+ };+ let letter = decoration.and_then(|decoration| {+ let color = decoration.color.as_deref().and_then(|color| self.theme.color(color)).unwrap_or(foreground);+ Some((decoration.letter?, color))+ });let language = self.languages.language_of(&path, "").to_string();let icon = self.file_icons.as_ref().and_then(|icons| icons.file_icon(&path, &language, self.theme.kind, 13., ROW_HEIGHT, foreground)).unwrap_or_else(|| div().w(px(16.)));let key = (provider.handle, group.handle, Some(resource.handle));@@ -1059,6 +1090,7 @@ impl Workbench {.debug_selector(|| id.to_string()).group(id.clone()).h(px(ROW_HEIGHT))+ .relative()// The icon at the indent, measured against the reference with ui-pair..pl(px(INDENT * (2 + level + tree_depth.unwrap_or(0)) as f32)).pr(px(8.))@@ -1086,19 +1118,16 @@ impl Workbench {let actions = crate::menus::menu_group_actions(&workbench.menus, MenuId::ScmResourceStateContext, &context, |group| group != "inline");workbench.show_context_menu_actions(actions, &context, Bounds::new(event.position, Default::default()), args.clone(), window, cx);}))+ .child(self.hover_target(gpui::SharedString::from(format!("{id}-hover")), HoverContent::Text(title), HoverOptions::mouse())).child(icon.mr(px(6.)))// scmViewPane.ts `fileDecorations: { colors: false }`: only the letter takes the decoration's color..child(div().flex_none().whitespace_nowrap().when(resource.strike_through, |name| name.line_through()).child(name)).child(div().flex_1().min_w_0().ml(px(6.)).overflow_hidden().whitespace_nowrap().text_size(px(12.)).opacity(0.7).child(folder)).child(div().invisible().group_hover(id, |actions| actions.visible()).child(actions))- .children(decoration.map(|(letter, color)| div().w(px(16.)).ml(px(4.)).text_size(px(12.)).text_color(color).child(letter)))- }-- /// The letter and color the decorations service has for a resource (git's `IFileDecorationProvider`).- fn scm_decoration(&self, path: &std::path::Path) -> Option<(String, Rgba)> {- let decoration = self.file_decoration(path, false)?;- let color = decoration.color.as_deref().and_then(|color| self.theme.color(color)).unwrap_or(self.foreground_or("sideBar.foreground"));- Some((decoration.letter?, color))+ // scm.css `.monaco-icon-label::after`: a centered 16px box 5px after the label, at fontRamp.css's 11px.+ .children(letter.map(|(letter, color)| {+ div().flex_none().w(px(16.)).ml(px(5.)).flex().justify_center().text_size(px(11.)).font_weight(gpui::FontWeight::SEMIBOLD).opacity(0.75).text_color(color).child(letter)+ }))}/// The `inline` group of a menu as icon buttons (`createAndFillInActionBarActions` with `primaryGroup` inline ordiff --git a/native/crates/app/src/workbench/settings_editor_view.rs b/native/crates/app/src/workbench/settings_editor_view.rsindex 83b7a01c25f..3df632e4204 100644--- a/native/crates/app/src/workbench/settings_editor_view.rs+++ b/native/crates/app/src/workbench/settings_editor_view.rs@@ -76,8 +76,8 @@ const FILTER_ACTIONS: &[(&str, &str, &str, FilterKind)] = &[pub struct SettingsEditor {pub open: bool,/// The settings target tab: User, Workspace, or Folder with its folder.- target: Target,- folder: Option<PathBuf>,+ pub(super) target: Target,+ pub(super) folder: Option<PathBuf>,groups: Vec<SettingsGroup>,model: Model,inspections: Vec<Inspection>,@@ -868,7 +868,7 @@ impl Workbench {}pub(super) fn settings_editor_widget(&mut self, window: &mut Window, cx: &mut Context<Self>) -> AnyElement {- let header = ModalHeader { icon: "settings", title: "Settings", json_title: "Open Settings (JSON)", json_command: "workbench.action.openSettingsJson", resource: None, args: Vec::new() };+ let header = ModalHeader { icon: "settings", title: "Settings", json_title: "Open Settings (JSON)", json_command: "workbench.action.openSettingsJson", json_args: Vec::new(), resource: None, args: Vec::new() };let focus = self.settings_editor.modal_focus.clone();self.modal_editor_part(header, &focus, window, cx, |workbench, width, height, window, cx| workbench.settings_editor_pane(width, height, window, cx))}diff --git a/native/crates/app/src/workbench/terminal_view.rs b/native/crates/app/src/workbench/terminal_view.rsindex 56a846f7b50..ef4517e6eb4 100644--- a/native/crates/app/src/workbench/terminal_view.rs+++ b/native/crates/app/src/workbench/terminal_view.rs@@ -1244,6 +1244,10 @@ impl Workbench {Resolution::KbFound { command, .. } if self.setting("terminal.integrated.sendKeybindingsToShell") != true && (keystroke.modifiers.platform || self.skips_shell(command)) => return false,_ => {}}+ // terminalInstance.ts: with Tab Focus Mode on, Tab and Shift+Tab move the focus as the browser's Tab order does.+ if keystroke.key == "tab" && self.tab_focus_mode() {+ return false;+ }let mac_option_is_meta = self.setting("terminal.integrated.macOptionIsMeta") == true;let Some(instance) = self.terminal_view.active_instance_mut() else { return false };let application_cursor = instance.term.mode().contains(TermMode::APP_CURSOR);diff --git a/native/crates/app/src/workbench/terminal_view/tests.rs b/native/crates/app/src/workbench/terminal_view/tests.rsindex acdd3544596..f218fd55ab9 100644--- a/native/crates/app/src/workbench/terminal_view/tests.rs+++ b/native/crates/app/src/workbench/terminal_view/tests.rs@@ -128,3 +128,24 @@ fn the_resize_overlay_hides_half_a_second_after_the_resize(cx: &mut gpui::TestApcx.run_until_parked();assert!(cx.debug_bounds("terminal-resize-overlay").is_none());}++/// terminalInstance.ts `attachCustomKeyEventHandler`: with Tab Focus Mode on, Tab is not passed to the terminal and+/// moves the focus; with it off the terminal keeps the focus and takes the key.+#[gpui::test]+fn in_tab_focus_mode_tab_leaves_the_terminal(cx: &mut gpui::TestAppContext) {+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let themes = exthost::scan::scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();+ let theme = crate::theme::load_theme(&[themes], "Dark Modern").unwrap();+ let (workbench, cx) = cx.add_window_view(|_, cx| Workbench::new(theme, app_root.clone(), None, crate::languages::Languages::new(&[]), crate::default_settings(), crate::host_sync::HostSync::new(std::sync::mpsc::channel().0), cx));+ cx.update(|window, _| window.activate_window());+ workbench.update_in(cx, |workbench, window, cx| workbench.execute_command("workbench.action.terminal.new", Vec::new(), window, cx));+ cx.run_until_parked();+ let terminal_focused = |cx: &mut gpui::VisualTestContext| workbench.update_in(cx, |workbench, window, _| workbench.terminal_view.focus.is_focused(window));+ assert!(terminal_focused(cx));+ cx.simulate_keystrokes("tab");+ assert!(terminal_focused(cx));++ workbench.update_in(cx, |workbench, window, cx| workbench.execute_command("editor.action.toggleTabFocusMode", Vec::new(), window, cx));+ cx.simulate_keystrokes("tab");+ assert!(!terminal_focused(cx));+}diff --git a/native/crates/app/src/workbench/testing_gutter.rs b/native/crates/app/src/workbench/testing_gutter.rsindex e6de4e7520b..7d12b8ac83b 100644--- a/native/crates/app/src/workbench/testing_gutter.rs+++ b/native/crates/app/src/workbench/testing_gutter.rs@@ -1,22 +1,33 @@//! testingDecorations.ts's gutter actions generator: the `getContextMenuActions` of the line's//! `RunSingleTestDecoration` or `MultiRunTestDecoration`, which the editor gutter's menu shows first.-use gpui::Window;+use gpui::{Context, Window};use serde_json::{Value, json};use super::Workbench;use super::testing_item_menu::HAS_NON_DEFAULT_PROFILE;use crate::commands::Outcome;use crate::menus::{MenuAction, MenuId, menu_actions};+use crate::quick_input::{Entry as PickEntry, Item};use crate::testing::{GROUP_COVERAGE, GROUP_DEBUG, GROUP_RUN, ResultState, parent_id};+const MAX_TESTS_IN_SUBMENU: usize = 30;+impl Workbench {pub(super) fn register_testing_gutter_commands(&mut self) {// testing.contribution.ts: reveals the test and opens the Test Explorer.self.commands.register("_revealTestInExplorer", |workbench, args, window, cx| {let Some(id) = args.first().and_then(|arg| arg.as_str().or(arg["extId"].as_str())) else { return Outcome::done() };workbench.expand_test_ancestors(id);- workbench.execute_command("workbench.view.testing", Vec::new(), window, cx)+ workbench.testing_view.selected = Some(id.to_owned());+ workbench.testing_view.reveal_pending.set(true);+ workbench.open_testing_view(args.get(1) == Some(&json!(true)), window, cx);+ Outcome::done()+ });+ self.commands.register("_testing.gutterPickAndRun", |workbench, args, window, cx| {+ let tests: Vec<String> = args.iter().filter_map(|arg| arg.as_str().map(str::to_owned)).collect();+ workbench.pick_and_run_test(&tests, window, cx);+ Outcome::done()});}@@ -71,6 +82,25 @@ impl Workbench {actions.push(self.bound_action(title, "vscode.runTestsById", args));}}+ let labeled = self.multi_test_labels(tests);+ if !actions.is_empty() && !labeled.is_empty() {+ actions.push(MenuAction::Separator);+ }+ for (label, id) in labeled.iter().take(MAX_TESTS_IN_SUBMENU) {+ let stripped = crate::command_palette::strip_icons(label);+ let title = stripped.split('\n').next().unwrap_or_default().to_owned();+ let submenu = self.test_context_menu_actions(id, window);+ actions.push(MenuAction::Submenu { title, actions: submenu, checked: false });+ }+ let overflow = labeled.len().saturating_sub(MAX_TESTS_IN_SUBMENU);+ if overflow > 0 {+ actions.push(self.bound_action(&format!("{overflow} more tests..."), "_testing.gutterPickAndRun", tests.iter().map(|id| json!(id)).collect()));+ }+ actions+ }++ /// The line's tests with their labels, prefixed by their parents' until the labels differ, sorted by sortText or label.+ fn multi_test_labels(&self, tests: &[String]) -> Vec<(String, String)> {let items = &self.testing.collection.items;let label_of = |id: &str| items.get(id).map_or(String::new(), |test| test.label().to_owned());let mut labeled: Vec<(String, Option<&str>, &String)> = tests.iter().map(|id| (label_of(id), parent_id(id), id)).collect();@@ -93,18 +123,36 @@ impl Workbench {}let sort_key = |id: &str| items.get(id).map_or(String::new(), |test| test.item["sortText"].as_str().unwrap_or(test.label()).to_owned());labeled.sort_by(|a, b| crate::command_palette::locale_compare(&sort_key(a.2), &sort_key(b.2)));- let labeled: Vec<(String, String)> = labeled.into_iter().map(|(label, _, id)| (label, id.clone())).collect();- if !actions.is_empty() && !labeled.is_empty() {- actions.push(MenuAction::Separator);- }- // shortcut: no `MAX_TESTS_IN_SUBMENU` (30) overflow item with its pick, until a line holds more tests.- for (label, id) in labeled {- let stripped = crate::command_palette::strip_icons(&label);- let title = stripped.split('\n').next().unwrap_or_default().to_owned();- let submenu = self.test_context_menu_actions(&id, window);- actions.push(MenuAction::Submenu { title, actions: submenu, checked: false });- }- actions+ labeled.into_iter().map(|(label, _, id)| (label, id.clone())).collect()+ }++ /// `MultiRunTestDecoration.pickAndRun`: a test of the line, then one of its gutter actions.+ fn pick_and_run_test(&mut self, tests: &[String], window: &mut Window, cx: &mut Context<Self>) {+ let labeled = self.multi_test_labels(tests);+ let entries = labeled.iter().enumerate().map(|(index, (label, _))| PickEntry::Item(Item { handle: index as i64, label: label.clone(), ..Item::default() })).collect();+ let picked_test = self.debug_pick("Select a test to run", entries, window, cx);+ cx.spawn_in(window, async move |this, cx| {+ let Some(index) = picked_test.await.ok().flatten().and_then(|handle| handle.parse::<usize>().ok()) else { return };+ let (label, id) = &labeled[index];+ let Ok((picked_action, commands)) = this.update_in(cx, |workbench, window, cx| {+ let mut commands = Vec::new();+ let mut entries = Vec::new();+ for action in workbench.test_context_menu_actions(id, window) {+ match action {+ MenuAction::Command { id, title, .. } => {+ entries.push(PickEntry::Item(Item { handle: commands.len() as i64, label: title, ..Item::default() }));+ commands.push(id);+ }+ MenuAction::Separator => entries.push(PickEntry::Separator(None)),+ MenuAction::Submenu { .. } => {}+ }+ }+ (workbench.debug_pick(label, entries, window, cx), commands)+ }) else { return };+ let Some(index) = picked_action.await.ok().flatten().and_then(|handle| handle.parse::<usize>().ok()) else { return };+ let _ = this.update_in(cx, |workbench, window, cx| drop(workbench.execute_command(&commands[index], Vec::new(), window, cx)));+ })+ .detach();}/// An item running `command` with `args`, registered under an id of its own since a menu passes every item the@@ -113,7 +161,7 @@ impl Workbench {MenuAction::Command { id: self.bound_command(command, args), title: title.into(), enabled: true, checked: false, alt: None }}- fn bound_command(&mut self, command: &str, args: Vec<Value>) -> String {+ pub(super) fn bound_command(&mut self, command: &str, args: Vec<Value>) -> String {let id = format!("_testing.bound:{command}:{}", Value::from(args.clone()));if self.commands.get(&id).is_none() {let command = command.to_owned();diff --git a/native/crates/app/src/workbench/testing_gutter/tests.rs b/native/crates/app/src/workbench/testing_gutter/tests.rsindex 4cc1bb4a869..dd03e29a6e4 100644--- a/native/crates/app/src/workbench/testing_gutter/tests.rs+++ b/native/crates/app/src/workbench/testing_gutter/tests.rs@@ -120,6 +120,47 @@ fn a_line_with_two_tests_shows_run_all_and_a_submenu_per_test(cx: &mut TestAppCoassert_eq!(titles(submenu), ["Run Test", "Debug Test", "Execute Using Profile...", "Reveal in Test Explorer"]);}+/// testingDecorations.ts `MAX_TESTS_IN_SUBMENU`: past 30 tests the line's menu ends in "{0} more tests...", whose+/// `pickAndRun` picks one of all the tests, then one of its actions.+#[gpui::test]+fn a_line_with_more_than_30_tests_picks_the_rest_from_a_quick_pick(cx: &mut TestAppContext) {+ let ids: Vec<(String, String)> = (0..31).map(|index| (format!("c\0t{index:02}"), format!("t{index:02}"))).collect();+ let tests: Vec<(&str, &str, u32)> = ids.iter().map(|(id, label)| (id.as_str(), label.as_str(), 3)).collect();+ let (workbench, cx, host) = workbench_with_tests("test-gutter-overflow", &tests, cx);+ let actions = workbench.update_in(cx, |workbench, window, _| workbench.test_gutter_actions(3, window));+ assert_eq!(actions.len(), 3 + 30 + 1);+ assert_eq!(titles(&actions)[32..], ["t29 >", "1 more tests..."]);++ let accept = |handle: i64, cx: &mut VisualTestContext| {+ let shown = workbench.update_in(cx, |workbench, window, cx| {+ let input = workbench.quick_inputs.current().expect("a pick shows");+ let shown = (input.placeholder.clone(), input.items().iter().filter_map(|entry| match entry {+ crate::quick_input::Entry::Item(item) => Some(item.label.clone()),+ _ => None,+ }).collect::<Vec<_>>());+ let id = input.id;+ let input = workbench.quick_inputs.get_mut(id).unwrap();+ input.set_active_items(&[handle]);+ input.accept_from_ui();+ workbench.flush_quick_input_events(window, cx);+ shown+ });+ cx.run_until_parked();+ shown+ };+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command(&command_titled(&actions, "1 more tests..."), vec![json!({ "lineNumber": 3 })], window, cx)));+ cx.run_until_parked();+ let (placeholder, labels) = accept(30, cx);+ assert_eq!(placeholder.as_deref(), Some("Select a test to run"));+ assert_eq!(labels.len(), 31);+ assert_eq!(labels[30], "t30");+ let (placeholder, labels) = accept(0, cx);+ assert_eq!(placeholder.as_deref(), Some("t30"));+ assert_eq!(labels, ["Run Test", "Debug Test", "Execute Using Profile...", "Reveal in Test Explorer"]);+ let runs: Vec<_> = host.try_iter().filter(|message| message.method == "$runControllerTests").map(|message| message.args[0][0]["testIds"].clone()).collect();+ assert_eq!(runs, [json!(["c\0t30"])]);+}+/// testing.contribution.ts `_revealTestInExplorer`: the test's parents expand and the Testing view opens.#[gpui::test]fn reveal_in_test_explorer_expands_the_tests_parents(cx: &mut TestAppContext) {@@ -132,3 +173,42 @@ fn reveal_in_test_explorer_expands_the_tests_parents(cx: &mut TestAppContext) {});assert_eq!(expanded, ["c", "c\0s"]);}++/// testingExplorerView.ts `revealById`: the revealed row is selected and scrolled to the middle of the tree.+#[gpui::test]+fn reveal_in_test_explorer_selects_and_scrolls_to_the_row(cx: &mut TestAppContext) {+ let ids: Vec<(String, String)> = (0..200).map(|index| (format!("c\0t{index:03}"), format!("t{index:03}"))).collect();+ let tests: Vec<(&str, &str, u32)> = ids.iter().map(|(id, label)| (id.as_str(), label.as_str(), 3)).collect();+ let (workbench, cx, _host) = workbench_with_tests("test-gutter-reveal-scroll", &tests, cx);+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.testing.controllers.insert("c".into(), crate::workbench::testing_service::Controller { label: "c".into(), capabilities: 0 });+ workbench.set_part_hidden(crate::workbench::layout::Part::SideBar, false, cx);+ drop(workbench.execute_command("_revealTestInExplorer", vec![json!("c\0t100")], window, cx));+ });+ for _ in 0..2 {+ cx.run_until_parked();+ cx.update(|window, _| window.refresh());+ }+ cx.run_until_parked();+ let (selected, viewport, scroll_top) = workbench.read_with(cx, |workbench, _| {+ let view = &workbench.testing_view;+ (view.selected.clone(), f32::from(view.scroll.bounds().size.height), -f32::from(view.scroll.offset().y))+ });+ assert_eq!(selected.as_deref(), Some("c\0t100"));+ let focus = |cx: &mut VisualTestContext| cx.update(|window, cx| workbench.read_with(cx, |workbench, _| (workbench.testing_view.filter.focus.is_focused(window), workbench.testing_view.tree_focus.is_focused(window))));+ assert_eq!(focus(cx), (false, false), "a reveal without focus leaves the focus where it was");+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.view.testing", Vec::new(), window, cx)));+ assert_eq!(focus(cx), (true, false), "the opened view focuses its filter box");+ workbench.update_in(cx, |workbench, window, cx| window.focus(&workbench.testing_view.tree_focus.clone(), cx));+ cx.run_until_parked();+ cx.update(|window, _| window.refresh());+ cx.run_until_parked();+ workbench.update_in(cx, |workbench, window, cx| {+ window.blur(cx);+ drop(workbench.execute_command("workbench.view.testing", Vec::new(), window, cx));+ });+ assert_eq!(focus(cx), (false, true), "the tree gets the focus back once it had it last");+ // Row 101: a lone controller's root is not drawn.+ let middle = 22. * 100. - (viewport - 22.) / 2.;+ assert!(viewport > 0. && (scroll_top - middle).abs() < 1., "scroll top {scroll_top}, viewport {viewport}");+}diff --git a/native/crates/app/src/workbench/testing_item_menu.rs b/native/crates/app/src/workbench/testing_item_menu.rsindex 9120512103c..e667f1b956b 100644--- a/native/crates/app/src/workbench/testing_item_menu.rs+++ b/native/crates/app/src/workbench/testing_item_menu.rs@@ -151,7 +151,7 @@ impl Workbench {("testing.isContinuousModeOn", json!(supports_continuous && testing.is_continuous_for(id))),("testing.isParentRunningContinuously", json!(supports_continuous && testing.is_continuous_for_a_parent_of(id))),("testing.supportsContinuousRun", json!(supports_continuous)),- ("testResultOutdated", json!(false)),+ ("testResultOutdated", json!(testing.is_retired(id))),("testResultState", json!(state)),] {context.insert(key.to_owned(), value);diff --git a/native/crates/app/src/workbench/testing_profiles/tests.rs b/native/crates/app/src/workbench/testing_profiles/tests.rsindex f28617d31e8..81f7b447fda 100644--- a/native/crates/app/src/workbench/testing_profiles/tests.rs+++ b/native/crates/app/src/workbench/testing_profiles/tests.rs@@ -52,6 +52,29 @@ fn the_run_group_chevron_keeps_the_view_title_actions_in_the_side_bar(cx: &mut T}}+/// style.css `.monaco-dropdown.active .action-label`: the chevron stays active while its own menu is open.+#[gpui::test]+fn the_run_group_chevron_is_active_while_its_menu_is_open(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with(vec![profile(1, "Fast", GROUP_RUN, true, false), profile(2, "Slow", GROUP_RUN, false, false)], cx);+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.set_part_hidden(crate::workbench::layout::Part::SideBar, false, cx);+ drop(workbench.execute_command("workbench.view.testing", Vec::new(), window, cx));+ });+ cx.run_until_parked();+ cx.update(|window, _| window.refresh());+ cx.run_until_parked();+ let chevron = cx.debug_bounds("codicon-chevron-down").expect("the chevron draws").center();+ cx.simulate_click(chevron, gpui::Modifiers::none());+ cx.run_until_parked();+ assert!(workbench.read_with(cx, |workbench, _| workbench.context_menu.is_some() && workbench.dropdown_open("testing-run-dropdown")));++ workbench.update_in(cx, |workbench, window, cx| {+ workbench.hide_context_menu(window, cx);+ workbench.show_run_group_dropdown(GROUP_RUN, gpui::Bounds::default(), window, cx);+ });+ assert!(!workbench.read_with(cx, |workbench, _| workbench.dropdown_open("testing-run-dropdown")), "a menu shown another way leaves the chevron inactive");+}+/// testingExplorerView.ts `getTestConfigGroupActions` for the run group of a controller with two run profiles,/// one configurable, and a `testing/profiles/context` contribution for the run group only.#[gpui::test]diff --git a/native/crates/app/src/workbench/testing_results.rs b/native/crates/app/src/workbench/testing_results.rsindex 6e77c1abe9b..eec00d5a26a 100644--- a/native/crates/app/src/workbench/testing_results.rs+++ b/native/crates/app/src/workbench/testing_results.rs@@ -401,7 +401,7 @@ impl Workbench {let item = &result.items[test];let capabilities = self.test_capabilities(test);context = self.test_item_context(test, window);- context.insert("testResultOutdated".into(), json!(false));+ context.insert("testResultOutdated".into(), json!(item.retired));context.insert("testResultState".into(), json!(result_state_context(item.own_state)));if !item.item["uri"].is_null() {primary.push(ResultsAction::new("go-to-file", "Go to Test", "vscode.revealTest", vec![json!(test)]));@@ -609,10 +609,11 @@ impl Workbench {pub(super) fn results_floating_action(&self, window: &Window) -> Option<(String, String, Value)> {let Some(InspectSubject::Message { result, task, test, message }) = &self.testing_view.results_subject else { return None };let element = ResultsElement::Message { result: result.clone(), task: *task, test: test.clone(), message: *message };- let value = &self.result_by_id(result)?.items[test].tasks[*task].messages[*message];+ let item = &self.result_by_id(result)?.items[test];+ let value = &item.tasks[*task].messages[*message];let mut context: HashMap<String, Value> = self.key_context(window);context.insert("testMessage".into(), json!(value["contextValue"].as_str().unwrap_or_default()));- context.insert("testResultOutdated".into(), json!(false));+ context.insert("testResultOutdated".into(), json!(item.retired));let first = menu_actions(&self.menus, MenuId::TestMessageContent, &context).into_iter().find_map(|action| match action {MenuAction::Command { id, title, .. } => Some((id, title)),_ => None,diff --git a/native/crates/app/src/workbench/testing_results/tests.rs b/native/crates/app/src/workbench/testing_results/tests.rsindex f776713ae24..90cd408de6c 100644--- a/native/crates/app/src/workbench/testing_results/tests.rs+++ b/native/crates/app/src/workbench/testing_results/tests.rs@@ -104,6 +104,52 @@ fn a_results_rows_menu_shows_its_actions_and_the_contributed_items(cx: &mut Testassert_eq!((args[0]["$mid"].clone(), args[0]["tests"][0]["item"]["extId"].clone(), args[1]["taskId"].clone(), args[1]["resultId"].clone()), (json!(16), json!("c\0f\0b"), json!("t1"), json!("r1")));}+/// mainThreadTesting.ts `$markTestRetired`: the tests under the ids, or all, are retired in every result and their+/// rows and explorer items take `testResultOutdated`.+#[gpui::test]+fn retired_tests_take_test_result_outdated(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with_tests("test-results-retired", TESTS, cx);+ let retire = |test_ids: Value| exthost::session::ForwardedRequest { req: 1, proxy: "MainThreadTesting", method: "$markTestRetired".into(), args: vec![test_ids] };+ let outdated = |workbench: &Workbench, window: &gpui::Window| -> Vec<bool> {+ let row = |test: &str| titles(&workbench.results_actions(&ResultsElement::Test { result: "r1".into(), task: 0, test: test.into() }, window).2).contains(&"Ext Outdated".to_owned());+ vec![row("c\0f\0b"), row("c\0f\0c"), workbench.test_item_context("c\0f\0b", window)["testResultOutdated"] == true, workbench.testing.results[1].items["c\0f\0a"].retired]+ };+ let (partial, all) = workbench.update_in(cx, |workbench, window, cx| {+ add_results(workbench);+ let when = crate::contextkey::Expr::deserialize("testResultOutdated");+ workbench.menus.push(MenuItem { when, ..contributed(MenuId::TestPeekElement, "ext.outdated", "Ext Outdated") });+ drop(workbench.handle_testing_request(retire(json!(["c\0f\0b"])), window, cx));+ let partial = outdated(workbench, window);+ drop(workbench.handle_testing_request(retire(Value::Null), window, cx));+ (partial, outdated(workbench, window))+ });+ assert_eq!(partial, [true, false, true, false]);+ assert_eq!(all, [true, true, true, true]);+ let (failed, retired) = workbench.read_with(cx, |workbench, _| (workbench.color("testing.iconFailed"), workbench.color("testing.iconFailed.retired")));+ assert_eq!((retired.r, retired.g, retired.b), (failed.r, failed.g, failed.b));+ assert!((retired.a - failed.a * 0.7).abs() < 0.01, "{retired:?}");+}++/// testResultsTree.ts `TreeActionsProvider`: a contributed `inline` item draws with its command's icon.+#[gpui::test]+fn a_contributed_inline_result_action_draws_its_icon(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with_tests("test-results-inline-icon", TESTS, cx);+ workbench.update(cx, |workbench, cx| {+ add_results(workbench);+ workbench.menus.push(MenuItem { group: "inline".into(), ..contributed(MenuId::TestPeekElement, "ext.inline", "Ext Inline") });+ workbench.command_icons.insert("ext.inline".into(), crate::menus::CommandIcon::Codicon("beaker".into()));+ workbench.open_panel_view(crate::workbench::testing_view::TEST_RESULTS_VIEW_ID, cx);+ });+ cx.run_until_parked();+ cx.update(|window, _| window.refresh());+ cx.run_until_parked();+ let row = cx.debug_bounds("codicon-pass").expect("the passed test's row draws").center();+ cx.simulate_mouse_move(row, None, gpui::Modifiers::none());+ cx.run_until_parked();+ assert!(cx.debug_bounds("codicon-go-to-file").is_some(), "the hovered row draws its actions");+ assert!(cx.debug_bounds("codicon-beaker").is_some(), "the inline item draws its icon");+}+/// testResultsViewContent.ts `populateFloatingClick`: an opened message shows the first `testing/message/content`/// item, run with the message's `getMessageArgs`; opening a test opens its first message.#[gpui::test]diff --git a/native/crates/app/src/workbench/testing_service.rs b/native/crates/app/src/workbench/testing_service.rsindex 17d346121ea..a21cfdf1158 100644--- a/native/crates/app/src/workbench/testing_service.rs+++ b/native/crates/app/src/workbench/testing_service.rs@@ -5,13 +5,19 @@use std::collections::HashMap;use exthost::session::ForwardedRequest;-use gpui::{Context, Window};+use gpui::{Context, Task, Window};use serde_json::{Value, json};use super::Workbench;use crate::commands::Outcome;+use super::testing_item_menu::HAS_NON_DEFAULT_PROFILE;use crate::testing::{GROUP_COVERAGE, GROUP_DEBUG, GROUP_RUN, Profile, ResultState, TestCollection, TestResult, default_profile};+/// testTypes.ts `TestControllerCapability`.+pub(super) const CAPABILITY_REFRESH: u64 = 1 << 1;+const CAPABILITY_CODE_RELATED_TO_TEST: u64 = 1 << 2;+const CAPABILITY_TEST_RELATED_TO_CODE: u64 = 1 << 3;+/// A `$registerTestController` registration: its label and `TestControllerCapability` bits.#[derive(Clone, Debug)]pub struct Controller {@@ -29,6 +35,9 @@ pub struct TestingService {pub continuous: Vec<super::testing_continuous::ContinuousRun>,/// testExclusions.ts: the hidden tests' ids, in the order they were hidden.pub excluded: Vec<String>,+ /// testServiceImpl.ts `testRefreshCancellations`: dropping a refresh cancels its requests.+ pub refreshes: HashMap<u64, Task<()>>,+ next_refresh: u64,subscribed: bool,next_run: u64,}@@ -43,6 +52,11 @@ impl TestingService {self.results.iter().find(|result| result.items.contains_key(id)).map(|result| result.computed_state(id))}+ /// Whether the newest result with the test has it retired (treeProjection.ts `item.retired`).+ pub fn is_retired(&self, id: &str) -> bool {+ self.results.iter().find(|result| result.items.contains_key(id)).is_some_and(|result| result.items[id].retired)+ }+pub fn is_running(&self) -> bool {self.results.iter().any(|result| result.completed_at.is_none())}@@ -64,6 +78,60 @@ fn now_millis() -> u64 {}impl Workbench {+ /// The workbench's testingContextKeys.ts keys of testServiceImpl.ts, testProfileService.ts `refreshContextKeys`+ /// and testResultService.ts.+ pub(super) fn testing_service_context(&self, context: &mut HashMap<String, Value>) {+ let testing = &self.testing;+ let any_controller = |capability: u64| json!(testing.controllers.values().any(|controller| controller.capabilities & capability != 0));+ let mut profiles = 0;+ for profile in &testing.profiles {+ profiles |= if profiles & profile.group != 0 { HAS_NON_DEFAULT_PROFILE } else { profile.group };+ }+ let active_editor_has_tests = self.editors.active().is_some_and(|editor| testing.collection.tests_in_file(&editor.document().path.to_string_lossy()).next().is_some());+ for (key, value) in [+ ("testing.providerCount", json!(testing.controllers.len())),+ ("testing.canRefresh", any_controller(CAPABILITY_REFRESH)),+ ("testing.canGoToRelatedCode", any_controller(CAPABILITY_CODE_RELATED_TO_TEST)),+ ("testing.canGoToRelatedTest", any_controller(CAPABILITY_TEST_RELATED_TO_CODE)),+ ("testing.isRefreshing", json!(!testing.refreshes.is_empty())),+ ("testing.activeEditorHasTests", json!(active_editor_has_tests)),+ ("testing.hasRunnableTests", json!(profiles & GROUP_RUN != 0)),+ ("testing.hasDebuggableTests", json!(profiles & GROUP_DEBUG != 0)),+ ("testing.hasCoverableTests", json!(profiles & GROUP_COVERAGE != 0)),+ ("testing.hasNonDefaultProfile", json!(profiles & HAS_NON_DEFAULT_PROFILE != 0)),+ // `refreshContextKeys` never sets the `HasConfigurable` bit in 1.147.0.+ ("testing.hasConfigurableProfile", json!(false)),+ ("testing.hasAnyResults", json!(!testing.results.is_empty())),+ ("testing.isRunning", json!(testing.is_running())),+ ] {+ context.insert(key.to_owned(), value);+ }+ }++ /// testServiceImpl.ts `refreshTests` of the controllers, or of all with none: `testing.isRefreshing` holds until+ /// they answer.+ pub(super) fn refresh_tests(&mut self, controllers: &[String], cx: &mut Context<Self>) {+ let all: Vec<String>;+ let controllers = if controllers.is_empty() {+ all = self.testing.controllers.keys().cloned().collect();+ &all+ } else {+ controllers+ };+ let replies: Vec<_> = controllers.iter().map(|id| self.host.call_cancellable("ExtHostTesting", "$refreshTests", vec![json!(id)])).collect();+ let id = self.testing.next_refresh;+ self.testing.next_refresh += 1;+ let task = cx.spawn(async move |this, cx| {+ futures::future::join_all(replies).await;+ let _ = this.update(cx, |workbench, cx| {+ workbench.testing.refreshes.remove(&id);+ cx.notify();+ });+ });+ self.testing.refreshes.insert(id, task);+ cx.notify();+ }+/// MainThreadTesting's methods.pub(crate) fn handle_testing_request(&mut self, request: ForwardedRequest, window: &mut Window, cx: &mut Context<Self>) -> Outcome {let args = request.args;@@ -164,7 +232,13 @@ impl Workbench {"$updateTestStateInRun" => self.apply_test_run_update(&text(0), &json!({ "type": "state", "taskId": arg(1), "testId": arg(2), "state": arg(3), "duration": arg(4) })),"$appendTestMessagesInRun" => self.apply_test_run_update(&text(0), &json!({ "type": "messages", "taskId": arg(1), "testId": arg(2), "messages": arg(3) })),"$appendOutputToRun" => self.apply_test_run_update(&text(0), &json!({ "type": "output", "taskId": arg(1), "output": arg(2), "location": arg(3), "testId": arg(4) })),- "$markTestRetired" => {}+ "$markTestRetired" => {+ if let Ok(test_ids) = serde_json::from_value::<Option<Vec<String>>>(arg(0)) {+ for result in &mut testing.results {+ result.mark_retired(test_ids.as_deref());+ }+ }+ }"$appendCoverage" | "$getCoverageDetails" => return Outcome::Ready(Ok(json!([]))),_ => {}}@@ -349,4 +423,64 @@ mod tests {}assert_eq!(runs, [(true, false, true), (true, true, false)]);}++ /// testingContextKeys.ts's workbench keys: testServiceImpl.ts's controllers and refreshes, testProfileService.ts+ /// `refreshContextKeys`, testResultService.ts; `testing.providerCount > 0` shows the Test Explorer's commands.+ #[gpui::test]+ fn the_workbench_context_has_the_testing_service_keys(cx: &mut TestAppContext) {+ let (workbench, cx, host) = crate::workbench::testing_gutter::tests::workbench_with_tests("testing-context", &[("c\0t", "t", 1)], cx);+ const KEYS: [&str; 13] = [+ "testing.providerCount",+ "testing.canRefresh",+ "testing.canGoToRelatedCode",+ "testing.canGoToRelatedTest",+ "testing.isRefreshing",+ "testing.activeEditorHasTests",+ "testing.hasRunnableTests",+ "testing.hasDebuggableTests",+ "testing.hasCoverableTests",+ "testing.hasNonDefaultProfile",+ "testing.hasConfigurableProfile",+ "testing.hasAnyResults",+ "testing.isRunning",+ ];+ let state = |cx: &mut gpui::VisualTestContext| {+ workbench.update_in(cx, |workbench, window, _| {+ let context = workbench.key_context(window);+ let focus_shown = crate::command_palette::enabled_commands(&workbench.quick_access.menu, &context, &workbench.commands).iter().any(|pick| pick.id == "workbench.view.testing.focus");+ (KEYS.map(|key| context.get(key).cloned().unwrap_or_default()), focus_shown)+ })+ };+ workbench.update(cx, |workbench, _| workbench.set_command_palette_menu(crate::command_palette::menu(&[])));+ let (keys, focus_shown) = state(cx);+ assert_eq!((keys[0].clone(), keys[1].clone(), focus_shown), (json!(0), json!(false), false));++ workbench.update(cx, |workbench, _| {+ workbench.testing.controllers.insert("c".into(), super::Controller { label: "c".into(), capabilities: super::CAPABILITY_REFRESH });+ });+ let (keys, focus_shown) = state(cx);+ assert_eq!(keys, [json!(1), json!(true), json!(false), json!(false), json!(false), json!(true), json!(true), json!(true), json!(false), json!(true), json!(false), json!(false), json!(false)]);+ assert!(focus_shown);++ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("testing.refreshTests", Vec::new(), window, cx)));+ cx.run_until_parked();+ let refreshes: Vec<_> = host.try_iter().filter(|message| message.method == "$refreshTests").collect();+ assert_eq!(refreshes.iter().map(|message| (message.args.clone(), message.cancellable)).collect::<Vec<_>>(), [(vec![json!("c")], true)]);+ assert_eq!(state(cx).0[4], json!(true), "isRefreshing holds until the controller answers");+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("testing.cancelTestRefresh", Vec::new(), window, cx)));+ cx.run_until_parked();+ assert!(refreshes[0].reply.as_ref().unwrap().is_canceled());+ assert_eq!(state(cx).0[4], json!(false));++ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("testing.refreshTests", Vec::new(), window, cx)));+ cx.run_until_parked();+ let refresh = host.try_iter().find(|message| message.method == "$refreshTests").unwrap();+ refresh.reply.unwrap().send(Ok(serde_json::Value::Null)).unwrap();+ cx.run_until_parked();+ assert_eq!(state(cx).0[4], json!(false), "the answer ends the refresh");++ workbench.update(cx, |workbench, _| drop(workbench.testing.create_result(None, json!({}))));+ let (keys, _) = state(cx);+ assert_eq!((keys[11].clone(), keys[12].clone()), (json!(true), json!(true)));+ }}diff --git a/native/crates/app/src/workbench/testing_view.rs b/native/crates/app/src/workbench/testing_view.rsindex a2ea484e83d..cc114d63345 100644--- a/native/crates/app/src/workbench/testing_view.rs+++ b/native/crates/app/src/workbench/testing_view.rs@@ -35,7 +35,16 @@ pub struct TestingView {/// Where the run and the debug group dropdowns' chevrons last painted.pub run_dropdown_bounds: std::rc::Rc<std::cell::Cell<gpui::Bounds<gpui::Pixels>>>,pub debug_dropdown_bounds: std::rc::Rc<std::cell::Cell<gpui::Bounds<gpui::Pixels>>>,+ /// The chevron whose menu showed, with that menu's `context_menus_shown` count.+ pub open_dropdown: Option<(&'static str, usize)>,pub filter: TestingFilter,+ /// The tree's selected (and focused) row, its focus and scroll, and a reveal waiting for the tree's next paint.+ pub selected: Option<String>,+ pub tree_focus: gpui::FocusHandle,+ pub scroll: gpui::ScrollHandle,+ pub reveal_pending: std::cell::Cell<bool>,+ /// testingExplorerView.ts `lastFocusState`: whether the tree, not the filter box, had the focus last.+ pub last_focus_tree: std::cell::Cell<bool>,}impl TestingView {@@ -49,7 +58,13 @@ impl TestingView {continuous_dropdown_bounds: Default::default(),run_dropdown_bounds: Default::default(),debug_dropdown_bounds: Default::default(),+ open_dropdown: None,filter: TestingFilter::new(cx),+ selected: None,+ tree_focus: cx.focus_handle(),+ scroll: gpui::ScrollHandle::new(),+ reveal_pending: std::cell::Cell::new(false),+ last_focus_tree: std::cell::Cell::new(false),}}}@@ -97,8 +112,8 @@ impl Workbench {}pub(super) fn register_testing_commands(&mut self) {- self.commands.register("workbench.view.testing", |workbench, _, _, cx| {- workbench.show_view_container(super::view_locations::TESTING_CONTAINER, cx);+ self.commands.register("workbench.view.testing", |workbench, _, window, cx| {+ workbench.open_testing_view(true, window, cx);Outcome::done()});self.register_testing_continuous_commands();@@ -158,11 +173,16 @@ impl Workbench {workbench.cancel_test_runs();Outcome::done()});- self.commands.register("testing.refreshTests", |workbench, _, _, _| {- let controllers: Vec<String> = workbench.testing.controllers.iter().filter(|(_, controller)| controller.capabilities & 2 != 0).map(|(id, _)| id.clone()).collect();- for controller in controllers {- workbench.host.send("ExtHostTesting", "$refreshTests", vec![json!(controller)]);- }+ self.commands.register("testing.refreshTests", |workbench, args, _, cx| {+ let mut controllers: Vec<String> = super::testing_item_menu::test_ids(&args).iter().map(|id| crate::testing::root_id(id).to_owned()).collect();+ controllers.sort();+ controllers.dedup();+ workbench.refresh_tests(&controllers, cx);+ Outcome::done()+ });+ self.commands.register("testing.cancelTestRefresh", |workbench, _, _, cx| {+ workbench.testing.refreshes.clear();+ cx.notify();Outcome::done()});self.commands.register("testing.clearTestResults", |workbench, _, _, cx| {@@ -241,6 +261,17 @@ impl Workbench {});}+ /// `openView(Testing.ExplorerViewId, focus)`: `TestingExplorerView.focus` gives the focus back to the tree or+ /// the filter box, whichever had it last.+ pub(super) fn open_testing_view(&mut self, focus: bool, window: &mut Window, cx: &mut Context<Self>) {+ self.show_view_container(super::view_locations::TESTING_CONTAINER, cx);+ if focus {+ let view = &self.testing_view;+ let target = if view.last_focus_tree.get() { view.tree_focus.clone() } else { view.filter.focus.clone() };+ window.focus(&target, cx);+ }+ }+/// Whether Testing has a view: the Test Explorer once a controller registers (its `when` is/// `testing.providerCount > 0`), or a view contributed to `test`.pub(super) fn testing_container_shown(&self) -> bool {@@ -251,11 +282,19 @@ impl Workbench {pub(super) fn testing_view_pane(&self, window: &Window, cx: &mut Context<Self>) -> super::view_panes::ViewPane {let running = self.testing.is_running();let has_tests = !self.testing.collection.roots.is_empty();+ if self.testing_view.tree_focus.is_focused(window) {+ self.testing_view.last_focus_tree.set(true);+ } else if self.testing_view.filter.focus.is_focused(window) {+ self.testing_view.last_focus_tree.set(false);+ }let mut actions = div().flex().gap(px(2.)).mr(px(4.));if has_tests {- // testExplorerActions.ts `RefreshTestsAction` shows `when: canRefreshTests`.- if self.testing.controllers.values().any(|controller| controller.capabilities & 2 != 0) {- actions = actions.child(self.search_action("refresh", "testing.refreshTests", true, cx));+ // testExplorerActions.ts `refreshMenus`: Refresh Tests, or Cancel Test Refresh while refreshing.+ if self.testing.controllers.values().any(|controller| controller.capabilities & super::testing_service::CAPABILITY_REFRESH != 0) {+ actions = actions.child(match self.testing.refreshes.is_empty() {+ true => self.search_action("refresh", "testing.refreshTests", true, cx),+ false => self.search_action("stop", "testing.cancelTestRefresh", true, cx),+ });}// `getRunGroupDropdown`: a chevron beside Run Tests and Debug Tests once their group has two profiles.let run_dropdown = self.testing.group_profile_count(GROUP_RUN) > 1;@@ -286,7 +325,7 @@ impl Workbench {}actions = actions.child(self.search_action("collapse-all", "testing.collapseAll", true, cx));}- let mut body = div().id("testing-tree").debug_selector(|| "testing-tree".into()).flex_1().min_h_0().overflow_y_scroll().flex().flex_col();+ let mut body = div().id("testing-tree").debug_selector(|| "testing-tree".into()).flex_1().min_h_0().overflow_y_scroll().track_scroll(&self.testing_view.scroll).track_focus(&self.testing_view.tree_focus).flex().flex_col();if !has_tests {// testing.contribution.ts `registerViewWelcomeContent` of the Test Explorer.body = body.child(div().px(px(20.)).py(px(13.)).text_size(px(13.)).child("No tests have been found in this workspace yet."));@@ -297,7 +336,8 @@ impl Workbench {for id in self.testing_top_level() {self.test_rows(&id, 0, visible.as_ref(), &mut rows, window, cx);}- body = body.children(rows);+ self.reveal_selected_test_row(rows.iter().position(|(id, _)| self.testing_view.selected.as_ref() == Some(id)), rows.len(), window);+ body = body.children(rows.into_iter().map(|(_, row)| row));}let filter = has_tests.then(|| self.testing_filter_box(window, cx));let body = div().flex_1().min_h_0().flex().flex_col().children(filter).child(body).into_any_element();@@ -323,7 +363,7 @@ impl Workbench {}/// The rows of the test and its expanded descendants that the filter leaves `visible` (all of them without one).- fn test_rows(&self, id: &str, depth: usize, visible: Option<&HashSet<String>>, rows: &mut Vec<gpui::AnyElement>, window: &Window, cx: &mut Context<Self>) {+ fn test_rows(&self, id: &str, depth: usize, visible: Option<&HashSet<String>>, rows: &mut Vec<(String, gpui::AnyElement)>, window: &Window, cx: &mut Context<Self>) {if visible.is_some_and(|visible| !visible.contains(id)) {return;}@@ -334,10 +374,22 @@ impl Workbench {let expanded = expandable && !self.testing_view.collapsed.contains(id) && (depth == 0 || self.testing_view.expanded.contains(id));let state = self.testing.state_of(id).unwrap_or_default();let (icon, color) = state_icon(state);- let icon_color = self.foreground_or(color);+ // icons.ts: `.computed-state.retired` takes the state's retired color; Running has none.+ let icon_color = match state != ResultState::Running && self.testing.is_retired(id) {+ true => self.foreground_or(&format!("{color}.retired")),+ false => self.foreground_or(color),+ };let twistie_color = self.foreground_or("icon.foreground");let hover = self.color("list.hoverBackground");let (row_id, toggle_id, menu_id, expand) = (id.to_owned(), id.to_owned(), id.to_owned(), item.expand);+ // listWidget.ts: the focused tree draws the active selection colors and outlines its focused row.+ let selected = self.testing_view.selected.as_deref() == Some(id);+ let tree_focused = self.testing_view.tree_focus.is_focused(window);+ let selection = match tree_focused {+ true => self.color("list.activeSelectionBackground"),+ false => self.color("list.inactiveSelectionBackground"),+ };+ let focus_outline = self.theme.color("list.focusOutline").or(self.theme.color("focusBorder")).filter(|_| selected && tree_focused);let mut actions = div().ml_auto().flex();for action in self.test_row_inline_actions(id, window) {let MenuAction::Command { id: command, title, .. } = action else { continue };@@ -356,9 +408,12 @@ impl Workbench {.pl(px(8. * depth as f32 + 4.)).flex().items_center()+ .relative().rounded(px(4.)).cursor_pointer()- .hover(move |row| row.bg(hover))+ .when(!selected, |row| row.hover(move |row| row.bg(hover)))+ .when(selected, |row| row.bg(selection))+ .when_some(focus_outline, |row, outline| row.child(div().absolute().inset_0().rounded(px(4.)).border_1().border_color(outline))).child(match expandable {true => self.icon(if expanded { "chevron-down" } else { "chevron-right" }, 16., 16., twistie_color),false => div().w(px(16.)).flex_none(),@@ -376,6 +431,8 @@ impl Workbench {workbench.show_test_item_menu(&menu_id, gpui::Bounds::new(event.position, Default::default()), window, cx);}));row = row.on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| {+ workbench.testing_view.selected = Some(row_id.clone());+ window.focus(&workbench.testing_view.tree_focus.clone(), cx);if event.click_count() == 2 {workbench.reveal_test(&row_id, window, cx);return;@@ -401,7 +458,7 @@ impl Workbench {}cx.notify();}));- rows.push(row.into_any_element());+ rows.push((id.to_owned(), row.into_any_element()));if expanded {for child in children {self.test_rows(child, depth + 1, visible, rows, window, cx);@@ -409,15 +466,41 @@ impl Workbench {}}+ /// testingExplorerView.ts `revealById`: `reveal(focusTarget, 0.5)` once the tree has painted with the row.+ fn reveal_selected_test_row(&self, index: Option<usize>, count: usize, window: &Window) {+ if !self.testing_view.reveal_pending.get() {+ return;+ }+ let scroll = &self.testing_view.scroll;+ let viewport = f32::from(scroll.bounds().size.height);+ if viewport <= 0. {+ window.request_animation_frame();+ return;+ }+ self.testing_view.reveal_pending.set(false);+ let Some(index) = index else { return };+ let list = crate::list_tree::ListScroll { count, row_height: ROW_HEIGHT, viewport, scroll_top: -f32::from(scroll.offset().y) };+ if let Some(scroll_top) = crate::list_tree::reveal_scroll_top(list, index, true) {+ scroll.set_offset(gpui::point(px(0.), px(-scroll_top)));+ }+ }+/// testingExplorerView.ts `fillActionBar`: `MenuId.TestItem`'s `inline` group, run on the row as `TestItemContext`.pub(super) fn test_row_inline_actions(&self, id: &str, window: &Window) -> Vec<MenuAction> {menu_group_actions(&self.test_item_menus(), MenuId::TestItem, &self.test_item_context(id, window), |group| group == "inline")}+ /// Whether the menu the chevron `id` showed is still the one open.+ pub(super) fn dropdown_open(&self, id: &str) -> bool {+ self.context_menu.is_some() && self.testing_view.open_dropdown.is_some_and(|(open, shown)| open == id && shown == self.context_menus_shown)+ }+/// dropdownWithPrimaryActionViewItem.ts's chevron beside its primary action, overlapping it by 3px; a press- /// shows `show` anchored at the chevron.+ /// shows `show` anchored at the chevron, which takes `toolbar.activeBackground` while it is open (style.css+ /// `.monaco-dropdown.active .action-label`).fn dropdown_chevron(&self, id: &'static str, bounds: std::rc::Rc<std::cell::Cell<gpui::Bounds<gpui::Pixels>>>, show: fn(&mut Self, gpui::Bounds<gpui::Pixels>, &mut Window, &mut Context<Self>), cx: &mut Context<Self>) -> Div {let hover = self.color("toolbar.hoverBackground");+ let open = self.dropdown_open(id);let chevron = self.icon("chevron-down", 16., 12., self.foreground_or("icon.foreground")).h(px(22.))@@ -427,10 +510,12 @@ impl Workbench {.rounded(px(4.)).cursor_pointer().hover(|action| action.bg(hover))+ .when(open, |action| action.bg(self.color("toolbar.activeBackground"))).child(super::output_view::bounds_tracker(bounds.clone())).on_mouse_down(MouseButton::Left, cx.listener(move |workbench, _: &MouseDownEvent, window, cx| {cx.stop_propagation();show(workbench, bounds.get(), window, cx);+ workbench.testing_view.open_dropdown = Some((id, workbench.context_menus_shown));}));// dropdown.css `margin-left: -3px` as a 13px slot: Taffy sizes a `flex: none` row without the negative margin,// which pushed the view title's actions out of the side bar.@@ -504,7 +589,12 @@ impl Workbench {ResultState::Unset => (if multiple { "run-all" } else { "run" }, "testing.runAction"),state => state_icon(state),};- let color: Rgba = self.foreground_or(color);+ // testingDecorations.ts: `testing-run-glyph retired` when a test of the line is retired; the run icons have no retired color.+ let retired = state != ResultState::Unset && state != ResultState::Running && tests.iter().any(|id| self.testing.is_retired(id));+ let color: Rgba = match retired {+ true => self.foreground_or(&format!("{color}.retired")),+ false => self.foreground_or(color),+ };let click_action = self.setting("testing.defaultGutterClickAction");let index = line as usize - 1;Some(diff --git a/native/crates/app/src/workbench/title_bar_actions.rs b/native/crates/app/src/workbench/title_bar_actions.rsindex 1dcc1dc2030..729282beca4 100644--- a/native/crates/app/src/workbench/title_bar_actions.rs+++ b/native/crates/app/src/workbench/title_bar_actions.rs@@ -10,7 +10,7 @@ use serde_json::{Value, json};use super::Workbench;use crate::commands::Outcome;use crate::contextkey;-use crate::menus::{EDITOR_ACTIONS_TOGGLE, Entry, MenuAction, MenuId, MenuItem, TITLE_BAR_TOGGLES, menu_actions, menu_group_actions};+use crate::menus::{EDITOR_ACTIONS_TOGGLE, Entry, MenuAction, MenuId, MenuItem, TITLE_BAR_TOGGLES, compare_menu_items, menu_actions, menu_group_actions};const REVEAL_PATH_COMMAND: &str = "workbench.action.revealPathInFinder";/// The command center's one item, `CommandCenterCenter`.@@ -74,16 +74,20 @@ impl Workbench {self.show_context_menu_actions(actions, &context, Bounds { origin: pointer, size: Size::default() }, Vec::new(), window, cx);}- /// titlebarPart.ts `globalToolbarMenu`: the buttons of `MenuId.TitleBar`'s `group`, `0_leading` or `navigation`.+ /// titlebarPart.ts `globalToolbarMenu`: the buttons of `MenuId.TitleBar`'s `group`, `0_leading` or `navigation`; a+ /// submenu is a dropdown (`SubmenuEntryActionViewItem`), left out while it has no actions.pub(super) fn title_bar_global_buttons(&self, group: &str, foreground: Rgba, window: &Window, cx: &mut Context<Self>) -> Vec<(String, Stateful<Div>)> {let context = self.key_context(window);+ let mut items: Vec<&MenuItem> = self.menus.iter().filter(|item| item.menu == MenuId::TitleBar && item.group == group && item.when.as_ref().is_none_or(|when| when.evaluate(&context))).collect();+ items.sort_by(|a, b| compare_menu_items(a, b));let mut buttons = Vec::new();- for action in menu_group_actions(&self.menus, MenuId::TitleBar, &context, |item_group| item_group == group) {- // shortcut: a submenu gets no dropdown button, port SubmenuItemActionViewItem when an extension needs one.- let MenuAction::Command { id, title, .. } = action else { continue };- let button = match id.as_str() {- "notifications.toggleList" => self.notifications_title_bar_item(foreground, cx),- _ => self.command_button(&id, title, Vec::new(), foreground, cx),+ for item in items {+ let title = crate::nls::localize_in("TitleBar", &item.title).into_owned();+ let (id, button) = match &item.entry {+ Entry::Command { id, .. } if id == "notifications.toggleList" => (id.clone(), self.notifications_title_bar_item(foreground, cx)),+ Entry::Command { id, .. } => (id.clone(), self.command_button(id, title, Vec::new(), foreground, cx)),+ Entry::Submenu { submenu, .. } if menu_actions(&self.menus, *submenu, &context).is_empty() => continue,+ Entry::Submenu { submenu, .. } => (format!("{submenu:?}"), self.submenu_button(*submenu, self.submenu_icons.get(submenu), title, context.clone(), Vec::new(), foreground, cx)),};let selector = format!("title-bar-action-{id}");buttons.push((id, button.debug_selector(move || selector)));diff --git a/native/crates/app/src/workbench/title_bar_actions/tests.rs b/native/crates/app/src/workbench/title_bar_actions/tests.rsindex 27151d6c9e8..b91d195d7bd 100644--- a/native/crates/app/src/workbench/title_bar_actions/tests.rs+++ b/native/crates/app/src/workbench/title_bar_actions/tests.rs@@ -174,6 +174,10 @@ fn the_title_bar_menu_shows_contributed_global_actions(cx: &mut TestAppContext)let entry = Entry::Command { id: id.into(), precondition: None, toggled: None, alt: None };workbench.menus.push(MenuItem { menu: MenuId::TitleBar, entry, title: id.into(), group: group.into(), order: 1., when: None });}+ let entry = Entry::Command { id: "port.inside".into(), precondition: None, toggled: None, alt: None };+ workbench.menus.push(MenuItem { menu: MenuId::Test, entry, title: "port.inside".into(), group: String::new(), order: 1., when: None });+ let entry = Entry::Submenu { submenu: MenuId::Test, toggled: None };+ workbench.menus.push(MenuItem { menu: MenuId::TitleBar, entry, title: "port.submenu".into(), group: "navigation".into(), order: 2., when: None });});cx.update(|window, _| window.refresh());cx.run_until_parked();@@ -183,6 +187,11 @@ fn the_title_bar_menu_shows_contributed_global_actions(cx: &mut TestAppContext)let nav = left("title-bar-action-port.nav", cx);let bell = left("title-bar-action-notifications.toggleList", cx);assert!(lead < customize && customize < nav && nav < bell, "{lead:?} {customize:?} {nav:?} {bell:?}");+ let submenu = cx.debug_bounds("title-bar-action-Test").expect("the submenu's dropdown");+ assert!(nav < submenu.left() && submenu.left() < bell, "the submenu sorts after port.nav: {submenu:?}");+ cx.simulate_click(submenu.center(), Modifiers::default());+ assert_eq!(menu_titles(&workbench, cx), ["port.inside"], "the dropdown opens the submenu");+ workbench.update(cx, |workbench, _| workbench.context_menu = None);let more = cx.debug_bounds("title-bar-more").expect("the overflow holds port.more");workbench.update_in(cx, |workbench, window, cx| workbench.show_editor_title_menu(more, true, window, cx));assert_eq!(menu_titles(&workbench, cx), ["port.more"]);diff --git a/native/crates/app/src/workbench/tree_view.rs b/native/crates/app/src/workbench/tree_view.rsindex ce44ef80090..ff22b21ec3d 100644--- a/native/crates/app/src/workbench/tree_view.rs+++ b/native/crates/app/src/workbench/tree_view.rs@@ -546,16 +546,20 @@ impl Workbench {let guides = self.tree_guides_in_group(group.clone(), depths, &active);// `.monaco-tl-row` starts at the 4px row margin, its guides 16px further (TreeGuides adds 3px to the inset).let rows: Vec<AnyElement> = tree_rows.into_iter().enumerate().map(|(index, (item, depth))| div().relative().child(self.tree_row(id, tree, item, depth, index, focused, window, cx)).children(guides.row(index, 4.)).into_any_element()).collect();+ // treeView.ts `updateContentAreas`: a message over an empty tree makes the view's node the focus target, outlined.+ let outlined = focused && message.is_some() && rows.is_empty();let body = div().id(id).group(group).track_focus(&focus)+ .relative().size_full().flex().flex_col().overflow_y_scroll().children(message).children(rows)+ .when(outlined, |body| body.child(self.focus_outline().debug_selector(move || format!("tree-view-outline-{id}")))).can_drop(move |dragged, _, _| dragged.downcast_ref::<DraggedTreeItems>().is_some_and(|dragged| accepts_drop(id, controller.as_ref(), dragged))).on_drop(cx.listener(move |workbench, dragged: &DraggedTreeItems, _, cx| workbench.drop_tree_items(id, None, dragged, cx))).into_any_element();diff --git a/native/crates/app/src/workbench/variable_menu.rs b/native/crates/app/src/workbench/variable_menu.rsindex 78fc37eee6a..6fb019ee34c 100644--- a/native/crates/app/src/workbench/variable_menu.rs+++ b/native/crates/app/src/workbench/variable_menu.rs@@ -9,7 +9,7 @@ use serde_json::{Value, json};use super::Workbench;use super::debug_service::answer;-use super::debug_view::Editing;+use super::debug_view::{Editing, VARIABLES_VIEW, WATCH_VIEW};use crate::commands::Outcome;use crate::debug::DataBreakpoint;use crate::debug::session::Variable;@@ -116,8 +116,7 @@ impl Workbench {match row {VariableMenuRow::Variable { menu, session, parent_reference, variable } => {context.insert("debugProtocolVariableMenuContext".into(), json!(""));- // `getVariablesContext`; shortcut: the container is its `variablesReference` only, not the scope's or variable's protocol object.- let args = json!({ "sessionId": session, "container": { "variablesReference": parent_reference }, "variable": protocol_variable(variable) });+ let args = json!({ "sessionId": session, "container": self.variable_container(*menu, session, *parent_reference), "variable": protocol_variable(variable) });(*menu, vec![args])}VariableMenuRow::WatchExpression { id, name } => {@@ -131,6 +130,89 @@ impl Workbench {}}+ /// 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 {+ if menu == MenuId::DebugHoverContext+ && let Some(shown) = self.debug_hover.shown.as_ref().filter(|shown| shown.value.variables_reference == parent_reference)+ {+ let evaluated = self.debug.session(session).is_some_and(|session| session.capabilities["supportsEvaluateForHovers"] == true);+ return if evaluated { json!({ "expression": shown.value.name }) } else { protocol_variable(&shown.value) };+ }+ if let Some(scope) = self.debug.scopes.iter().find(|scope| scope.variables_reference == parent_reference) {+ return json!({ "name": scope.name, "variablesReference": scope.variables_reference, "expensive": scope.expensive });+ }+ let mut siblings = self.debug.children.iter().filter(|((owner, _), _)| owner == session).flat_map(|(_, children)| children);+ siblings.find(|child| child.variables_reference == parent_reference).map_or(Value::Null, protocol_variable)+ }++ /// The Variables or Watch view's element its keybindings act on: the focused view's list focus, or its selection.+ fn focused_tree_element(&self, selection: bool, window: &Window) -> Option<VariableMenuRow> {+ let prefix = match self.focused_movable_view(window)? {+ VARIABLES_VIEW => "scope/",+ WATCH_VIEW => "watch/",+ _ => return None,+ };+ let key = if selection { self.debug_view.selected.as_deref() } else { self.debug_view.focused_row.as_deref() }?;+ key.starts_with(prefix).then(|| self.tree_element(key)).flatten()+ }++ /// The Variables or Watch row of a key as `variables_rows` and `watch_rows` build them; a scope row is none.+ fn tree_element(&self, key: &str) -> Option<VariableMenuRow> {+ let session = self.debug.focus.session.clone().unwrap_or_default();+ for scope in &self.debug.scopes {+ if let Some(path) = key.strip_prefix(&format!("scope/{}/", scope.name))+ && let Some(row) = self.variable_at(&session, scope.variables_reference, path, false)+ {+ return Some(row);+ }+ }+ for expression in &self.debug.model.watch_expressions {+ let watch_key = format!("watch/{}", expression.id);+ if key == watch_key {+ return Some(VariableMenuRow::WatchExpression { id: expression.id.clone(), name: expression.name.clone() });+ }+ if let Some(path) = key.strip_prefix(&format!("{watch_key}/"))+ && let Some(value) = self.debug.watch_values.get(&expression.id)+ && let Some(row) = self.variable_at(&session, value.variables_reference, path, true)+ {+ return Some(row);+ }+ }+ None+ }++ fn variable_at(&self, session: &str, reference: i64, path: &str, watch: bool) -> Option<VariableMenuRow> {+ for variable in self.debug.children.get(&(session.to_owned(), reference))? {+ if path == variable.name {+ let (session, parent_reference, variable) = (session.to_owned(), reference, variable.clone());+ return Some(if watch { VariableMenuRow::WatchVariable { session, parent_reference, variable } } else { VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session, parent_reference, variable } });+ }+ if let Some(rest) = path.strip_prefix(variable.name.as_str()).and_then(|rest| rest.strip_prefix('/'))+ && let Some(row) = self.variable_at(session, variable.variables_reference, rest, watch)+ {+ return Some(row);+ }+ }+ None+ }++ /// The command argument the row's menu passes.+ fn tree_element_argument(&self, row: &VariableMenuRow) -> Value {+ self.variable_menu_context(row, &mut HashMap::new()).1.remove(0)+ }++ /// A watch expression's id from the command's argument, else the Watch view's focused expression.+ fn watch_expression_argument(&self, args: &[Value], window: &Window) -> Option<String> {+ if let Some(arg) = args.first() {+ return arg["watchExpressionId"].as_str().map(str::to_owned);+ }+ match self.focused_tree_element(false, window)? {+ VariableMenuRow::WatchExpression { id, .. } => Some(id),+ _ => None,+ }+ }+/// variablesView.ts `canSetExpressionValue`.pub(super) fn can_set_variable_value(&self, variable: &Variable) -> bool {let Some(session) = self.debug.focused_session() else { return false };@@ -197,13 +279,18 @@ impl Workbench {}pub(super) fn register_variable_menu_commands(&mut self) {- // variablesView.ts SET_VARIABLE_ID on `variableInternalContext`, the row the menu opened on.- // shortcut: without an argument (Enter in the Variables view) it does nothing; the views keep no list focus.+ // variablesView.ts SET_VARIABLE_ID on `variableInternalContext`, the row the menu opened on; debugCommands.ts+ // `debug.setVariable` (Enter) on the Variables view's focused variable.self.commands.register("debug.setVariable", |workbench, args, window, cx| {- if args.is_empty() {- return Outcome::done();- }- if let Some(target) = workbench.debug_view.menu_variable.clone() {+ let target = if args.is_empty() {+ match workbench.focused_tree_element(false, window) {+ Some(VariableMenuRow::Variable { session, parent_reference, variable, .. }) => Some(Editing::Variable { session, parent_reference, name: variable.name, watch: false }),+ _ => None,+ }+ } else {+ workbench.debug_view.menu_variable.clone()+ };+ if let Some(target) = target {workbench.start_debug_view_edit(target, window, cx);}Outcome::done()@@ -236,10 +323,11 @@ impl Workbench {Outcome::done()});}- // variablesView.ts COPY_VALUE_ID: the expression's or variable's value evaluated again, else the shown value.- // shortcut: without an argument (Cmd+C in the views) it copies nothing; the views keep no tree selection to read.+ // variablesView.ts COPY_VALUE_ID: the expression's or variable's value evaluated again, else the shown value;+ // without an argument (Cmd+C) the focused view's selected row.self.commands.register("workbench.debug.viewlet.action.copyValue", |workbench, args, window, cx| {- let Some(arg) = args.first() else { return Outcome::done() };+ let selected = workbench.focused_tree_element(true, window).map(|row| workbench.tree_element_argument(&row));+ let Some(arg) = args.first().or(selected.as_ref()) else { return Outcome::done() };let (element_context, expression, value) = match arg.get("variable") {Some(variable) => ("variables", evaluate_name_or_value(variable), variable["value"].clone()),None if arg.get("watchExpressionId").is_some() => {@@ -277,8 +365,9 @@ impl Workbench {Outcome::done()});// watchExpressionsView.ts CopyExpression and CopyAllWatchExpressions.- self.commands.register("debug.copyWatchExpression", |_, args, _, cx| {- let Some(name) = args.first().and_then(|arg| arg["name"].as_str()) else { return Outcome::done() };+ self.commands.register("debug.copyWatchExpression", |workbench, args, window, cx| {+ let selected = workbench.focused_tree_element(true, window).map(|row| workbench.tree_element_argument(&row));+ let Some(name) = args.first().or(selected.as_ref()).and_then(|arg| arg["name"].as_str()) else { return Outcome::done() };cx.write_to_clipboard(ClipboardItem::new_string(name.to_owned()));Outcome::done()});@@ -290,16 +379,16 @@ impl Workbench {cx.write_to_clipboard(ClipboardItem::new_string(lines.join("\n")));Outcome::done()});- // debugCommands.ts EDIT_EXPRESSION_COMMAND_ID and REMOVE_EXPRESSION_COMMAND_ID on the row's expression.- // shortcut: without an argument (F2, Enter, Cmd+Backspace) they do nothing; the views keep no list focus.+ // debugCommands.ts EDIT_EXPRESSION_COMMAND_ID and REMOVE_EXPRESSION_COMMAND_ID on the row's expression, or+ // without an argument (Enter, Cmd+Backspace) on the Watch view's focused expression.self.commands.register("debug.renameWatchExpression", |workbench, args, window, cx| {- let Some(id) = args.first().and_then(|arg| arg["watchExpressionId"].as_str()) else { return Outcome::done() };- workbench.start_debug_view_edit(super::debug_view::Editing::Watch(id.to_owned()), window, cx);+ let Some(id) = workbench.watch_expression_argument(&args, window) else { return Outcome::done() };+ workbench.start_debug_view_edit(super::debug_view::Editing::Watch(id), window, cx);Outcome::done()});self.commands.register("debug.removeWatchExpression", |workbench, args, window, cx| {- let Some(id) = args.first().and_then(|arg| arg["watchExpressionId"].as_str()) else { return Outcome::done() };- workbench.debug.model.remove_watch_expressions(Some(id));+ let Some(id) = workbench.watch_expression_argument(&args, window) else { return Outcome::done() };+ workbench.debug.model.remove_watch_expressions(Some(&id));workbench.store_debug_model();workbench.refresh_focus(window, cx);Outcome::done()@@ -415,6 +504,24 @@ pub(super) mod tests {assert!(workbench.read_with(cx, |workbench, _| workbench.debug.model.watch_expressions.is_empty()));}+ /// variablesView.ts `getVariablesContext`: `container` is the parent scope's or variable's protocol object.+ #[gpui::test]+ fn a_variable_row_menu_passes_its_parent_as_the_container(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = stopped_session(cx, json!({}));+ workbench.update_in(cx, |workbench, _, _| {+ workbench.debug.scopes = vec![Variable { name: "Local".into(), variables_reference: 4, ..Variable::default() }];+ let parent = Variable { variables_reference: 7, ..variable("obj", "{...}", Some("obj")) };+ workbench.debug.children.insert(("s".into(), 4), vec![parent]);+ });+ let container = |parent_reference: i64, cx: &mut gpui::VisualTestContext| {+ let row = VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session: "s".into(), parent_reference, variable: variable("x", "1", None) };+ workbench.read_with(cx, |workbench, _| workbench.variable_menu_context(&row, &mut HashMap::new()).1[0]["container"].clone())+ };+ assert_eq!(container(4, cx), json!({ "name": "Local", "variablesReference": 4, "expensive": false }));+ let parent = container(7, cx);+ assert_eq!((&parent["name"], &parent["variablesReference"], &parent["evaluateName"]), (&json!("obj"), &json!(7), &json!("obj")));+ }+/// variablesView.ts SET_VARIABLE_ID and `VariablesRenderer.getInputBoxOptions`: Set Value opens the row's input, which/// sends `setVariable` and takes the answer, or keeps the adapter's error as the input's message.#[gpui::test]@@ -495,6 +602,50 @@ pub(super) mod tests {assert_eq!(added, [("d1".to_owned(), "write".to_owned(), "x".to_owned())]);}+ /// debug.contribution.ts COPY_VALUE_ID, watchExpressionsView.ts CopyExpression and debugCommands.ts+ /// `debug.setVariable`, EDIT_EXPRESSION_COMMAND_ID and REMOVE_EXPRESSION_COMMAND_ID from their keys on the clicked row.+ #[gpui::test]+ fn the_variable_and_watch_keys_act_on_the_clicked_row(cx: &mut TestAppContext) {+ let (workbench, cx, host) = stopped_session(cx, json!({ "supportsSetVariable": true }));+ let id = workbench.update(cx, |workbench, cx| {+ workbench.debug.scopes = vec![Variable { name: "Local".into(), variables_reference: 4, ..Variable::default() }];+ workbench.debug.children.insert(("s".into(), 4), vec![variable("x", "1", Some("obj.x"))]);+ workbench.debug_view.expand_first_scope = true;+ workbench.load_keybindings(crate::keybindings::default_keybindings(&[]), std::env::temp_dir().join("vsrustium-variable-keys/keybindings.json"));+ workbench.debug.model.add_watch_expression("a + b");+ workbench.show_debug_view(cx);+ workbench.debug.model.watch_expressions[0].id.clone()+ });+ let click = |key: &'static str, cx: &mut gpui::VisualTestContext| {+ cx.update(|window, cx| drop(window.draw(cx)));+ let row = cx.debug_bounds(key).unwrap_or_else(|| panic!("the {key} row"));+ cx.simulate_click(row.center(), gpui::Modifiers::none());+ };+ let clipboard = |cx: &mut gpui::VisualTestContext| cx.read_from_clipboard().and_then(|item| item.text());+ let stop_editing = |cx: &mut gpui::VisualTestContext| workbench.update(cx, |workbench, _| workbench.debug_view.editing.take());++ click("scope/Local/x", cx);+ cx.run_until_parked();+ host.try_iter().for_each(drop);+ cx.simulate_keystrokes("cmd-c");+ cx.run_until_parked();+ let request = sent_request(&host, "evaluate");+ assert_eq!(request["arguments"], json!({ "expression": "obj.x", "frameId": 9, "context": "variables" }));+ respond(&workbench, cx, &request, true, json!({ "result": "1", "variablesReference": 0 }));+ assert_eq!(clipboard(cx).as_deref(), Some("1"));+ cx.simulate_keystrokes("enter");+ assert_eq!(stop_editing(cx), Some(Editing::Variable { session: "s".into(), parent_reference: 4, name: "x".into(), watch: false }));++ click(format!("watch/{id}").leak(), cx);+ cx.simulate_keystrokes("cmd-alt-c");+ assert_eq!(clipboard(cx).as_deref(), Some("a + b"));+ cx.simulate_keystrokes("enter");+ assert_eq!(stop_editing(cx), Some(Editing::Watch(id)));+ workbench.update_in(cx, |workbench, window, cx| window.focus(&workbench.debug_view.list_focus[WATCH_VIEW], cx));+ cx.simulate_keystrokes("cmd-backspace");+ assert!(workbench.read_with(cx, |workbench, _| workbench.debug.model.watch_expressions.is_empty()));+ }+pub(in crate::workbench) fn stopped_session(cx: &mut TestAppContext, capabilities: Value) -> (gpui::Entity<Workbench>, &mut gpui::VisualTestContext, std::sync::mpsc::Receiver<HostMessage>) {let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();let themes = exthost::scan::scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();diff --git a/native/crates/app/src/workbench/view_containers/tests.rs b/native/crates/app/src/workbench/view_containers/tests.rsindex ff3fe6f6044..ed9ddda093a 100644--- a/native/crates/app/src/workbench/view_containers/tests.rs+++ b/native/crates/app/src/workbench/view_containers/tests.rs@@ -170,6 +170,45 @@ fn a_collapsed_view_stays_collapsed_in_the_panel(cx: &mut TestAppContext) {assert!(workbench.view_pane_expanded(container, "vscode-containers.views.images"));assert!(!workbench.view_pane_expanded(container, "vscode-containers.views.networks"), "\"visibility\": \"collapsed\"");});+ // paneviewlet.css `.pane.horizontal:not(.expanded) > .pane-header > .icon`: only the collapsed strip draws the icon.+ assert!(cx.debug_bounds("pane-icon-vscode-containers.views.networks").is_some());+ assert!(cx.debug_bounds("pane-icon-vscode-containers.views.images").is_none());+}++/// viewDescriptorService.ts `moveViewsWithoutSaving`: a view moved into a side bar container comes in expanded+/// (`ViewVisibilityState.Expand`); a workspace without a stored state for it there, `views.customizations` being per+/// profile, starts it with its descriptor's `collapsed` (viewContainerModel.ts `add`).+#[gpui::test]+fn a_moved_collapsed_view_keeps_its_descriptor_collapsed_in_another_workspace(cx: &mut TestAppContext) {+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let fixtures = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../port/fixtures/extensions/activity-bar-containers");+ let containers = scan_extension(&fixtures.join("vscode-containers"), false).unwrap();+ let networks = "vscode-containers.views.networks";+ let explorer = PaneContainer::Explorer;+ let build = |profile_storage: Option<Arc<Mutex<storage::Storage>>>, cx: &mut gpui::Context<Workbench>| {+ let theme = load_theme(&[scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap()], "Dark Modern").unwrap();+ let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);+ if let Some(profile_storage) = profile_storage {+ workbench.profile_storage = profile_storage;+ }+ workbench.set_tree_views(std::slice::from_ref(&containers));+ workbench+ };++ let (workbench, window) = cx.add_window_view(|_, cx| build(None, cx));+ workbench.update(window, |workbench, cx| {+ workbench.move_view_to_container(networks, crate::workbench::view_locations::EXPLORER_CONTAINER, cx);+ workbench.layout_view_panes(700., cx);+ assert!(workbench.view_pane_expanded(explorer, networks), "a moved view comes in expanded");+ });++ let profile_storage = workbench.read_with(window, |workbench, _| workbench.profile_storage.clone());+ let (workbench, window) = cx.add_window_view(|_, cx| build(Some(profile_storage), cx));+ workbench.update(window, |workbench, cx| {+ workbench.layout_view_panes(700., cx);+ assert!(workbench.panes(explorer).view.as_ref().expect("laid out").ids().contains(&networks));+ assert!(!workbench.view_pane_expanded(explorer, networks), "\"visibility\": \"collapsed\"");+ });}/// testing.contribution.ts: Testing is a `ViewPaneContainer` whose Test Explorer, shown once a controller registers,@@ -242,6 +281,45 @@ fn an_extension_container_is_shown_from_the_command_palette(cx: &mut TestAppContfor label in ["Port Panes: Focus on First View", "Port Panel: Focus on Panel First View", "Testing: Focus on Test Sample View"] {assert_eq!(labels.iter().filter(|shown| *shown == label).count(), 1, "{label}: {labels:?}");}++ // views.ts `registerViewContainer` gives the container an open command, so its item menu opens with Configure Keybinding.+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.closeQuickOpen", Vec::new(), window, cx)));+ workbench.update_in(cx, |workbench, window, cx| workbench.show_composite_context_menu("workbench.view.extension.portPanes", Part::SideBar, gpui::Bounds::default(), window, cx));+ workbench.read_with(cx, |workbench, _| {+ let menu = workbench.context_menu.as_ref().expect("a context menu shows");+ let crate::menus::MenuAction::Command { id, title, .. } = &menu.levels[0].actions[0] else { panic!("a command first") };+ assert_eq!((title.as_str(), id.as_str()), ("Configure Keybinding", "configureKeybinding/workbench.view.extension.portPanes"));+ });+}++/// compositeBar.ts `CompositeDragAndDrop.drop` opens a container dropped on the panel focused (`openComposite(id, true)`):+/// a contributed one on its first view, outlined over its message (treeView.ts `updateContentAreas`), Extensions on+/// its search box.+#[gpui::test]+fn a_container_dropped_on_the_panel_opens_focused(cx: &mut TestAppContext) {+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let theme = load_theme(&[scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap()], "Dark Modern").unwrap();+ let fixture = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../port/fixtures/extensions/contributed-panes");+ let extension = scan_extension(&fixture, false).unwrap();+ let (workbench, cx) = cx.add_window_view(|_, cx| {+ let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);+ workbench.set_tree_views(std::slice::from_ref(&extension));+ workbench+ });+ cx.update(|window, cx| {+ window.activate_window();+ drop(window.draw(cx));+ });+ workbench.update_in(cx, |workbench, window, cx| workbench.drop_composite("workbench.view.extension.portPanes", Part::Panel, None, window, cx));+ cx.update(|window, cx| drop(window.draw(cx)));+ workbench.update_in(cx, |workbench, window, _| assert!(workbench.tree_views.focus["portPanes.first"].is_focused(window)));+ assert!(cx.debug_bounds("tree-view-outline-portPanes.first").is_some());+ assert!(cx.debug_bounds("tree-view-outline-portPanes.second").is_none());++ workbench.update_in(cx, |workbench, window, cx| workbench.drop_composite(crate::workbench::extensions_view::VIEWLET_ID, Part::Panel, None, window, cx));+ workbench.update_in(cx, |workbench, window, _| assert!(workbench.extensions_viewlet.search_focus.is_focused(window)));+ cx.update(|window, cx| drop(window.draw(cx)));+ assert!(cx.debug_bounds("pane-header-workbench.views.extensions.installed").is_some());}/// viewsExtensionPoint.ts `viewsContainers.panel`: the container is a panel tab, not an activity bar item, its viewsdiff --git a/native/crates/app/src/workbench/view_locations.rs b/native/crates/app/src/workbench/view_locations.rsindex e14c7e9641a..96fec2ce77e 100644--- a/native/crates/app/src/workbench/view_locations.rs+++ b/native/crates/app/src/workbench/view_locations.rs@@ -150,6 +150,16 @@ impl Workbench {self.movable_views().into_iter().find(|view| view.id == id)}+ /// viewPane.ts `getIcon`: the view's `containerIcon`, else views.ts `defaultViewIcon`.+ pub(super) fn view_container_icon(&self, id: &str) -> &'static str {+ match self.movable_view(id) {+ Some(view) => view.icon,+ // testing.contribution.ts `containerIcon: testingViewIcon`.+ None if id == super::testing_view::TESTING_VIEW => "beaker",+ None => "window",+ }+ }+/// `getViewContainerByViewId`: the stored container while it exists, else the default one.pub(super) fn view_container(&self, view: &MovableView) -> &'static str {let customizations = self.view_customizations();@@ -269,9 +279,20 @@ impl Workbench {}}self.save_view_customizations(&customizations);+ self.store_moved_view_expanded(view.id, container);cx.notify();}+ /// `moveViewsWithoutSaving` adds the view with `ViewVisibilityState.Expand`: it comes in expanded whatever its+ /// descriptor's `collapsed`, and the container model's `updateState` stores that in the workspace.+ fn store_moved_view_expanded(&self, view: &str, container: &'static str) {+ let storage_id = super::view_visibility::container_storage_id(pane_container(container).key());+ let mut storage = self.workspace_storage.lock().unwrap();+ let mut state = storage.get(&storage_id).and_then(|raw| serde_json::from_str::<Value>(raw).ok()).filter(Value::is_object).unwrap_or_else(|| json!({}));+ state[view]["collapsed"] = json!(false);+ storage.set(&storage_id, state.to_string());+ }+/// `moveViewToLocation`: a new generated container in the part, the view moved into it.pub(super) fn move_view_to_location(&mut self, view: &str, part: Part, cx: &mut Context<Self>) -> &'static str {let id = static_id(&format!("{GENERATED_PREFIX}.{}.{}", location_name(part), crate::debug::generate_uuid()));@@ -463,6 +484,9 @@ impl Workbench {if let Some((id, _)) = self.tree_views.focus.iter().find(|(_, focus)| focus.is_focused(window)) {return Some(static_id(id));}+ if let Some((&id, _)) = self.debug_view.list_focus.iter().find(|(_, focus)| focus.is_focused(window)) {+ return Some(id);+ }let focused_container = if self.problems_focus.is_focused(window) || self.problems.filter_focus.is_focused(window) {Some(super::problems_view::MARKERS_CONTAINER_ID)} else if self.comments.view.tree_focus.is_focused(window) || self.comments.view.filter_focus.is_focused(window) {diff --git a/native/crates/app/src/workbench/view_panes.rs b/native/crates/app/src/workbench/view_panes.rsindex 11cf9b53c44..5012a3da7f3 100644--- a/native/crates/app/src/workbench/view_panes.rs+++ b/native/crates/app/src/workbench/view_panes.rs@@ -123,9 +123,8 @@ fn size_limits(expanded: bool, (minimum, maximum): (f32, f32)) -> (f32, f32) {}impl PaneView {- /// `addPanes` at their minimum sizes, the first layout, then `restoreViewSizes`: each pane at its stored size,- /// else its weight's share (`computeInitialSizes`) of the container's height, which is the pane view's and its- /// bottom gap.+ /// `addPanes` at their minimum sizes, the first layout, then `restoreViewSizes` (`restore_sizes`). The pane view's+ /// height and its bottom gap are the container's.pub fn new(height: f32, bottom_gap: f32, panes: &[(&'static str, bool, Option<f32>)], horizontal: bool) -> Self {let views = panes.iter().map(|&(_, expanded, _)| {let (minimum, maximum) = size_limits(expanded, default_body_limits(horizontal));@@ -133,10 +132,6 @@ impl PaneView {});let mut split = SplitView::new(height, views.collect());split.layout(height);- let total_weight: f32 = panes.iter().map(|&(id, _, _)| view_weight(id)).sum();- for (index, &(id, _, size)) in panes.iter().enumerate() {- split.resize_view(index, size.unwrap_or((height + bottom_gap) * view_weight(id) / total_weight));- }let mut pane_view = PaneView {ids: panes.iter().map(|&(id, _, _)| id).collect(),expanded: panes.iter().map(|&(_, expanded, _)| expanded).collect(),@@ -145,10 +140,21 @@ impl PaneView {split,horizontal,};- pane_view.remember_expanded_sizes();+ let sizes: Vec<_> = panes.iter().map(|&(_, _, size)| size).collect();+ pane_view.restore_sizes(height + bottom_gap, &sizes);pane_view}+ /// viewPaneContainer.ts `restoreViewSizes`: each pane at its stored size, else its weight's share+ /// (`computeInitialSizes`) of the container's height.+ pub fn restore_sizes(&mut self, container_height: f32, stored: &[Option<f32>]) {+ let total_weight: f32 = self.ids.iter().map(|&id| view_weight(id)).sum();+ for (index, &id) in self.ids.iter().enumerate() {+ self.split.resize_view(index, stored[index].unwrap_or(container_height * view_weight(id) / total_weight));+ }+ self.remember_expanded_sizes();+ }+pub fn ids(&self) -> &[&'static str] {&self.ids}@@ -385,7 +391,16 @@ impl Workbench {self.layout_container(PaneContainer::Search, height, vec![(SEARCH_VIEW, false)], cx);let mut debug = self.debug_views();debug.extend(self.shown_views_of("debug").into_iter().map(|id| (id, true)));- self.layout_container(PaneContainer::Debug, height, debug, cx);+ let created = self.layout_container(PaneContainer::Debug, height, debug, cx);+ self.limit_breakpoints_pane();+ // breakpointsView.ts `layoutBody` sets the pane's limits in the first layout, before `restoreViewSizes`.+ if created {+ let bottom_gap = self.pane_view_bottom_gap();+ let panes = self.panes_mut(PaneContainer::Debug);+ let view = panes.view.as_mut().expect("created above");+ let stored: Vec<_> = view.ids().iter().map(|&id| panes.stored_sizes.get(id).copied()).collect();+ view.restore_sizes(height + bottom_gap, &stored);+ }self.layout_extensions_panes(height, cx);// testing.contribution.ts: the Test Explorer's `when` is `testing.providerCount > 0`.let mut testing = if self.testing.controllers.is_empty() { Vec::new() } else { vec![(TESTING_VIEW, false)] };@@ -398,27 +413,34 @@ impl Workbench {}}- /// The container's own views still in it, then the views moved into it.- fn layout_container(&mut self, container: PaneContainer, height: f32, own: Vec<(&'static str, bool)>, cx: &mut Context<Self>) {+ /// The container's own views still in it, then the views moved into it; whether it made a new pane view.+ fn layout_container(&mut self, container: PaneContainer, height: f32, own: Vec<(&'static str, bool)>, cx: &mut Context<Self>) -> bool {let id = container.container_id();// A container moved to a panel is laid out there (panel.rs `panel_container_content`).if self.container_location(id) != super::layout::Part::SideBar {- return;+ return false;}let mut views: Vec<_> = own.into_iter().filter(|(view, _)| self.stays_in(view, id)).collect();views.extend(self.moved_views_in(id));- self.layout_panes(container, height, views, false, cx);+ self.layout_panes(container, height, views, false, cx)}- /// The shown views moved into the container from their own, expanded at first.+ /// The shown views moved into the container from their own, each with its descriptor's `collapsed`+ /// (viewContainerModel.ts `add` without a stored state: a workspace that has not seen the move).pub(super) fn moved_views_in(&self, container: &str) -> Vec<(&'static str, bool)> {let views = self.views_in(container).into_iter().filter(|view| view.default_container != container && self.movable_view_shown(view));- views.map(|view| (view.id, false)).collect()+ views.map(|view| (view.id, self.view_collapsed_by_default(view.id))).collect()+ }++ /// The view descriptor's `collapsed`: Outline and Timeline (outline.contribution.ts, timeline.contribution.ts) and a+ /// contributed `"visibility": "collapsed"` view.+ pub(super) fn view_collapsed_by_default(&self, id: &str) -> bool {+ [OUTLINE_VIEW, TIMELINE_VIEW].contains(&id) || self.contributed_view_collapsed(id)}/// The container's views by id with whether each starts collapsed: viewContainerModel.ts order (stored, else- /// declared) and collapsed state (stored, else the descriptor's `collapsed`).- pub(super) fn layout_panes(&mut self, container: PaneContainer, height: f32, mut descriptors: Vec<(&'static str, bool)>, horizontal: bool, cx: &mut Context<Self>) {+ /// declared) and collapsed state (stored, else the descriptor's `collapsed`); whether it made a new pane view.+ pub(super) fn layout_panes(&mut self, container: PaneContainer, height: f32, mut descriptors: Vec<(&'static str, bool)>, horizontal: bool, cx: &mut Context<Self>) -> bool {let panes = self.panes_mut(container);for &(id, _) in &descriptors {panes.focus.entry(id).or_insert_with(|| cx.focus_handle().tab_stop(true));@@ -426,7 +448,7 @@ impl Workbench {let laid_out = panes.view.as_ref().is_some_and(|view| view.horizontal == horizontal && view.ids().len() == descriptors.len() && descriptors.iter().all(|(id, _)| view.ids().contains(id)));if laid_out {panes.view.as_mut().expect("checked above").layout(height);- return;+ return false;}let storage_id = container_storage_id(container.key());let workspace_state = self.workspace_storage.lock().unwrap().get(&storage_id).and_then(|raw| serde_json::from_str::<Value>(raw).ok()).unwrap_or_default();@@ -446,6 +468,7 @@ impl Workbench {pane_states.push((id, !state["collapsed"].as_bool().unwrap_or(collapsed_by_default), size));}panes.view = Some(PaneView::new(height, bottom_gap, &pane_states, horizontal));+ true}/// viewContainerModel.ts `updateState`: collapsed and size per view in the workspace, order in the profile.@@ -729,14 +752,15 @@ impl Workbench {background,foreground,};- div().flex_none().when(column, |header| header.h_full()).child(+ // paneview.css: a strip narrower than the header and its margins shrinks the header, as a flex item.+ div().flex_none().when(column, |header| header.h_full().flex().flex_shrink(1.).min_w_0()).child(div().id(("pane-header", index)).debug_selector(move || format!("pane-header-{id}")).track_focus(focus).relative().h(px(HEADER_SIZE))- .when(column, |header| header.h_full().w(px(HEADER_SIZE)).flex_col().pt(px(2.)))+ .when(column, |header| header.h_full().w(px(HEADER_SIZE)).min_w_0().flex_col().pt(px(2.)))// paneview.css: .pane-header is cursor: pointer..cursor_pointer().mx(px(4.))@@ -750,9 +774,11 @@ impl Workbench {.when_some(border, |header, border| header.child(div().absolute().top_0().left(px(4.)).right(px(4.)).h(px(1.)).bg(border)))// paneviewlet.css: the view's progress bar 20px into its pane, over the header's bottom..children(self.scoped_progress_bar(id).map(|bar| bar.bottom_0()))- .child(self.icon(chevron, 16., 16., foreground).mx(px(2.)))+ .child(self.icon(chevron, 16., 16., foreground).mx(px(2.)).when(column, |chevron| chevron.flex_none().mb(px(2.))))+ // paneviewlet.css `.pane.horizontal:not(.expanded)`: the view's `containerIcon` under the chevron, no title.+ .when(column, |header| header.child(self.icon(self.view_container_icon(id), 16., 16., foreground).flex_none().mt(px(4.)).debug_selector(move || format!("pane-icon-{id}"))))// paneviewlet.css: the title ellipsizes to make room for the actions ("Gr..." beside Graph's).- .child(div().min_w_0().overflow_hidden().text_ellipsis().whitespace_nowrap().text_size(px(12.)).font_weight(FontWeight::SEMIBOLD).child(title.to_string()))+ .when(!column, |header| header.child(div().min_w_0().overflow_hidden().text_ellipsis().whitespace_nowrap().text_size(px(12.)).font_weight(FontWeight::SEMIBOLD).child(title.to_string())))// paneviewlet.css `.pane-header .description`: 10px after the title, normal weight, only while expanded..when(id == OPEN_EDITORS_VIEW, |header| header.children(self.open_editors_dirty_badge(cx))).when(id == BREAKPOINTS_VIEW, |header| header.children(self.breakpoints_hint()))@@ -961,6 +987,16 @@ mod tests {assert_eq!(view.sizes(), vec![328., 334.]);}+ // The reference's stopped debug-node fixture: three breakpoint rows, Loaded Scripts collapsed.+ #[test]+ fn the_breakpoints_limit_before_the_weights_leaves_variables_the_larger_share() {+ let panes = [(VARIABLES_VIEW, true, None), (WATCH_VIEW, true, None), (CALL_STACK_VIEW, true, None), (LOADED_SCRIPTS_VIEW, false, None), (super::super::debug_view::BREAKPOINTS_VIEW, true, None)];+ let mut view = PaneView::new(662., BOTTOM_GAP, &panes, false);+ view.set_body_limits(4, 66., 66.);+ view.restore_sizes(662. + BOTTOM_GAP, &[None; 5]);+ assert_eq!(view.sizes(), vec![201., 148., 191., 28., 94.]);+ }+#[test]fn a_drop_on_the_lower_half_puts_the_pane_after_the_target() {assert_eq!(drop_index(2, 0, true, 3), Some(1));diff --git a/native/crates/app/src/workbench/view_visibility.rs b/native/crates/app/src/workbench/view_visibility.rsindex 4ba66b803cc..c0f3dd5896d 100644--- a/native/crates/app/src/workbench/view_visibility.rs+++ b/native/crates/app/src/workbench/view_visibility.rs@@ -134,6 +134,12 @@ impl Workbench {let shown: Vec<bool> = entries.iter().map(|entry| !entry.can_toggle || !self.view_hidden(container, entry.id)).collect();let visible_count = shown.iter().filter(|shown| **shown).count();let mut actions = Vec::new();+ // debugViewlet.ts: Debug Console in group `3_toggleRepl`, before the view toggles, which have no group and sort last.+ if self.container_id(container) == super::debug_view::DEBUG_CONTAINER {+ let checked = self.panel_view_visible(super::debug_console::DEBUG_PANEL_ID);+ actions.push(MenuAction::Command { id: "debug.toggleReplIgnoreFocus".into(), title: "Debug Console".into(), enabled: true, checked, alt: None });+ actions.push(MenuAction::Separator);+ }for (entry, &checked) in entries.iter().zip(&shown) {let enabled = entry.can_toggle && (!checked || visible_count > 1);actions.push(MenuAction::Command { id: format!("{}.toggleVisibility", entry.id), title: entry.name.clone(), enabled, checked, alt: None });@@ -149,11 +155,13 @@ impl Workbench {/// The container title's "..." (`MenuId.ViewContainerTitle`): the Views submenu.pub(super) fn view_container_more_actions(&self, container: &'static str, cx: &mut Context<Self>) -> Stateful<Div> {let tracked = self.container_more_bounds.clone();+ let open = self.context_menu.as_ref().is_some_and(|menu| self.container_more_menu == Some((container, menu.shown)));self.icon("ellipsis", 22., 16., self.foreground_or("icon.foreground")).id(gpui::SharedString::from(format!("{container}-more"))).debug_selector(move || format!("{container}-more")).relative().rounded(px(4.))+ .when(open, |action| action.bg(self.color("toolbar.activeBackground"))).cursor_pointer().hover(|action| action.bg(self.color("toolbar.hoverBackground"))).on_mouse_down(MouseButton::Left, cx.listener(move |workbench, _: &MouseDownEvent, window: &mut Window, cx| {@@ -215,6 +223,7 @@ impl Workbench {true => self.show_context_menu_actions(actions, &context, anchor, Vec::new(), window, cx),false => self.show_dropdown_menu_actions(actions, &context, anchor, Vec::new(), window, cx),}+ self.container_more_menu = Some((container, self.context_menus_shown));}}diff --git a/native/crates/app/src/workbench/view_visibility/tests.rs b/native/crates/app/src/workbench/view_visibility/tests.rsindex ce0ba9b6627..2eccfe6ae47 100644--- a/native/crates/app/src/workbench/view_visibility/tests.rs+++ b/native/crates/app/src/workbench/view_visibility/tests.rs@@ -109,6 +109,17 @@ fn the_debug_container_more_actions_list_its_view_container_title_items(cx: &mut}).collect();assert!(commands.contains(&"c.more"), "{menu:?}");assert!(!commands.contains(&"c.explorer"), "{menu:?}");+ // debugViewlet.ts `debug.toggleReplIgnoreFocus` in group `3_toggleRepl` of the Views submenu, before the view toggles.+ let views = menu.iter().find_map(|action| match action {+ MenuAction::Submenu { title, actions, .. } if title == "Views" => Some(actions.clone()),+ _ => None,+ });+ let views = views.expect("the Views submenu");+ assert!(matches!(&views[0], MenuAction::Command { id, title, checked: false, .. } if id == "debug.toggleReplIgnoreFocus" && title == "Debug Console"), "{views:?}");+ assert!(matches!(views[1], MenuAction::Separator), "{views:?}");+ assert!(workbench.read_with(cx, |workbench, _| workbench.container_more_menu.is_some_and(|(container, shown)| container == "debug" && shown == workbench.context_menus_shown)), "the `...` shows pressed");+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("debug.toggleReplIgnoreFocus", Vec::new(), window, cx)));+ assert!(workbench.read_with(cx, |workbench, _| workbench.panel_view_visible(crate::workbench::debug_console::DEBUG_PANEL_ID)));}/// modernUI padding.css and debugViewlet.css: beside the launch picker the title label takes `flex: 1` and the actionsdiff --git a/native/crates/app/src/workbench/workspace_trust_editor.rs b/native/crates/app/src/workbench/workspace_trust_editor.rsindex 3d8851e8381..69b9fbc01bf 100644--- a/native/crates/app/src/workbench/workspace_trust_editor.rs+++ b/native/crates/app/src/workbench/workspace_trust_editor.rs@@ -83,7 +83,7 @@ impl Workbench {}pub(super) fn workspace_trust_editor_widget(&mut self, window: &mut Window, cx: &mut Context<Self>) -> AnyElement {- let header = ModalHeader { icon: "shield", title: "Workspace Trust", json_title: "", json_command: "", resource: None, args: Vec::new() };+ let header = ModalHeader { icon: "shield", title: "Workspace Trust", json_title: "", json_command: "", json_args: Vec::new(), resource: None, args: Vec::new() };let part_focus = self.trust_editor.part_focus.clone().expect("the editor is open");self.modal_editor_part(header, &part_focus, window, cx, |workbench, _, _, window, cx| workbench.workspace_trust_editor_part(window, cx).1)}diff --git a/port/ledger.md b/port/ledger.mdindex 45f627832ac..e99a84f6429 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -23,12 +23,12 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,| 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 | 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 | in progress | 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 | 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 | in progress | 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. || Milestones | M12 files, explorer, search, workspace | done | File system service with watcher (FSEvents) and extension file system providers, Explorer file operations (new, rename, delete to Trash, drag and drop, copy/paste), Seti file icons, numeric name collation, workspace trust, multi-root `.code-workspace`, recent workspaces, text search through ripgrep, search view and search editor, bulk edits, local history, opener and URL handling. Open gaps: the gaps column of its unit rows. | api-tests `workspace.test`, `workspace.fs.test`, `workspace.event.test`, `workspace.tasks` excluded, and the api-workspace suite pass as in the reference; pixel-check folder window with Seti icons (reference captured without `workbench.iconTheme: null`); `cargo test -p app` sorting test with `file9`/`file10`. |-| Milestones | M13 language features | in progress | Everything `MainThreadLanguageFeatures` registers, drawn by the native editor: completion, hover, signature help, code actions and lightbulb, code lens, inlay hints, go to definition and peek, references, rename, formatting, document symbols and Outline, semantic tokens, semantic word highlight, links, color picker, linked editing, snippets, call and type hierarchy, inline completions from extensions; diagnostics with squiggles and the Problems panel; comments threads; Emmet; the language status item. Open gaps: the gaps column of its unit rows. | api-tests `languages.test`, `languagefeatures.test`-family and `comments` cases pass as in the reference; with `src/main.ts` open TypeScript completion, hover, go to definition and a diagnostic squiggle work (pixel-check window with a squiggle and the suggest widget). |-| Milestones | M14 source control and diff | in progress | SCM view and input box, quick diff gutter, the diff editor (side by side and inline), multi-file diff, merge editor and merge-conflict decorations, timeline, the git, git-base and github extensions fully working (no sign-in: github features that need a token stay off). Open gaps: the gaps column of its unit rows. | api-tests SCM cases pass as in the reference; with the fixture copied into a git repository the SCM view lists a changed file and opening it shows the diff (pixel-check window). |+| Milestones | M13 language features | done | Everything `MainThreadLanguageFeatures` registers, drawn by the native editor: completion, hover, signature help, code actions and lightbulb, code lens, inlay hints, go to definition and peek, references, rename, formatting, document symbols and Outline, semantic tokens, semantic word highlight, links, color picker, linked editing, snippets, call and type hierarchy, inline completions from extensions; diagnostics with squiggles and the Problems panel; comments threads; Emmet; the language status item. Open gaps: the gaps column of its unit rows. | api-tests `languages.test`, `languagefeatures.test`-family and `comments` cases pass as in the reference; with `src/main.ts` open TypeScript completion, hover, go to definition and a diagnostic squiggle work (pixel-check window with a squiggle and the suggest widget). |+| Milestones | M14 source control and diff | done | SCM view and input box, quick diff gutter, the diff editor (side by side and inline), multi-file diff, merge editor and merge-conflict decorations, timeline, the git, git-base and github extensions fully working (no sign-in: github features that need a token stay off). Open gaps: the gaps column of its unit rows. | api-tests SCM cases pass as in the reference; with the fixture copied into a git repository the SCM view lists a changed file and opening it shows the diff (pixel-check window). || Milestones | M15 terminal, tasks, output | done | Integrated terminal (PTY from Rust, VT parser and renderer in GPUI), shell integration, extension terminals and pseudoterminals, tasks and problem matchers, npm/grunt/gulp/jake task providers, external terminal, Output panel and log viewer. Open gaps: the gaps column of its unit rows. | api-tests `terminal.test`, `terminal.shellIntegration.test` and `workspace.tasks.test` pass as in the reference (run with `SHELL=/bin/bash` as the baseline was); `npm: build` task from the fixture runs in a terminal. || Milestones | M16 debug and testing | in progress | Debug adapter protocol client, launch.json, breakpoints in the gutter, call stack, variables, watch, debug console, JS debugger (`ms-vscode.js-debug`), Test Explorer and test results. Open gaps: the gaps column of its unit rows. | api-tests `debug.test` and testing cases pass as in the reference; a breakpoint in a Node script from the fixture stops and shows variables. || Milestones | M17 webviews and notebooks | in progress | A WKWebView embedded in the GPUI window for webview panels, webview views and custom editors, with the upstream message and resource protocol; Markdown preview, image/media preview, simple browser, editor insets; notebooks (ipynb) with renderers and kernels. Open gaps: the gaps column of its unit rows. | api-tests `webview.test`, `customEditor` and `notebook*.test` cases pass as in the reference; Markdown preview of the fixture README draws next to its source. |@@ -347,7 +347,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| editor/contrib/bracketMatching | src/vs/editor/contrib | M7 | verified | | brackets.rs and editor/bracket_matching.rs: match boxes with the overview ruler lane, `editor.matchBrackets` always/near/never, `editorBracketMatch.foreground` over the pair colors, Go to Bracket (Cmd+Shift+\\, Go menu), Select to Bracket (`selectBrackets` arg), Remove Brackets (Cmd+Alt+Backspace) (cargo test -p app bracket: the 7 tests of bracketMatching.test.ts); an unclosed pair ends where its parse ended (brackets::tests::an_unclosed_pair_ends_where_its_parse_ended) || editor/contrib/caretOperations | src/vs/editor/contrib | M8 | verified | | Move Selected Text Left/Right (palette), Transpose Letters (Ctrl+T): cargo test -p app caret_operations (moveCarretCommand.test.ts); ui-pair notes.txt Ctrl+T and both palette actions || editor/contrib/clipboard | src/vs/editor/contrib | M5 | verified | | Cut, Copy, Paste and Copy with Syntax Highlighting (editor/clipboard.rs, workbench/editor_commands.rs): `editor.emptySelectionClipboard`, `copyWithSyntaxHighlighting` HTML, `multiCursorPaste`, column block copy and paste; ui-pair text and HTML byte-identical with the reference (port/results/clipboard.md); cargo test -p app clipboard 18 passed; Cmd+C/X/V with whole-line copy metadata: cargo test -p app keys_and_typed_text_edit_the_focused_editor_and_reach_the_host |-| editor/contrib/codeAction | src/vs/editor/contrib | M13 | ported | [3 S] code_actions.rs: with the cursor on line 1 of port/fixtures/debug-node/math.test.js the port draws a light bulb over the test run glyph in the glyph margin, where the reference draws none (ui-pair with tests-provider; source not traced, lightBulbWidget.ts moves the bulb off a glyph margin line with other decorations) | workbench/code_actions.rs and the action widget view workbench/action_widget.rs: automatic requests and the light bulb, Cmd+. and the kind commands with auto apply, the grouped menu, the marker hover's Quick Fix..., `_executeCodeActionProvider`: cargo test -p app code_actions. The widget takes the focus, typed keys navigate its list and it hides on blur: cargo test -p app the_action_widget_takes_the_keys_and_hides_on_blur. The marker hover's AI entry and menu actions are removed by decision (port/notes.md "Copilot Chat"). The whole workspace edit applies, through the Refactor Preview for `previewSelectedCodeAction` and edits that need confirmation; ui-pair steps-params-actions.json (port/results/language-features.md): the Cmd+. menu matches |+| editor/contrib/codeAction | src/vs/editor/contrib | M13 | verified | | On line 1 a breakpoint, stack frame or test glyph keeps the light bulb inline (lightBulbWidget.ts `hasDecoration`): cargo test -p app a_glyph_on_line_1_keeps_the_light_bulb_inline. workbench/code_actions.rs and the action widget view workbench/action_widget.rs: automatic requests and the light bulb, Cmd+. and the kind commands with auto apply, the grouped menu, the marker hover's Quick Fix..., `_executeCodeActionProvider`: cargo test -p app code_actions. The widget takes the focus, typed keys navigate its list and it hides on blur: cargo test -p app the_action_widget_takes_the_keys_and_hides_on_blur. The marker hover's AI entry and menu actions are removed by decision (port/notes.md "Copilot Chat"). The whole workspace edit applies, through the Refactor Preview for `previewSelectedCodeAction` and edits that need confirmation; ui-pair steps-params-actions.json (port/results/language-features.md): the Cmd+. menu matches || editor/contrib/codelens | src/vs/editor/contrib | M13 | verified | | workbench/code_lens.rs: lenses in view zones above their lines, resolve in view, commands, `codelens.showLensesInCurrentLine`, `_executeCodeLensProvider`, `CodeLensCache` (code_lens::tests::a_model_shown_again_draws_its_cached_lenses_at_once), `editor.codeLensFontFamily` and the fade in (lenses_take_their_font_setting_and_fade_in_when_resolved), the refresh on focus (the_editor_focus_asks_for_lenses_again): cargo test -p app code_lens view_zones; merge-conflict lenses match the reference (port/results/scm.md); workbench/code_lens.rs: lenses in view zones above their lines, resolve in view, commands, `codelens.showLensesInCurrentLine`, `_executeCodeLensProvider` with cancellable requests: cargo test -p app code_lens view_zones || editor/contrib/colorPicker | src/vs/editor/contrib | M13 | verified | | workbench/color_detector.rs (colorDetector.ts, boxes as injected text, `editor.colorDecorators*`, `editor.defaultColorDecorators`, the 'Document Colors' debounce of language_feature_debounce.rs: color_detector::tests::the_delay_follows_the_providers_answer_time), default_document_colors.rs (defaultDocumentColorsComputer.ts), workbench/color_picker.rs (hover participant and picker widget), workbench/standalone_color_picker.rs (focus: standalone_color_picker::tests::showing_the_picker_again_focuses_it, the_focus_leaving_the_picker_hides_it): cargo test -p app default_document_colors color_picker (defaultDocumentColorProvider.test.ts cases); ui-pair port/fixtures/language-features/steps-color.json (port/results/inlay-hints.md). colorPickerPointerMonitor.test.ts (DOM pointer capture) and colorDetector.test.ts (CSS variables on the editor container) have no counterpart || editor/contrib/comment | src/vs/editor/contrib | M8 | verified | [scheduling L] minimap.rs:87; minimap_view.rs:432; unicode_highlight.rs:63; indentation.rs:43; comment.rs:45; smart_select.rs:292: sticky minimap sampling, worker section headers and unicode highlights, tokenizeIfCheap, the 30 ms smart select yield. Accepted as "Scheduling differences" only with a measured same result and typing on a 50k-line TS file under 16 ms per edit; otherwise class 3. Audit inputs at 5e5b1b0a915. | `editor/comment.rs`: line and block comment commands over a `CommandExecutor` port, Toggle/Add/Remove Line Comment and Toggle Block Comment with their keys, Edit menu rows and palette entries; cargo test -p app editor::comment (lineCommentCommand.test.ts, blockCommentCommand.test.ts) comment_keys menubar; ui-pair Cmd+/ and Shift+Alt+A match the reference (port/notes.md milestone 8) |@@ -369,8 +369,8 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| editor/contrib/hover | src/vs/editor/contrib | M13 | verified | | workbench/content_hover.rs, workbench/content_hover_view.rs, workbench/accessible_view.rs (hoverAccessibleViews.ts): cargo test -p app content_hover; ui-pair hover on src/main.ts. The color picker part is workbench/color_picker.rs, the inlay hint tooltip workbench/inlay_hints.rs || editor/contrib/inPlaceReplace | src/vs/editor/contrib | M8 | verified | | Replace with Previous/Next Value (Shift+Cmd+, and ., palette): number step and value sets of `navigateValueSet`, 350 ms outline in light themes; cargo test -p app editor::in_place_replace (upstream has no test); ui-pair light theme `x = true; y = 41; z = 1.5` from the palette || editor/contrib/indentation | src/vs/editor/contrib | M8 | verified | [scheduling L] minimap.rs:87; minimap_view.rs:432; unicode_highlight.rs:63; indentation.rs:43; comment.rs:45; smart_select.rs:292: sticky minimap sampling, worker section headers and unicode highlights, tokenizeIfCheap, the 30 ms smart select yield. Accepted as "Scheduling differences" only with a measured same result and typing on a 50k-line TS file under 16 ms per edit; otherwise class 3. Audit inputs at 5e5b1b0a915. | indentation actions, trimTrailingWhitespaceCommand.ts, auto-indent on Enter, type and paste: cargo test -p app indentation editor_status editor::auto_indent (cursor.test.ts indent cases, shiftCommand.test.ts, indentation.test.ts; upstream's `test.skip` cases are `#[ignore]`, 13 ignored) |-| editor/contrib/inlayHints | src/vs/editor/contrib | M13 | ported | [3 S] inlay_hints.rs:136: a scroll asks the providers while `editor.inlayHints.enabled` is `off` (inlayHintsController.ts:184 returns before its scroll listener) | workbench/inlay_hints.rs over editor/injected_text.rs (the 'InlayHint' debounce: inlay_hints::tests::the_delay_follows_the_providers_answer_time; off a word a hint attaches after its token's start, `_getRangeAtPosition`: inlay_hints::tests::a_hint_off_a_word_attaches_after_the_start_of_its_token; inlayHintsController.ts: cache, fixed lengths while typing, label parts, links, tooltip resolve, double click edits, `editor.inlayHints.*`, `_executeInlayHintProvider`): cargo test -p app injected_text inlay_hints; ui-pair port/fixtures/language-features/steps-color.json (port/results/inlay-hints.md) |-| editor/contrib/inlineCompletions | src/vs/editor/contrib | M13 | ported | [3 S] inline_completions.rs: `editor.inlineSuggest.showToolbar: always` shows no InlineCompletionsHintsWidget above the ghost text (only the hover's toolbar); [3 S] inline_completions.rs: the hover's toolbar is ~11pt narrower and ~2pt shorter than the reference's, its "..." menu opens right-aligned to the button (reference: left-aligned); [3 S] inline_completions.rs: the char after a mid-line ghost text also anchors the toolbar hover (upstream: only the injected text) | workbench/inline_completions.rs, ghost_text.rs, workbench/suggest_controller.rs, workbench/suggest_widget.rs: cargo test -p app ghost_text inline_completions only_the_answer_with_the_suggest_item_augments_it items_with_the_same_trimmed_edit_cycle_as_one an_item_without_a_range_replaces_up_to_the_line_end the_hover_over_the_ghost_text_shows_the_inline_suggestion_toolbar (computeGhostText, getSecondaryEdits, inlineCompletions, suggestWidgetModel tests); cargo test -p diff lcs_diff; ui-pair port/fixtures/language-features/steps-ghost.json (port/results/inlay-hints.md), port/fixtures/ui-pair/menus/inline-completions-toolbar.json with `ARGS=--extensionDevelopmentPath=port/fixtures/extensions/menus`. Not ported: the telemetry test, the `test.skip` "Active" test, the DOM layout tests; inline edits and next edit suggestions are AI: removed |+| editor/contrib/inlayHints | src/vs/editor/contrib | M13 | verified | | workbench/inlay_hints.rs over editor/injected_text.rs (the 'InlayHint' debounce: inlay_hints::tests::the_delay_follows_the_providers_answer_time; off a word a hint attaches after its token's start, `_getRangeAtPosition`: inlay_hints::tests::a_hint_off_a_word_attaches_after_the_start_of_its_token; inlayHintsController.ts: cache, fixed lengths while typing, label parts, links, tooltip resolve, double click edits, `editor.inlayHints.*`, `_executeInlayHintProvider`): cargo test -p app injected_text inlay_hints; ui-pair port/fixtures/language-features/steps-color.json (port/results/inlay-hints.md); cargo test -p app a_scroll_asks_nothing_while_hints_are_off |+| editor/contrib/inlineCompletions | src/vs/editor/contrib | M13 | verified | | workbench/inline_completions.rs, ghost_text.rs, workbench/suggest_controller.rs, workbench/suggest_widget.rs: cargo test -p app ghost_text inline_completions only_the_answer_with_the_suggest_item_augments_it items_with_the_same_trimmed_edit_cycle_as_one an_item_without_a_range_replaces_up_to_the_line_end the_hover_over_the_ghost_text_shows_the_inline_suggestion_toolbar (computeGhostText, getSecondaryEdits, inlineCompletions, suggestWidgetModel tests); cargo test -p diff lcs_diff; ui-pair port/fixtures/language-features/steps-ghost.json (port/results/inlay-hints.md), port/fixtures/ui-pair/menus/inline-completions-toolbar.json with `ARGS=--extensionDevelopmentPath=port/fixtures/extensions/menus`. Not ported: the telemetry test, the `test.skip` "Active" test, the DOM layout tests; inline edits and next edit suggestions are AI: removed; cargo test -p app the_always_shown_toolbar_sits_above_the_ghost_text the_chars_around_the_ghost_text a_hover_takes_the_char_under_the_mouse || editor/contrib/inlineProgress | src/vs/editor/contrib | M13 | verified | | workbench/inline_progress.rs (inlineProgress.ts): the spinner after 500 ms at the paste or drop position with 1em of room as injected text, its hover, click cancels; the paste falls back to the default paste: cargo test -p app paste_edits (the_paste_progress_makes_room_for_its_spinner); ui-pair d.md paste (no spinner once the provider answers, as in the reference) || editor/contrib/insertFinalNewLine | src/vs/editor/contrib | M8 | verified | | `OpenEditor::insert_final_new_line` in `editor/indentation.rs`, `editor.action.insertFinalNewLine` (writable): cargo test -p app insert_final_new_line; ui-pair notes.txt through the Command Palette || editor/contrib/lineSelection | src/vs/editor/contrib | M8 | verified | | Expand Line Selection (Cmd+L, palette): cargo test -p app expand_line_selection (lineSelection.test.ts); ui-pair notes.txt Cmd+L twice and on the last line |@@ -408,15 +408,15 @@ 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 | ported | [3 S] modal_editor_group.rs:220: a scroll over the Settings modal editor scrolls the text editor below it and not the settings list (GUI, port/notes.md Scroll frame costs), where modalEditorPart.ts's overlay takes the wheel <br> [3 S] modal_editor_group.rs:41: `open_preferences_editor` opens Settings, Keyboard Shortcuts, Profiles and Workspace Trust in the modal group also with `workbench.editor.useModal` `off`, where preferencesService.ts:392 opens them as editor tabs in the active group <br> [3 S] keybindings_editor_view.rs `modal_header`: the built-in `modalEditor/editorTitle` items are not menu entries: the preferences ones are one hardcoded JSON action (`modal_editor_title_action`), editor.contribution.ts `enableInModalMode` items (Previous/Next Change, Reopen as Text) are missing; [3 S] keybindings_editor_view.rs `modal_editor_menu_actions`: header buttons are ~3pt narrower than the reference's, the "..." menu opens right-aligned to the button where the reference's is left-aligned, and the "..." draws no active background while open (ui-pair menus/modal-editor-title.json, shot `more`); [3 S] a submenu contributed to `modalEditor/editorTitle` gets no dropdown button | 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 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] keybindings_editor_view.rs `modal_header`: editor.contribution.ts `enableInModalMode` items (Previous/Next Change, Reopen as Text) are missing; their `when` needs a text or custom text diff editor in the modal part, which only `workbench.editor.useModal` `all` opens there, and the port opens no editor modal for `all` | 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 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 || workbench/parts/sessions | workbench part | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/parts/sidebar | workbench part | M11 | verified | | Explorer and Search; compact activity bar for top and bottom (side_bar.rs) with every container the activity bar shows: built-in, Testing, extensions' `viewsContainers.activitybar` from startup and after an install, and generated ones (cargo test -p app the_top_activity_bar_shows_contributed_containers; it showed the five built-in ones only until then), No Folder Opened welcome in an empty window (empty_view.rs); pixel-check (port/results/pixels.md, milestone 3): chevron and label edge pixels only; ui-pair port/results/layout.md; verified: every pair of port/results/windows.md (milestone 11 verification) and port/results/references-view.md || workbench/parts/statusbar | workbench part | M11 | verified | | status_entries.rs: cargo test -p app a_hovered_status_item_is_outlined_and_its_icons_take_the_hover_foreground a_hovered_extension_entry_s_icons_follow_its_label_color the_status_bar_has_no_remote_indicator editor_status; ui-pair port/fixtures/ui-pair/statusbar-hover.json hc with `PORT_MESSAGES=status`, messages.json (port/results/windows.md, milestone 11 verification). No remote indicator: workbench/contrib/remote removed (port/notes.md) |-| workbench/parts/titlebar | workbench part | M9 | ported | [3 S] workbench.rs title bar: a non-compact editor window's title bar shows no `MenuId.TitleBar` actions (titlebarPart.ts `globalActionsEnabled` is `!isCompact`); [3 S] title_bar_actions.rs `title_bar_global_buttons`: a submenu contributed to `titleBar` gets no dropdown button (SubmenuItemActionViewItem) | cargo test -p app the_title_bar_menu_shows_contributed_global_actions manage_menu title_bar theme::tests; ui-pair `menus/title-bar.json` with port/fixtures/extensions/menus, `new-window.json` (port/results/windows.md); port/results/command-center.md, port/results/manage-menu.md; pixel-check file and titlebar (port/results/pixels.md) |-| workbench/parts/views | workbench part | M11 | verified | | view_panes.rs `PaneContainer`: cargo test -p app view_panes scm_container a_welcome_button_draws_its_label_icons wrapped_lines_keep_their_fractional_line_height a_merged_changes_view_shows_the_views_submenu_in_its_more_actions a_merged_view_without_actions_lists_the_view_toggles_flat; ui-pair port/results/layout.md, port/fixtures/ui-pair/m11/scm-panes.json, port/fixtures/ui-pair/icons/scm-welcome.json, port/results/references-view.md, port/results/windows.md (milestone 11 verification); port/notes.md View panes |+| workbench/parts/titlebar | workbench part | M9 | verified | | cargo test -p app the_title_bar_menu_shows_contributed_global_actions manage_menu title_bar theme::tests; ui-pair `menus/title-bar.json` with port/fixtures/extensions/menus, `new-window.json` (port/results/windows.md); port/results/command-center.md, port/results/manage-menu.md; pixel-check file and titlebar (port/results/pixels.md); cargo test -p app an_editor_windows_title_bar_shows_the_global_actions_until_compact |+| workbench/parts/views | workbench part | M11 | verified | | view_panes.rs `PaneContainer`: cargo test -p app view_panes scm_container a_welcome_button_draws_its_label_icons wrapped_lines_keep_their_fractional_line_height a_merged_changes_view_shows_the_views_submenu_in_its_more_actions a_merged_view_without_actions_lists_the_view_toggles_flat; ui-pair port/results/layout.md, port/fixtures/ui-pair/m11/scm-panes.json, port/fixtures/ui-pair/icons/scm-welcome.json, port/results/references-view.md, port/results/windows.md (milestone 11 verification); port/notes.md View panes || workbench/services/accessibility | workbench service | M19 | verified | | electron-browser accessibilityService.ts over GPUI: screen reader attach follows Electron's `isAccessibilitySupportEnabled` on macOS (VoiceOver, or an assistive app setting AXManualAccessibility or AXEnhancedUserInterface, as cua-driver does; ui-pair screen-reader-detection.json with accessibility support auto shows the prompt in both), the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib; electron-browser accessibilityService.ts over GPUI: screen reader attach follows is_a11y_active, the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib || workbench/services/accounts | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/services/actions | workbench service | M9 | verified | | menus::extension_menus: cargo test -p app menus explorer_actions api_menu_keys_reach_their_menus a_folder_row a_history_item_menu view_container_title the_debug_container_more_actions the_manage_menu_lists_the_extension_context_menu editor_title_run the_comment_editor_actions_and_context_menus_run_their_menus open_merge_editor_resets; ui-pair `menus/view-container-title.json`, `menus/extension-context.json`, `menus/editor-title-run.json` with `--extensionDevelopmentPath=port/fixtures/extensions/menus`, README.md Explorer menu (port/results/contextmenu.md). Removed by decision: issue/reporter, ports/*, statusBar/remoteIndicator and the AI menu ids (port/notes.md:35) |@@ -461,7 +461,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/services/language | workbench service | M7 | verified | | getAssociationByPath with the full glob dialect (languages::tests::file_patterns_take_the_whole_glob_dialect) plus firstLine detection (languages.rs); cargo test -p app languages::tests || workbench/services/languageDetection | workbench service | M13 | verified | | language_detection.rs, workbench/language_detection.rs (@vscode/vscode-languagedetection 1.0.23 in a Bun worker): cargo test -p app language_detection (the worker test runs the real model). No history biases (the regexp model is not in 1.147.0), no telemetry. The reference checkout's worker detects nothing where the port shows Python (port/notes.md milestone 13 finding) || workbench/services/languageStatus | workbench service | M13 | verified | | `$setLanguageStatus` / `$removeLanguageStatus`, statuses matched by selector, ordered by severity, source, id (workbench/language_status.rs): cargo test -p app language_status |-| workbench/services/layout | workbench service | M11 | ported | [3 S] terminal_view.rs:1235: with Tab Focus Mode on, Tab in the terminal goes to the shell, where terminalInstance.ts:1204 leaves it to the browser's Tab order (port/notes.md Toggle Tab Key Moves Focus) <br> [3 S] action_bar.rs:45: an action bar item focused by Tab shows no hover, where the reference shows the command center's and Customize Layout's tooltips on focus, and the activity bar item's focus outline has square corners where the reference's are rounded (ui-pair Tab steps, port/notes.md Toggle Tab Key Moves Focus) <br> [3 L] workbench.rs:591: the Workbench is one GPUI view, so every scroll frame of any list renders and lays out every part again, where upstream's DOM updates only the scrolled list; the side bar, the editor area, the panel, the status bar, the activity bar and the title bar are cached part views (part_view.rs: a list scroll notifies only the view it was painted in, an editor scroll only the editor area's, a size measured while drawing redraws its view after the frame; the status bar gave no measurable change), the secondary side bar still renders with the Workbench; the Explorer's rows are absolutely placed 22px boxes as listView.ts's (workbench.rs Explorer rows; ~70% of the Explorer frame was the taffy layout of its rows in flow); the minimap copies unchanged rows from the last frame (minimap.rs `render_lines`) and the menu bar updates 200 ms after a frame as menubarControl.ts `menuUpdater` does; a folder with a sub-second mtime is cached 100 ms after its last change, not 2 s (explorer.rs `entries`: the Editor's first 1.5 s of frames re-read the fixture's 800-file root on each `key_context` call, port/notes.md Scroll frame costs, the Editor's slow start); `scroll_frame_time` median / p95 (two interleaved runs, the Studio shared): Explorer 2.9 / 3.2 and 2.9 / 3.6 ms (rows in flow: 10.9 / 18.6 and 11.0 / 21.4), Editor 6.9 / 7.7 and 6.9 / 7.5 ms, Settings 1.1 / 1.4 and 1.0 / 1.4 ms, Extensions 1.7 / 2.0 and 1.7 / 1.9 ms, every surface under the 8 ms gate headless (NoopTextSystem). GUI (release app on the Studio host lane with the extension host running, the same folder, a scratch CGEvent probe posting 30px continuous scroll events at about 120 Hz for 4 to 7 s down then up, `Window::draw` timed by a scratch timer; the Studio's accessibility client turns "Screen Reader Optimized" on, and every GUI number includes it): Editor median 8.0 to 8.8 / p95 18.4 to 21.4 ms over four 8 s runs (was 11.0 to 13.1 / 24.5 to 29.6 with the ruler's map rebuilt per frame; cursor on `export`, word highlights on all 20000 lines); Explorer scrolling up 7.8 / 11.3 ms (was 18.6 / 36.4), scrolling down 10.2 / 38.3 ms over 90 frames as it reaches the list's end; Extensions @builtin 5.1 / 7.9 down, 4.9 / 6.6 up (was 11.0 / 30.6 and 5.8 / 8.6). Fixed on the way: an inlay-hint answer, a file decoration answer and a gallery icon notified the Workbench (every part drew again each frame that asked), the cursor blink notified the Workbench every 500 ms, the overview ruler scanned every document highlight per word highlight (80 to 120 ms a frame), and the collapsed Outline and Timeline panes built their bodies (29% of an Explorer frame). The overview ruler reads the highlight kinds off the provider's list when the editor's highlights are that list (document_highlights.rs `word_highlight_ruler_lines`), not a map of 20000 highlights per frame. Left in the Editor's GUI frame (main-thread share): `editor_lines` 20%, background tokenization 12% (still running 30 s after the open), `key_context` 12% (two calls per frame: the root's `welcome_page_frame` (welcome_page.rs:216) builds it on every draw for the walkthroughs' `onContext:` events, where gettingStartedService.ts checks them on `onDidChangeContext`, and the GPUI focus refresh notifies no view, so a skip needs a context change signal; inside it every Explorer row is listed for the focused row's keys at explorer_actions.rs:311 (8%) with `resource_editors` for the focused file (4%), and the `config.*` clone at keyboard.rs:409), taffy `compute_layout` 11%, the minimap 10%, `shape_text` 10%. Explorer's 50 to 250 ms frames with a row's hover not reproduced in the last runs. Settings is not measured in the GUI: it opens as the modal editor, and a scroll over it reaches the text editor below (workbench/parts/editor gap; port/notes.md Scroll frame costs) | workbench/layout.rs, zen_mode.rs, centered_layout.rs, workbench/customize_layout.rs, workbench/panel.rs, workbench/part_navigation.rs: cargo test -p app -- layout part_grid centered_layout zen_mode customize_layout toggling_the_activity_bar maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own f6_walks_the_visible_parts f6_in_an_editor_window_reaches_its_own_status_bar; ui-pair m11/manage-menu.json (port/results/manage-menu.md), layout-positions.json and layout-zen.json with `zenMode.fullScreen` off (port/results/layout.md) |+| workbench/services/layout | workbench service | M11 | ported | [3 S] workbench.rs activity_bar: an unchecked activity bar item keeps `activityBar.inactiveForeground` while focused or hovered, where activityaction.css draws it in `activityBar.foreground`; the activity bar is a cached part view a focus change does not redraw (ui-pair Tab steps, port/notes.md Toggle Tab Key Moves Focus) <br> [3 L] workbench.rs:591: the Workbench is one GPUI view, so every scroll frame of any list renders and lays out every part again, where upstream's DOM updates only the scrolled list; the side bar, the editor area, the panel, the status bar, the activity bar and the title bar are cached part views (part_view.rs: a list scroll notifies only the view it was painted in, an editor scroll only the editor area's, a size measured while drawing redraws its view after the frame; the status bar gave no measurable change), the secondary side bar still renders with the Workbench; the Explorer's rows are absolutely placed 22px boxes as listView.ts's (workbench.rs Explorer rows; ~70% of the Explorer frame was the taffy layout of its rows in flow); the minimap copies unchanged rows from the last frame (minimap.rs `render_lines`) and the menu bar updates 200 ms after a frame as menubarControl.ts `menuUpdater` does; a folder with a sub-second mtime is cached 100 ms after its last change, not 2 s (explorer.rs `entries`: the Editor's first 1.5 s of frames re-read the fixture's 800-file root on each `key_context` call, port/notes.md Scroll frame costs, the Editor's slow start); `scroll_frame_time` median / p95 (two interleaved runs, the Studio shared): Explorer 2.9 / 3.2 and 2.9 / 3.6 ms (rows in flow: 10.9 / 18.6 and 11.0 / 21.4), Editor 6.9 / 7.7 and 6.9 / 7.5 ms, Settings 1.1 / 1.4 and 1.0 / 1.4 ms, Extensions 1.7 / 2.0 and 1.7 / 1.9 ms, every surface under the 8 ms gate headless (NoopTextSystem). GUI (release app on the Studio host lane with the extension host running, the same folder, a scratch CGEvent probe posting 30px continuous scroll events at about 120 Hz for 4 to 7 s down then up, `Window::draw` timed by a scratch timer; the Studio's accessibility client turns "Screen Reader Optimized" on, and every GUI number includes it): Editor median 8.0 to 8.8 / p95 18.4 to 21.4 ms over four 8 s runs (was 11.0 to 13.1 / 24.5 to 29.6 with the ruler's map rebuilt per frame; cursor on `export`, word highlights on all 20000 lines); Explorer scrolling up 7.8 / 11.3 ms (was 18.6 / 36.4), scrolling down 10.2 / 38.3 ms over 90 frames as it reaches the list's end; Extensions @builtin 5.1 / 7.9 down, 4.9 / 6.6 up (was 11.0 / 30.6 and 5.8 / 8.6). Fixed on the way: an inlay-hint answer, a file decoration answer and a gallery icon notified the Workbench (every part drew again each frame that asked), the cursor blink notified the Workbench every 500 ms, the overview ruler scanned every document highlight per word highlight (80 to 120 ms a frame), and the collapsed Outline and Timeline panes built their bodies (29% of an Explorer frame). The overview ruler reads the highlight kinds off the provider's list when the editor's highlights are that list (document_highlights.rs `word_highlight_ruler_lines`), not a map of 20000 highlights per frame. Left in the Editor's GUI frame (main-thread share): `editor_lines` 20%, background tokenization 12% (still running 30 s after the open), `key_context` 12% (two calls per frame: the root's `welcome_page_frame` (welcome_page.rs:216) builds it on every draw for the walkthroughs' `onContext:` events, where gettingStartedService.ts checks them on `onDidChangeContext`, and the GPUI focus refresh notifies no view, so a skip needs a context change signal; inside it every Explorer row is listed for the focused row's keys at explorer_actions.rs:311 (8%) with `resource_editors` for the focused file (4%), and the `config.*` clone at keyboard.rs:409), taffy `compute_layout` 11%, the minimap 10%, `shape_text` 10%. Explorer's 50 to 250 ms frames with a row's hover not reproduced in the last runs. Settings, which opens as the modal editor, is not measured in the GUI (port/notes.md Scroll frame costs) | workbench/layout.rs, zen_mode.rs, centered_layout.rs, workbench/customize_layout.rs, workbench/panel.rs, workbench/part_navigation.rs: cargo test -p app -- layout part_grid centered_layout zen_mode customize_layout toggling_the_activity_bar maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own f6_walks_the_visible_parts f6_in_an_editor_window_reaches_its_own_status_bar; ui-pair m11/manage-menu.json (port/results/manage-menu.md), layout-positions.json and layout-zen.json with `zenMode.fullScreen` off (port/results/layout.md); cargo test -p app in_tab_focus_mode_tab_leaves_the_terminal activity_item hover:: action_bar part_navigation tab_ || workbench/services/lifecycle | workbench service | M11 | verified | | workbench/lifecycle.rs, workbench/unattended_restart.rs, update/unattended_restart.rs, windows_state.rs: cargo test -p app lifecycle backup_tracker unattended_restart update::unattended_restart windows_state blockers_name_the_editor_kind_and_the_window_that_does_not_come_back a_background_job_is_a_child_process_of_the_shell (unattendedRestart, terminalUnattendedRestart, testingUnattendedRestart, unattendedRestartScheduler without its telemetry outcomes, workingCopyBackupTracker tests); ui-pair hot-exit.json `dirty`, `restored` (port/results/windows.md, milestone 11 verification). No phases or onWillShutdown joiners || workbench/services/localTranscription | workbench service | | removed | | no AI or Microsoft services by decision (port/notes.md); API stays inert || workbench/services/localization | workbench service | M18 | verified | | ui-pair port/fixtures/extensions/ui-display-language.json: picking Deutsch installs MS-CEINTL.vscode-language-pack-de with the "Installing Deutsch language support..." progress and asks "Restart VSRustium to switch to Deutsch?"; localeService.ts: argv.json `locale` written and cleared, restart dialog, install of an MS-CEINTL pack: cargo test -p app nls localization; Command Palette titles, categories and descriptions translate by the reference call's module and key (port/tools/ref-commands with ref-nls-clone.ts; cargo test -p app a_palette_title_two_modules), menu bar items, side bar titles and pane headers by the reference's `nlsKeys` per menu, view and container (cargo test -p app menu_bar_items_and_view_titles_resolve_per_scope); other surfaces stay English (port/notes.md) |@@ -510,7 +510,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/services/userDataProfile | workbench service | M10 | verified | | app/src/user_data_profile.rs, workbench/user_data_profile.rs, app/src/profile_template.rs: cargo test -p app workbench::user_data_profile profile_windows_open_in_this_process every_window_sees_a_profile_another_window_creates_and_removes profile_template template_extensions_ask_for_publisher_trust_once; cargo test -p config profile_tests; cargo test -p exthost extension_management. Removed: `createTroubleshootProfile` with contrib/issue; `profileTemplatesUrl` (product.json has none) || workbench/services/userDataSync | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/services/utilityProcess | workbench service | | verified | | no utility process workers: the file watcher worker, the one kept client, is files/src/watcher.rs on an FSEvents thread (platform/files; api-tests `vscode API - workspace-watcher` passes in the milestone 20 whole-suite run); localTranscription is AI, removed (port/notes.md milestone 20) |-| workbench/services/views | workbench service | M11 | ported | [3 S] view_panes.rs:414 `moved_views_in`: a `"visibility": "collapsed"` view moved into another side bar container starts expanded there (viewContainerModel.ts keeps the descriptor's `collapsed`)<br>[3 S] activity_bar_menu.rs:179 `drop_composite`: a container dropped on the panel shows no focus, the reference outlines Port Panes' First pane and the Extensions search box (ui-pair contributed-panes.json "moved", "extensions-moved")<br>[3 S] view_panes.rs collapsed pane strip in the panel: the reference draws the view's icon under the chevron, the port only the chevron (ui-pair contributed-panes.json "moved")<br>[3 S] activity_bar_menu.rs:295 `composite_keybinding_command`: the Port Panes item's menu opens without Configure Keybinding, the reference's with it, though the extension container has no `openCommandActionDescriptor` (ui-pair contributed-panes.json "item-menu") | workbench/view_containers.rs, view_panes.rs, workbench/view_visibility.rs, workbench/view_locations.rs: cargo test -p app an_extension_container_is_shown an_extension_panel_container_is_a_panel_tab view_containers:: tree_view:: view_visibility a_moved_view_is_hidden the_explorer_item_menu an_item_menu_hides the_explorer_item_drags a_dropped_composite an_activity_item_drags_as_its_icon a_composite_drop_leaves_no_hover a_moved_container_tab_shows the_compact_activity_bar_tabs a_collapsed_view_stays_collapsed the_extensions_and_testing_containers; ui-pair port/fixtures/ui-pair/contributed-panes.json with port/fixtures/extensions/contributed-panes (palette, panel, moved, extensions-moved, testing-moved), port/fixtures/ui-pair/m11/move-view.json (port/results/move-view.md), port/results/references-view.md. Ports removed by decision |+| workbench/services/views | workbench service | M11 | verified | | workbench/view_containers.rs, view_panes.rs, workbench/view_visibility.rs, workbench/view_locations.rs: cargo test -p app an_extension_container_is_shown an_extension_panel_container_is_a_panel_tab view_containers:: tree_view:: view_visibility a_moved_view_is_hidden the_explorer_item_menu an_item_menu_hides the_explorer_item_drags a_dropped_composite an_activity_item_drags_as_its_icon a_composite_drop_leaves_no_hover a_moved_container_tab_shows the_compact_activity_bar_tabs a_collapsed_view_stays_collapsed the_extensions_and_testing_containers; ui-pair port/fixtures/ui-pair/contributed-panes.json with port/fixtures/extensions/contributed-panes (palette, panel, moved, extensions-moved, testing-moved), port/fixtures/ui-pair/m11/move-view.json (port/results/move-view.md), port/results/references-view.md. Ports removed by decision; cargo test -p app a_moved_collapsed_view an_extension_container_is_shown a_container_dropped a_collapsed_view_stays_collapsed_in_the_panel || workbench/services/workingCopy | workbench service | M8 | verified | | backups.rs, workbench/backup_tracker.rs, workbench/custom_documents.rs: cargo test -p app untitled lifecycle local_history backup backups:: custom_documents; cargo test -p files operations; FIXTURE=custom-document-tests port/tools/webview-check with port/fixtures/extensions/custom-document-tests 4/4. Notebook working copies: the contrib/notebook row || workbench/services/workspaces | workbench service | M12 | verified | | workspace_trust.rs: WorkspaceTrustManagementService (uriTrustInfo in shared storage, longest trusted parent, empty window memento, parent folder trust) and WorkspaceTrustRequestService: cargo test -p app workspace_trust; workbench/workspace_editing.rs: abstractWorkspaceEditingService.ts addFolders, removeFolders, updateFolders, saveAndEnterWorkspace, enterWorkspace in the same window (stopped and started host, settings, backups, storage, Explorer, title), duplicate workspace: cargo test -p app folders_added_and_removed_in_a_workspace_reach_its_file_the_explorer_settings_and_host adding_a_folder_enters_an_untitled_workspace_in_the_same_window workspace_editing (the Remove Folder picker's ROOT_FOLDER icons, `setProfileForWorkspace`: a_new_workspace_keeps_the_window_profile); ui-pair port/fixtures/ui-pair/m12/workspace-folders.json, verified at port-m12b-verify || workbench/contrib/accessibility | workbench contribution | M19 | verified | | workbench/accessible_view.rs and workbench/accessibility.rs: accessible view and accessibility help (Alt+F2, Alt+F1 with the editor, hover, view help providers, the hover's and a workbench hover's accessible view, Escape from the latter focusing the hover again, a focused contributed tree or webview view's `accessibilityHelpContent`, a webview view the `focusedView` while its webview has the keyboard; Alt+F6, Alt+H, Alt+K, Alt+A, Alt+]/[), notification aria labels with the verbosity hint, unfocused editor dimming, Toggle Screen Reader Accessibility Mode, status entry; cargo test -p app accessib (alt_f1_shows_the_editor_help..., alt_f1_in_a_contributed_view..., alt_f1_in_a_webview_view..., dimming), cargo test -p app content_hover (the hover's accessible view), port/tools/a11y-check reads the help text area (port/notes.md milestone 19) |@@ -527,9 +527,9 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/contrib/codeActions | workbench contribution | M13 | verified | | codeActionsContribution.ts `updateConfigurationSchema`: every provided `source` kind gets its property in `editor.codeActionsOnSave` and `notebook.codeActionsOnSave` (config registry.rs `list_code_actions_on_save`, cargo test -p config code_actions_on_save). The keybindings schema (config json_schema.rs `keybindings_schema`, served at `vscode://schemas/keybindings` with `vscode://schemas/inlineCompletionProviderIdArgs`) adds the extensions' commands and the provided kinds to `editor.action.codeAction`, `refactor` and `sourceAction` args: cargo test -p config json_schema; ui-pair user keybindings.json `editor.action.refactor` with `{}` args: "Missing property \"kind\"." at Ln 3, Col 60 in both (port/results/language-features.md Keybindings schema) || workbench/contrib/codeEditor | workbench contribution | M8 | verified | | workbench/editor_commands.rs, workbench/code_actions/on_save.rs, workbench/large_file.rs, editor/word_wrap.rs, workbench/inspect_tokens.rs, workbench/accessible_view.rs, workbench/quick_access/goto_symbol.rs, workbench/outline_pane.rs, workbench/empty_editor_hint.rs, workbench/empty_editor_hint/actions.rs, workbench/editor_view/diff_editor_view.rs, workbench/configuration_migration.rs: cargo test -p app column_selection_mode multi_cursor_modifier save_participants code_actions a_window_focus_change_runs_the_always_code_actions_on_save overtype_mode large_file the_line_number_menu word_wrap inspect_tokens a_semantic_token_adds_its_table_and_strikes_the_textmate_rule_it_overrides a_line_past_the_tokenization_limit_is_tokenized_for_the_inspector goto_symbol outline_pane empty_editor_hint a_whitespace_only_diff_offers_to_show_whitespace a_diff_stopped_early_offers_to_remove_the_limit configuration_migration the_actions_hint_offers_the_last_picked_editor_first_and_escape_closes_it the_list_fits_the_editor_or_gives_way_to_the_classic_hint; ui-pair notes.txt, wrap.ts, port/fixtures/ui-steps/empty-editor-hint.json, port/fixtures/diff-whitespace/steps.json. Removed by decision: dictation and voice (AI), diffEditorTryout, startDebugTextMate, menuPreventer and selectionClipboard (Linux), displayChangeRemeasureFonts and sleepResumeRepaintMinimap (Electron) || workbench/contrib/commands | workbench contribution | M9 | verified | | runCommands (commands.rs register_run_commands): cargo test -p app commands::, argument checks, spread args, order, stop at a failure; argument errors and the failure notify (cargo test -p app run_commands_argument_errors_notify) |-| workbench/contrib/comments | workbench contribution | M13 | ported | [3 S] comment_node.rs: with a comment in edit, its reactions row sits about 3px left of the reference's (port/results/language-features.md, `steps-comment-menus.json` shot `editing`) | 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) |-| 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 |-| workbench/contrib/debug | workbench contribution | M16 | ported | [3 M] breakpoint_widget.rs `show_glyph_margin_menu`: a right-click on the glyph margin shows only the breakpoint actions, where breakpointEditorContribution.ts leaves it to editorLineNumberMenu.ts `doShow`, and the line-number menu (editor_menus.rs `show_line_number_context_menu`) lacks the `2_debug` group of its gutter actions generator, so a test glyph's menu has no Add Breakpoint, Add Conditional Breakpoint..., Add Logpoint... and Add Triggered Breakpoint... below the testing items (ui-pair right-click on the run glyph of line 2 of port/fixtures/debug-node/math.test.js); the glyph menu also lacks Add Triggered Breakpoint...<br> [3 S] breakpoint_widget.rs:246: a breakpoint on the stopped line draws the full breakpoint circle inside the stack frame outline where debug.contribution.css's `--vscode-icon-debug-stackframe-dot` overlay draws a small dot (ui-pair `debug/call-stack-menu.json` stopped.png, line 5) <br> [3 S] debug: the Run and Debug activity item shows no badge while stopped where the reference shows "1" (ui-pair `debug/call-stack-menu.json` stopped.png; its source not traced) <br> [3 M] variable_menu.rs: no View Binary Data: debug.contribution.ts registers it only in the rows' `inline` group, and the port's Variables, Watch and hover rows have no inline action bar, no `vscode-debug-memory` file system and no hex editor install prompt (variablesView.ts `VIEW_MEMORY_ID`) <br> [3 S] debug status bar: the debug entry reads "Launch server.js" where the reference reads "Launch server.js (debug-node)" (ui-pair `debug/variables-menu.json` watch-menu.png; its source not traced) <br> [3 S] debug: while stopped the panel shows a Problems tab beside Debug Console where the reference shows Debug Console alone (ui-pair `debug/variables-menu.json` watch-menu.png; its source not traced) <br> [3 S] variable_menu.rs: Copy Value, Copy Expression, Edit Expression and Remove Expression from their keys (Cmd+C, Cmd+Alt+C, Enter, Cmd+Backspace in the views) do nothing: the views keep no tree selection to act on <br> [3 S] variable_menu.rs: a Variables row's menu passes `container` as `{ variablesReference }` only, where variablesView.ts `getVariablesContext` passes the scope's or parent variable's protocol object <br> [3 M] debug_visualizers.rs: visualized rows draw only in the Variables view; the Watch view's and the debug hover's expression children keep their plain rows (watchExpressionsView.ts:98, debugHover.ts:142 register `VisualizedVariableRenderer`) <br> [3 S] debug_visualizers.rs `visualizer_icon`: a visualizer whose `iconPath` is a Uri (`iconPath` in extHostDebugService.ts `getIconPathOrClass`) draws an empty button, only `iconClass` codicons draw <br> [3 S] debug_view.rs: while stopped the Variables pane is shorter than the reference's, so Watch starts at y 230 where the reference's starts at y 283 and an expanded Local scope pushes Global under Watch (ui-pair `debug/visualizer.json` local.png; its source not traced) <br> [3 S] lazy variables: the port's side of ui-pair `debug/lazy-variable.json` eye-hover.png, the eye button's "Click to expand" hover over the debug hover, not yet taken (the Studio's GUI lane stopped at a system prompt); a gpui test covers it <br> [3 S] debug_hover.rs: the hover's find widget starts about 20px right of the reference's and is narrower, and a name matching the find draws on a red box where the reference only recolors it (ui-pair `debug/hover-find.json` hover-find.png) <br> [3 S] view_visibility.rs: the Run and Debug container's `...` menu has no "Debug Console" item and separator above the view toggles, and its button shows no pressed background while the menu is open (ui-pair `menus/view-container-title.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] debug_service.rs: `guess_debugger`'s Select Debugger picker has no "More {0} options..." picks of the dynamic configuration providers (debugAdapterManager.ts `getDynamicProviders`), which the port does not have <br> [3 S] debugQuickAccess.ts: the picker has no dynamic configuration providers' `{label}...` picks with the `contributed` description, where the reference lists `Node.js...` (ui-pair `debug/quick-access.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] debug_service.rs: a stop opens the Run and Debug view for any reason, where debugSession.ts opens it only for `reason === 'breakpoint'`: at the `debugger;` of port/fixtures/debug-node/lazy.js the reference stays on the Explorer (ui-pair `debug/lazy-variable.json`) <br> [3 S] debug_view.rs: the Variables and Call Stack rows' twisties sit about 7px left of the reference's and the trees draw no indent guides (ui-pair `debug/visualizer.json` local.png, `debug/call-stack-menu.json` stopped.png) <br> [3 M] debug_editor: the stopped line has no `debug-top-stack-frame-column` inline arrow before the frame's column (callStackEditorContribution.ts `makeStackFrameColumnDecoration`) and no inline breakpoint candidate dots (breakpointEditorContribution.ts, `breakpointLocations` request), and the glyph of a breakpoint the frame stops on draws a red filled shape where the reference draws the yellow outlined stack frame with a small red dot (ui-pair `debug/variables-menu.json`, line 5 of app.js) <br> [3 S] debug_toolbar.rs: the floating toolbar draws at the window's top over the title bar where the reference's sits below it over the editor tabs (ui-pair `debug/variables-menu.json`) <br> [3 S] debug_toolbar.rs: with `debug.toolBarLocation` `commandCenter` the label sits right after the actions where the reference centers it behind a `•` separator (ui-pair `debug/toolbar.json`) | 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; 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/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 |+| 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`) <br> [3 M] debug_console.rs: no Debug Console find: repl.ts `FindReplAction` (`repl.action.find`, the title's `$(search)` at navigation order 15) opens the REPL tree's find widget, where the port's title has no such button (ui-pair `debug/variables-menu.json` watch-menu.png) <br> [3 S] debug_view.rs: the focused frame's Call Stack row draws `list.inactiveSelectionBackground` where the reference's, with js-debug's compact child session, draws none (ui-pair `debug/variables-menu.json` stopped.png; callStackView.ts `updateTreeSelection`, why its selection does not show not traced) <br> [3 M] debug_visualizers.rs: visualized rows draw only in the Variables view; the Watch view's and the debug hover's expression children keep their plain rows (watchExpressionsView.ts:98, debugHover.ts:142 register `VisualizedVariableRenderer`) <br> [3 S] debug_service.rs: `guess_debugger`'s Select Debugger picker has no "More {0} options..." picks of the dynamic configuration providers (debugAdapterManager.ts `getDynamicProviders`), which the port does not have <br> [3 S] debugQuickAccess.ts: the picker has no dynamic configuration providers' `{label}...` picks with the `contributed` description, where the reference lists `Node.js...` (ui-pair `debug/quick-access.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] debug_view.rs: the Variables, Watch, Call Stack, Breakpoints and Loaded Scripts trees draw no indent guides (`workbench.tree.renderIndentGuides`, `tree_guides.rs`; ui-pair `debug/visualizer.json` local.png) <br> [3 M] debug_editor: the stopped line has no `debug-top-stack-frame-column` inline arrow before the frame's column (callStackEditorContribution.ts `makeStackFrameColumnDecoration`) and no inline breakpoint candidate dots (breakpointEditorContribution.ts, `breakpointLocations` request) (ui-pair `debug/variables-menu.json`, line 5 of app.js) | 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; 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/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 |@@ -563,10 +563,10 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/contrib/markers | workbench contribution | M13 | verified | | workbench/diagnostics.rs, workbench/problems_view.rs, workbench/file_decorations.rs, workbench/view_filter.rs, markers_filter.rs, workbench/problems_table.rs, workbench/problems_quick_fix.rs: cargo test -p app problems problems_view problems_table markers_filter problems_decorate_the_file the_debug_console_and_test_results_are_panel_views each_problems_marker_keeps_its_quick_fixes the_focus_outline_follows markers_select_together_and_open_to_the_side the_resource_name_sits_after_the_twistie_at_its_exact_line_height a_problems_marker_gets_its_quick_fixes_once_its_file_opens (markersFilterOptions.test.ts); ui-pair port/fixtures/problems/steps-filter.json and steps-table.json (port/results/problems.md), .vscode/settings.json and e.ts quick fix (port/results/language-features.md) || workbench/contrib/mcp | workbench contribution | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/contrib/mediaPreview | workbench contribution | M17 | verified | | workbench/media_preview.rs, media_preview/codecs.rs: cargo test -p app media_preview media_preview::codecs answers_the_player_page_with_the_file_s_codecs lists_the_editor_types opens_a_startup_image previews_read_git_resources_and_show_git_lfs_pointers_as_a_message an_image_previewed_in_another_group_gets_a_preview_in_the_active_one; `FIXTURE=media-preview-tests port/tools/webview-check` 6/6; ui-pair image, video, audio, editor-type-reopen.json (port/results/webviews.md), media-preview-focus.json. Not done: Copy image, legacy `media-preview` editor migration |-| workbench/contrib/mergeEditor | workbench contribution | M14 | ported | [3 S] merge_editor_view.rs `merge_result_toolbar`: the result title's "..." draws no `toolbar.activeBackground` while its menu is open (ui-pair menus/merge-result-title.json shot `more`) <br> [3 S] merge_editor_view.rs `merge_result_title`: "1 Conflict Remaining" draws about 15% wider than the reference's (shot `merge`) <br> [3 S] the merge editor's tab "Merging: a.txt" lacks the reference's conflict decoration (red label and "!"), its breadcrumbs lack the reference's "Text Editor" switch at the right, and the status bar shows UTF-8 where the reference shows none (shot `merge`) <br> [3 S] merge_editor_view.rs `merge_input_pane`: the inputs' titles lack the reference's "·" between the commit and the description and sit 3px higher (shot `merge`) <br> [3 S] merge_editor.rs: opened from git's Resolve in Merge Editor the result's cursor is on line 4, the reference's on the first conflict's line 1 (status Ln 1, Col 1; shot `merge`) | merge_editor.rs model (mapping, conflict states, accept/combine) and workbench/editor_view/merge_editor_view.rs (input 1/2, result, base view, layouts, gutter checkboxes behind `mergeEditor.showCheckboxes`, base-to-result diff backgrounds, "Comparing with" in base, the result's breadcrumbs, git's Complete Merge in the result's floating menu, `_open.mergeEditor`, dev commands, the inputs as read-only code editors of the group, Toggle Between Inputs, the active range in the last focused input or the result, scroll synchronization): cargo test -p app merge; the result title's `mergeEditor/result/title` toolbar (Reset sorted among the contributed `primary` items, the other groups behind "..."): ui-pair menus/merge-result-title.json, `FOLDER` a repository mid-merge with a conflicted `a.txt`, `FILE=a.txt`, `ARGS=--extensionDevelopmentPath=<repo>/port/fixtures/extensions/menus` |+| workbench/contrib/mergeEditor | workbench contribution | M14 | verified | | merge_editor.rs model (mapping, conflict states, accept/combine) and workbench/editor_view/merge_editor_view.rs (input 1/2, result, base view, layouts, gutter checkboxes behind `mergeEditor.showCheckboxes`, base-to-result diff backgrounds, "Comparing with" in base, the result's breadcrumbs, git's Complete Merge in the result's floating menu, `_open.mergeEditor`, dev commands, the inputs as read-only code editors of the group, Toggle Between Inputs, the active range in the last focused input or the result, scroll synchronization): cargo test -p app merge; the result title's `mergeEditor/result/title` toolbar (Reset sorted among the contributed `primary` items, the other groups behind "..."): ui-pair menus/merge-result-title.json, `FOLDER` a repository mid-merge with a conflicted `a.txt`, `FILE=a.txt`, `ARGS=--extensionDevelopmentPath=<repo>/port/fixtures/extensions/menus`; verified: cargo test -p app open_merge_editor_resets_the_conflict_and_accepts_incoming ("..." active while its menu shows, cursor Ln 1, Col 1, no encoding entry), ui-pair menus/merge-result-title.json with FOLDER a repository mid-merge: shots `merge` and `more` match the reference (counter width, input titles with "·" at the same height, tab decoration, "Text Editor" switch, status bar) || workbench/contrib/meteredConnection | workbench contribution | M19 | verified | | the metered warning status entry and Configure Metered Connection (workbench/power.rs); port/tools/shell-check (port/fixtures/extensions/shell-tests, 6/6); cargo test -p app metered_connection || workbench/contrib/modernUI | workbench contribution | M11 | verified | | the modern layout only: the classic layout (`workbench.experimental.modernUI: false`) is removed by Artur's decision (port/notes.md Modern UI); `window.density.layout` compact and the Manage menu's Layout Density (cargo test -p app -- compact_density layout_density; ui-pair m11/layout-density.json in both densities with SETTINGS `{"window.density.layout": "compact"}`, port/results/layout-density.md) |-| workbench/contrib/multiDiffEditor | workbench contribution | M14 | ported | [3 S] floating_menu.rs `multi_diff_floating_menu`: the `multiDiffEditor/content` toolbar sits 2pt lower than the reference's (ui-pair port/fixtures/ui-pair/menus/multi-diff-content.json) | multi_diff_editor.rs, workbench/editor_view/multi_diff_editor_view.rs, workbench/code_editors.rs: cargo test -p app multi_diff unchanged_bars_drag the_content_menu_floats_over_the_diffs a_file_side_is_a_code_editor every_drawn_file_side; ui-pair port/fixtures/ui-pair/menus/multi-diff-content.json with `FILE=notes.txt`, `steps-multi-diff-edit.json` (matches but for the reference's TypeScript diagnostics; port/notes.md Comments in diff editors) |+| workbench/contrib/multiDiffEditor | workbench contribution | M14 | verified | | multi_diff_editor.rs, workbench/editor_view/multi_diff_editor_view.rs, workbench/code_editors.rs: cargo test -p app multi_diff unchanged_bars_drag the_content_menu_floats_over_the_diffs a_file_side_is_a_code_editor every_drawn_file_side; ui-pair port/fixtures/ui-pair/menus/multi-diff-content.json with `FILE=notes.txt`, `steps-multi-diff-edit.json` (matches but for the reference's TypeScript diagnostics; port/notes.md Comments in diff editors); verified: cargo test -p app the_content_menu_floats_over_the_diffs, ui-pair menus/multi-diff-content.json: the toolbar's rows match the reference's || workbench/contrib/notebook | workbench contribution | M17 | ported | [3 M] notebook_editor: no cell execute toolbar (`notebook/cell/execute`, notebookEditorWidget.ts:138 `cellExecuteToolbar`); kernel_picker.rs: no `notebook/kernelSource` actions (notebookKernelServiceImpl.ts:322); no notebookVariablesView.ts, so no `notebook/variables/context` | notebook.rs, notebook/kernels.rs, notebook/layout.rs, notebook/outline.rs, workbench/notebooks.rs, workbench/notebook_editor.rs, workbench/notebook_editor/outputs.rs, cell_actions.rs, folding.rs, dnd.rs (port/notes.md milestone 17): cargo test -p app -- notebook kernel renderer backup interactive repl outline quick_input explorer list_scroll walkthrough (288/0); cargo test -p app markdown_editor_files_offer notebook::tests::stream_compression a_dirty_notebook_backs_up the_cell_language_picker the_output_toolbar_menu renderers a_notebook_editor_comes_back the_customize_notebook_submenu the_cell_toolbar markdown_headers_fold headings_fold split_points the_toolbar_position a_cell_dragged_by_its_left_column_moves_or_copies_to_the_drop_place markdown_headers_fold_their_sections every_selected_range_moves_to_the_drop_place the_outline_header_collapses_and_expands_the_notebook_s_headers; api-tests `MOCHA_GREP="Notebook|ipynb|Interactive Window|Ensure tabs getter"` 41/10/0 three runs in a row (10 pending are upstream skips); ui-pair m17 notebook-open, -keys-outline, -output-toolbar, -kernel-picker, -restore, -cell-click, -scroll, -toolbars, -find (within 1 device px). Differences left are reference quirks not copied (port/notes.md session m17d) || workbench/contrib/onboarding | workbench contribution | M19 | removed | | the only registered tours are the Agents window ones (src/vs/sessions/contrib/onboardingTours): no AI by decision (port/notes.md) || workbench/contrib/opener | workbench contribution | M12 | verified | | workbench/opener.rs open_folder_link: a link to a workspace folder reveals it in the Explorer; verified at port-m12b-verify: cargo test -p app opener 4/4 |@@ -583,7 +583,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/contrib/remoteTunnel | workbench contribution | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/contrib/replNotebook | workbench contribution | M17 | verified | | repl_notebook.rs, interactive.rs, notebooks.rs: cargo test -p app repl repl_notebook a_repl_backup_opens_a_repl_editor; ui-pair m17/interactive-restart.json and m17/interactive-window.json with replPair.open repl. Not done: the status bar while the REPL input has the focus (reference: `LF` only, then `Spaces: 4 LF Cell 1 of 1`; port: `Ln 1, Col 1 Spaces: 4 LF`) || workbench/contrib/sash | workbench contribution | M11 | verified | | `workbench.sash.size` (editor group sashes 4..20, their highlight 1..8; the part grid's sashes are its 4px gaps) and `workbench.sash.hoverDelay` on every sash (part grid, view panes, editor groups, find widget, keybindings table), three-dot grippers on the part sashes with `workbench.sash.autoHideGrippers` and its delay (part_grid.rs); cargo test -p app part_grid; verified: ui-pair hot-exit.json `sash` vs the reference (port/results/windows.md, milestone 11 verification) |-| workbench/contrib/scm | workbench contribution | M14 | ported | [3 S] workbench/scm_view.rs `scm_resource_row`: a hovered resource row shows no hover, the reference's `<path> • Modified` after its delay (ui-pair Ctrl+Shift+G, hover on a resource row of a git folder with changes)<br>[3 S] workbench/scm_view.rs Changes rows: the group's count badge sits 4px and the resource's decoration letter 2px left of the reference's (same ui-pair) | workbench/scm_view.rs, quick_diff.rs, quick_diff_widget.rs, scm_tree.rs, scm_history.rs, scm_graph_view.rs, scm_graph_view/ref_picker.rs, scm_actions.rs, scm_repositories_view.rs, quick_input.rs `shorten`: cargo test -p app scm a_hovered_row_shows_its_inline_actions the_changes_tree_draws_indent_guides row_context_menus_leave_out_the_inline_group a_folder_row a_folder_collects shorten_cuts same_named_repositories a_subject_draws_its_icons the_repositories_ explorer_mode_ the_repositories_tree_takes_shift_clicks_and_keys escape_and_toggle_selection_leave_the_shown_repositories lone_repository the_shown_repositories_come_back_with_their_sort_key an_inline_submenu_opens_with_the_toolbar_arguments extension_submenus the_repositories_rows_draw_inset_guides_and_more_actions (labels.test.ts posix cases); ui-pair hover on a git folder with changes, m11/scm-folder-menu.json (`hover`, `menu`), m11/scm-graph-refs.json |+| workbench/contrib/scm | workbench contribution | M14 | verified | | workbench/scm_view.rs, quick_diff.rs, quick_diff_widget.rs, scm_tree.rs, scm_history.rs, scm_graph_view.rs, scm_graph_view/ref_picker.rs, scm_actions.rs, scm_repositories_view.rs, quick_input.rs `shorten`: cargo test -p app scm a_hovered_row_shows_its_inline_actions the_changes_tree_draws_indent_guides row_context_menus_leave_out_the_inline_group a_folder_row a_folder_collects shorten_cuts same_named_repositories a_subject_draws_its_icons the_repositories_ explorer_mode_ the_repositories_tree_takes_shift_clicks_and_keys escape_and_toggle_selection_leave_the_shown_repositories lone_repository the_shown_repositories_come_back_with_their_sort_key an_inline_submenu_opens_with_the_toolbar_arguments extension_submenus the_repositories_rows_draw_inset_guides_and_more_actions (labels.test.ts posix cases); ui-pair hover on a git folder with changes, m11/scm-folder-menu.json (`hover`, `menu`), m11/scm-graph-refs.json; verified: cargo test -p app a_changes_row_draws_its_count_and_hovers_its_path, ui-pair Ctrl+Shift+G and a hover on a resource row of a git folder with changes: badge, letters and `<path> • Modified` hover match the reference || workbench/contrib/screenshotTool | workbench contribution | | removed | | Artur: internal infrastructure or developer tool with no 1:1 counterpart in the native port || workbench/contrib/scrollLocking | workbench contribution | M14 | verified | | workbench/scroll_locking.rs: Toggle and Hold Locked Scrolling and the prominent `status.scrollLockingEnabled` entry: cargo test -p app scroll_locking; a locked wheel scroll moves every other visible editor as far from its position when tracked (`onDidEditorPaneScroll`; cargo test -p app a_locked_scroll_moves_every_other_visible_editor); Hold locks while its key is down and unlocks on the key up (keybindingService.ts `enableKeybindingHoldMode`; cargo test -p app a_held_key_locks_scrolling_until_it_goes_up); without a focused element Hold toggles, as the key up reaches the workbench through the focus path || workbench/contrib/search | workbench contribution | M12 | verified | | Search view (workbench/search_view.rs, search_actions.rs) and its model (search_model.rs): cargo test -p app search_model (searchResult, fileMatch and replace tests) and workbench::search_actions (context menu, input history, hover right click, the replace preview opened and updated with the replace string), port/tools/ui-pair frames match the reference in dark, light and hc (port/notes.md milestone 12); anythingQuickAccess.ts file picks: cargo test -p app anything_quick_access quick_open. No notebook or AI results; Find in Folder from the Explorer (cargo test -p app find_in_folder; ui-pair m12/find-in-folder.json with `search.mode` newEditor matches); ui-pair m12/search-replace.json (query, Replace input, preview) matches; the message words at their exact widths, so "2 results in 2 files - Open in editor" fits one line as in the reference (cargo test -p app the_message_words_take_their_exact_width; pair: same box, 408 device px wide) |@@ -600,7 +600,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/contrib/telemetry | workbench contribution | M19 | verified | | the contribution logs to the NullTelemetryService and registers Show Telemetry only when supportsTelemetry, false in the built product: nothing to port; port/tools/telemetry-source-check no endpoint in 18370 shipped files (SELF_TEST finds 9 in the inert packages) || workbench/contrib/terminal | workbench contribution | M15 | verified | | workbench/terminal_view.rs, workbench/terminal_decorations.rs, terminal/marks.rs, terminal/serialize_html.rs, terminal/label.rs: cargo test -p app new_with_profile a_ctrl_d_exit_shows_no_exit_alert terminal::marks serialize_html terminal_decorations hover a_recording_keeps_each_kind_of_event toggle_visibility_writes_the_decorations_setting the_cwd_setting_resolves_its_variables terminal::label terminal_view::tests paths_are_quoted call_operator a_tab_row_is_inset_and_its_label_is_one_line_of_text panel_terminals_revive_in_their_groups_after_a_restart a_terminal_editor_revives_with_its_history_after_a_restart; ui-pair OSC 99, decorations, overview ruler, Copy as HTML, Record Terminal Session, terminal tabs (port/results/terminal.md), m12/folder-terminal.json (but the reference's Ports overflow, removed), m11/task-presentation.json (port/results/manage-menu.md) || workbench/contrib/terminalContrib | workbench contribution | M15 | verified | | terminal/link_parsing.rs, link_computer.rs, workbench/terminal_links.rs, terminal/auto_replies.rs, terminal/search.rs, workbench/terminal_find.rs, terminal/prompt_input.rs, workbench/terminal_suggest.rs, terminal/history.rs, workbench/terminal_quick_access.rs, terminal/sticky_scroll.rs, workbench/terminal_environment.rs, terminal/osc99.rs, terminal/quick_fix.rs, terminal/accessible_buffer.rs, workbench/terminal_initial_hint.rs: cargo test -p app link_ terminal::search prompt_input auto_replies terminal_contrib terminal_links terminal::history sticky_scroll quick_access environment_collection terminal::marks osc99 quick_fix accessible; ui-pair Run Recent Command, `term `, sticky scroll, the initial hint. No counterpart: Show Terminal Texture Atlas, Restart Pty Host. Removed: Copilot CLI, chat and voice (AI), wslRecommendation (Windows) (port/notes.md milestone 15) |-| workbench/contrib/testing | workbench contribution | M16 | ported | [3 M] testing_gutter.rs `test_context_menu_actions`: no Peek Error on a failed test, as testingOutputPeek.ts (`vscode.peekTestError`) is not ported<br>[3 S] testing_gutter.rs `multi_test_context_menu_actions`: no `MAX_TESTS_IN_SUBMENU` (30) cut with its "{0} more tests..." pick (testingDecorations.ts `pickAndRun`)<br>[3 S] testing_gutter.rs `_revealTestInExplorer`: expands the test's parents and opens the view, but the explorer has no selection, so the row is not selected, focused or scrolled to (testExplorerFilterState.ts `reveal`, testingExplorerView.ts)<br>[3 S] testing_view.rs `dropdown_chevron`: the primary action and chevron take no `toolbar.activeBackground` while their dropdown is open (style.css `.monaco-dropdown.active .action-label`)<br>[3 M] testing_view.rs `testing_view_pane`: the view title is not testExplorerActions.ts's: no Show Output (`ShowMostRecentOutputAction`, `navigation`), Collapse All drawn in the title where upstream puts it in the `...` menu (`displayAction`), no `...` menu; opening the view does not focus the filter box, the "No test results yet." line is missing and file roots start expanded (ui-pair with port/fixtures/debug-node)<br>[3 M] testing_continuous.rs `testing_continuous_context`: the workbench context has only `testing.isContinuousModeOn` of testingContextKeys.ts; `testing.providerCount`, `testing.hasConfigurableProfile`, `testing.canRefreshTests`, `testing.hasAnyResults` and the rest are unset, so the Command Palette hides the `testing.providerCount > 0` commands such as Testing: Focus on Test Explorer View<br>[3 M] testing_results.rs `results_tree`: not drawn as a workbench list: the opened row takes `list.inactiveSelectionBackground` where the reference shows the focused selection, a twistie on the task row where the reference has none, no indent guides, no keyboard navigation; content and tree split 1:1 with no sash where the reference opens about 2:1 (ui-pair port/fixtures/debug-node with tests-provider)<br>[3 M] testing_results.rs `results_content`: a message or output is plain text lines, not testResultsOutput.ts's diff, markdown, plain text and terminal peeks; no call stack (`MenuId.TestCallStack`), no `CoverageElement` rows<br>[3 S] testing_results.rs `results_actions`: `testResultOutdated` is always false (no retired results); contributed `inline` items draw as text buttons without their icons | cargo test -p app testing:: testing_filter the_results_tree_shows_tasks_tests_and_messages_as_testresultstree a_results_rows_menu_shows_its_actions_and_the_contributed_items an_opened_message_shows_the_first_message_content_item the_gutter_menu_shows_the_tests_actions_before_the_line_number_items a_line_with_two_tests_shows_run_all_and_a_submenu_per_test reveal_in_test_explorer_expands_the_tests_parents the_run_group_dropdown_lists_its_profiles_and_runs_the_picked_one select_default_profile_stores_the_picked_defaults the_run_group_chevron_keeps_the_view_title_actions_in_the_side_bar runs_from_the_explorer_exclude_the_tests_the_filter_hides a_hidden_test_leaves_the_tree_and_runs_until_it_is_unhidden a_test_row_shows_the_test_item_menu_s_inline_group a_test_rows_context_menu_shows_and_runs_the_test_item_actions children_sort_by_line_then_by_file_name_order the_view_title_dropdown_starts_and_stops_one_profile_of_several continuous_run_using_picks_from_the_tests_controller_only a_continuous_run_holds_one_cancellable_request_per_profile_until_it_stops the_testing_item_spins a_test_run_waits_for_workspace_trust_and_completes_when_it_is_refused; ui-pair port/fixtures/debug-node with tests-provider (Testing tree, Run All, results tree, row menus, opened message, run glyphs and the gutter menu on port/fixtures/debug-node/math.test.js line 2, the run profile dropdown) |+| workbench/contrib/testing | workbench contribution | M16 | ported | [3 M] testing_gutter.rs `test_context_menu_actions`: no Peek Error on a failed test, as testingOutputPeek.ts (`vscode.peekTestError`) is not ported<br>[3 M] testing_view.rs `testing_view_pane`: the view title is not testExplorerActions.ts's: no Show Output (`ShowMostRecentOutputAction`, `navigation`), Collapse All drawn in the title where upstream puts it in the `...` menu (`displayAction`), no `...` menu; the "No test results yet." line is missing and file roots start expanded (ui-pair with port/fixtures/debug-node)<br>[3 M] testing_results.rs `results_tree`: not drawn as a workbench list: the opened row takes `list.inactiveSelectionBackground` where the reference shows the focused selection, a twistie on the task row where the reference has none, no indent guides, no keyboard navigation; content and tree split 1:1 with no sash where the reference opens about 2:1 (ui-pair port/fixtures/debug-node with tests-provider)<br>[3 M] testing_results.rs `results_content`: a message or output is plain text lines, not testResultsOutput.ts's diff, markdown, plain text and terminal peeks; no call stack (`MenuId.TestCallStack`), no `CoverageElement` rows | cargo test -p app testing:: testing_filter the_results_tree_shows_tasks_tests_and_messages_as_testresultstree a_results_rows_menu_shows_its_actions_and_the_contributed_items an_opened_message_shows_the_first_message_content_item the_gutter_menu_shows_the_tests_actions_before_the_line_number_items a_line_with_two_tests_shows_run_all_and_a_submenu_per_test reveal_in_test_explorer_expands_the_tests_parents the_run_group_dropdown_lists_its_profiles_and_runs_the_picked_one select_default_profile_stores_the_picked_defaults the_run_group_chevron_keeps_the_view_title_actions_in_the_side_bar runs_from_the_explorer_exclude_the_tests_the_filter_hides a_hidden_test_leaves_the_tree_and_runs_until_it_is_unhidden a_test_row_shows_the_test_item_menu_s_inline_group a_test_rows_context_menu_shows_and_runs_the_test_item_actions children_sort_by_line_then_by_file_name_order the_view_title_dropdown_starts_and_stops_one_profile_of_several continuous_run_using_picks_from_the_tests_controller_only a_continuous_run_holds_one_cancellable_request_per_profile_until_it_stops the_testing_item_spins a_test_run_waits_for_workspace_trust_and_completes_when_it_is_refused; ui-pair port/fixtures/debug-node with tests-provider (Testing tree, Run All, results tree, row menus, opened message, run glyphs and the gutter menu on port/fixtures/debug-node/math.test.js line 2, the run profile dropdown); cargo test -p app a_contributed_inline_result_action_draws_its_icon retired_tests_take_test_result_outdated a_line_with_more_than_30_tests_picks_the_rest_from_a_quick_pick reveal_in_test_explorer_selects_and_scrolls_to_the_row the_run_group_chevron_is_active_while_its_menu_is_open the_workbench_context_has_the_testing_service_keys || workbench/contrib/themes | workbench contribution | M9 | verified | | Color Theme picker (`workbench.action.selectTheme`, Cmd+K Cmd+T): rows, order and descriptions as the reference, 200ms preview, Escape restores, accept writes `workbench.colorTheme`; File Icon Theme picker (`workbench.action.selectIconTheme`, Themes submenu): None and the installed themes, preview, Escape restores, accept writes `workbench.iconTheme` (null for None) (cargo test -p app themes); Product Icon Theme picker (`workbench.action.selectProductIconTheme`, Themes submenu): Default and the installed themes, writes `workbench.productIconTheme` (cargo test -p app product_icon; product-icons-pair `picker`: the same rows, except the reference's "Test Product Icon Theme" of vscode-colorize-tests, a test extension the port does not ship); no Marketplace browsing, no `window.autoDetectColorScheme` || workbench/contrib/timeline | workbench contribution | M14 | verified | | Timeline view (workbench/timeline_view.rs, timeline.rs): active editor and workspace timelines, paging, follow active editor, excluded sources in profile storage, compare selected, keyboard, `timeline/item/context` and title menus: cargo test -p app timeline; the title toolbar is a tab stop between the pane header and the tree (Shift+Tab focuses its first action with its hover, Left/Right, Enter): cargo test -p app shift_tab_reaches_the_title_toolbar; ui-pair m12/timeline.json header step matches; item labels draw their `$(icon)`s (cargo test -p app an_item_label_draws_its_icons); a `null` `timeline.pageSize` follows the view height (cargo test -p app a_null_page_size_follows_the_view_height) || workbench/contrib/typeHierarchy | workbench contribution | M13 | verified | | Peek Type Hierarchy in workbench/hierarchy_peek.rs: supertypes/subtypes toggle, layout `typeHierarchyPeekLayout`, the focused message of an empty answer, `_executePrepareTypeHierarchy`, `_executeProvideSupertypes`, `_executeProvideSubtypes`; cargo test -p app hierarchy; ui-pair port/results/language-features.md (Type hierarchy) |@@ -636,7 +636,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| extension/emmet | built-in extension | M13 | verified | | its integration tests on the port: `port/tools/extension-tests emmet`, 176 passing, 0 failing (Expand Abbreviation, wrap, tag actions, math, increment, CSS) || extension/extension-editing | built-in extension | M13 | verified | | activates on package.json; its jsonValidation schema `vscode://schemas/vscode-extensions` and `toolsParameters` are served (config json_schema.rs); ui-pair manifest/package.json: the "SVGs are not a valid image source." warning in the editor and Problems as in the reference (port/results/language-features.md) || extension/fsharp | built-in extension | M7 | verified | | grammar: cargo test -p app syntax::tests::colorize_fixtures_match_the_reference (its colorize-tests fixtures, scopes and 10 default theme colors) |-| extension/git | built-in extension | M14 | ported | [3 S] a conflicted file's editor title lacks git's Open in Merge Editor icon the reference shows (`git.openMergeEditor` in `editor/title`, `resource in git.mergeChanges && git.activeResourceHasMergeConflicts`; ui-pair menus/merge-result-title.json with `FOLDER` a repository mid-merge, before the click) | integration tests 91 passing, 2 pending, 0 failing, as the reference (port/results/scm.md); SCM pixel-check window: the changed file listed and its diff opened |+| extension/git | built-in extension | M14 | verified | | integration tests 91 passing, 2 pending, 0 failing, as the reference (port/results/scm.md); SCM pixel-check window: the changed file listed and its diff opened; verified: cargo test -p app the_active_resource_has_changes_while_a_group_lists_it editor_title_actions_of_one_order_sort_by_title, ui-pair menus/merge-result-title.json shot `before`: the conflicted file's title actions match the reference (Open Changes after Next Conflict) || extension/git-base | built-in extension | M14 | verified | | integration tests 14 passing, as the reference (port/results/scm.md); its API serves git and github || extension/github | built-in extension | M14 | verified | | activates with git and git-base (ui-pair log `eager extensions activated`); features that need a GitHub session stay off (no sign-in by decision); its smoke tests are in no scripts/test-integration.sh suite and the reference cannot load them either (port/results/scm.md) || extension/github-authentication | built-in extension | | removed | | scan.rs REMOVED_BUILTINS; cargo test -p exthost skips_removed_builtins |diff --git a/port/notes.md b/port/notes.mdindex 3c7ca409e7c..a31d2f86e57 100644--- a/port/notes.md+++ b/port/notes.md@@ -495,7 +495,7 @@ Done when (first item): api-tests `vscode API - editors` passes as in the refere- Editor font zoom (fontZoom.ts, editorZoom.ts, fontInfo.ts, mouseHandler.ts `_setupMouseWheelZoomListener`): one level for every editor from -5 to 20, not persisted, scaling the font size and line height by 10% per level (no rounding, like upstream), so the glyph margin, gutter, sticky scroll, minimap, overview ruler, message placement and drop marker follow `Viewport.line_height`. The actions have no keybinding upstream, only the Command Palette. With `editor.mouseWheelZoom`, Cmd or Ctrl (no Shift, no Alt) and a mouse notch zoom one level; a trackpad gesture that began with them zooms by a fifth of its accumulated delta; GPUI's line delta stands in for `MouseWheelClassifier.isPhysicalMouseWheel`. ui-pair (`notes.txt`, zoom in twice, out three times): level -1 matches pixel for pixel; levels 1 and 2 place the gutter and text 2 and 1 device pixels right of the reference, Chrome's snapping of the fractional 19.8 and 21.6px margins.- Insert Final New Line (insertFinalNewLine.ts): the action appends the model's EOL to the last line even when that line is already empty, between undo stops, tracking the primary selection with `trackSelection` stickiness. That stickiness (`NeverGrowsWhenTypingAtEdges` for a selection) now also applies to Replace All and the indentation and trim commands, which tracked a selection as always growing. The `files.insertFinalNewline` save participant is in the save participants entry below. ui-pair (`notes.txt`): the new line 11 and the dirty tab match the reference.- Overtype (toggleOvertype.ts, inputMode.ts, replaceCommand.ts `ReplaceOvertypeCommand` and `ReplaceOvertypeCommandOnCompositionEnd`): one input mode for the window, insert at start, flipped by View: Toggle Overtype/Insert Mode. Its Alt+Cmd+O is shadowed by the later `workbench.action.remote.showMenu` rule in both apps, so the key runs nothing in the port (remote is removed). In overtype mode a typed character replaces as many characters after the selection up to the line's end, an IME commit removes as many characters after it, and a paste does the same when `editor.overtypeOnPaste` is on. The status bar shows the prominent `OVR` item (`updateInputModeElement`) and the Column Selection item (`updateColumnSelectionModeElement`) beside Tab Moves Focus. The cursor takes `editor.overtypeCursorStyle` in overtype mode and `editor.cursorStyle` otherwise; of their styles only `block` (one char wide, the char under it in `editorCursor.background` or the caret color's opposite) and `line` are drawn, the underline and outline styles draw a line.-- Toggle Tab Key Moves Focus (toggleTabFocusMode.ts, tabFocus.ts, editorStatus.ts `TabFocusMode`): the mode starts from `editor.tabFocusMode` and follows each change of the setting; the toggle flips it in between. A setting changed and changed back within one toggle resumes the toggled mode, where upstream takes the setting's value. With the mode on, `editorTabMovesFocus` turns the tab and outdent keybindings off and Tab moves the focus from the editor text to the status bar, drawn with its 1px `statusBar.focusBorder` outline and rounded bottom corners; Shift+Tab returns. Past the status bar Tab follows the browser's DOM order (probed on the reference with `port/tools/ref-dom` `key:Tab`): the editor group's tab, close actions and toolbar, the editor text, the panel, the status bar, the title bar (Go Back and Go Forward, the command center, the layout actions), the activity bar, the side bar's views, back to the editor. The workbench's Tab and Shift+Tab are a bubble-phase default (`keyboard.rs` `tab_key_down`, after every element's own handler, as the browser's default action) that call GPUI's `focus_next` / `focus_prev` over `tab_stop` handles in paint order (`editor_status.rs` `move_tab_focus`). Each action bar is one tab stop, the item it last focused or its first (actionbar.ts `setFocusable`, roving tabindex; `action_bar.rs` `is_roving_tab_stop`); the command center's center item and each editor tab's close action are bars of their own (commandCenterControl.ts, multiEditorTabsControl.ts), and an inactive tab's close action stays focusable at `opacity: 0` (connectedEditorTabs.css). The content hover keeps its own order: Shift+Tab from the editor text enters it at its last element and Tab past its last element leaves it for the stop after the editor; Tab in the text hides it (contentHoverController.ts `_onKeyDown`). Tests: `cargo test -p app -- tab_walks_the_parts_in_the_dom_order the_title_bar_toolbars_are_tab_stops_in_the_dom_order the_tab_close_actions_and_the_editor_actions_toolbar_are_tab_stops the_verbosity_actions_use_the_focused_part`. ui-pair (Tab Focus Mode, notes.txt open, Tab five times from the text, then Shift+Tab twice): both apps go status bar, Go Back, command center, Customize Layout, Explorer in the activity bar, and back to the command center; the item outline used to sit one item lower (the outline canvas took its static position after the icon). The aria alert ("Pressing Tab will now ...") has no GPUI equivalent. The "Tab Moves Focus" item paints `statusBarItem.prominentBackground` around the label's margins with 4px corners (modernUI statusBar.css). ui-pair (`notes.txt`): the item and the status bar outline match the reference; the word highlight stays in the port's tab1 shot only because cua leaves the port window inactive, where GPUI sends no focus events (the tab_focus test covers the blur).+- Toggle Tab Key Moves Focus (toggleTabFocusMode.ts, tabFocus.ts, editorStatus.ts `TabFocusMode`): the mode starts from `editor.tabFocusMode` and follows each change of the setting; the toggle flips it in between. A setting changed and changed back within one toggle resumes the toggled mode, where upstream takes the setting's value. With the mode on, `editorTabMovesFocus` turns the tab and outdent keybindings off and Tab moves the focus from the editor text to the status bar, drawn with its 1px `statusBar.focusBorder` outline and rounded bottom corners; Shift+Tab returns. The terminal leaves Tab and Shift+Tab to that order while the mode is on (terminalInstance.ts `attachCustomKeyEventHandler`, `terminal_key`). Past the status bar Tab follows the browser's DOM order (probed on the reference with `port/tools/ref-dom` `key:Tab`): the editor group's tab, close actions and toolbar, the editor text, the panel, the status bar, the title bar (Go Back and Go Forward, the command center, the layout actions), the activity bar, the side bar's views, back to the editor. The workbench's Tab and Shift+Tab are a bubble-phase default (`keyboard.rs` `tab_key_down`, after every element's own handler, as the browser's default action) that call GPUI's `focus_next` / `focus_prev` over `tab_stop` handles in paint order (`editor_status.rs` `move_tab_focus`). Each action bar is one tab stop, the item it last focused or its first (actionbar.ts `setFocusable`, roving tabindex; `action_bar.rs` `is_roving_tab_stop`); the command center's center item and each editor tab's close action are bars of their own (commandCenterControl.ts, multiEditorTabsControl.ts), and an inactive tab's close action stays focusable at `opacity: 0` (connectedEditorTabs.css). The content hover keeps its own order: Shift+Tab from the editor text enters it at its last element and Tab past its last element leaves it for the stop after the editor; Tab in the text hides it (contentHoverController.ts `_onKeyDown`). Tests: `cargo test -p app -- tab_walks_the_parts_in_the_dom_order the_title_bar_toolbars_are_tab_stops_in_the_dom_order the_tab_close_actions_and_the_editor_actions_toolbar_are_tab_stops the_verbosity_actions_use_the_focused_part`. ui-pair (Tab Focus Mode, notes.txt open, Tab five times from the text, then Shift+Tab twice): both apps go status bar, Go Back, command center, Customize Layout, Explorer in the activity bar, and back to the command center; the item outline used to sit one item lower (the outline canvas took its static position after the icon). The aria alert ("Pressing Tab will now ...") has no GPUI equivalent. The "Tab Moves Focus" item paints `statusBarItem.prominentBackground` around the label's margins with 4px corners (modernUI statusBar.css). ui-pair (`notes.txt`): the item and the status bar outline match the reference; the word highlight stays in the port's tab1 shot only because cua leaves the port window inactive, where GPUI sends no focus events (the tab_focus test covers the blur).- Render whitespace (viewParts/whitespace/whitespace.ts, the default `experimentalWhitespaceRendering: svg`): `editor.renderWhitespace` (`none`, `boundary`, `selection` by default, `trailing`, `all`) picks the spaces and tabs (`editor/whitespace.rs`, `cargo test -p app whitespace`) up to `stopRenderingLineAfter`; each space is a circle of radius spaceWidth / 7 at the middle of its cell and each tab the 10-point arrow of `_renderArrow`, in `editorWhitespace.foreground`, painted after the decorations and under the text. In `selection` mode a selection counts on a line only when it covers at least one character there. The port never wraps, so the wrapped-line cases of `boundary` and `trailing` do not apply. View: Toggle Render Whitespace (toggleRenderWhitespace.ts) writes `all` when the setting is `none`, else `none`; the View > Appearance > Render Whitespace submenu and its five Set Render Whitespace actions wait for the Appearance menu.- Column selection mode (toggleColumnSelection.ts): Toggle Column Selection Mode flips `editor.columnSelection` and is checked in the Selection menu (`4_config`). Turned on, the primary selection becomes a column selection from its anchor to its head; turned off, the column selection's corners become one selection (`column_selection_mode_changed`). While it is on, a drag or Shift+click on the text selects a column (`dispatchMouse`) and Shift+arrows run the `cursorColumnSelect*` keys. The Selection menu's other `4_config` item runs Toggle Multi-Cursor Modifier (toggleMultiCursorModifier.ts), titled by the `multiCursorModifier` context key; with `editor.multiCursorModifier` `ctrlCmd` the text click takes Cmd as the multi-cursor modifier and Alt+drag selects a column (`dispatchMouse`).- Save participants (saveParticipants.ts, `editor/save_participants.rs`): every save of a model (Cmd+S, Save All, the host's `$save`, `$saveAll` and `$trySaveDocument`, search replace) first runs, with the settings of the model's language and resource, `files.trimTrailingWhitespace` (no cursor spared, as an explicit save), `files.insertFinalNewline` and `files.trimFinalNewlines`, after an undo stop, so their edits undo as one step; the selections stay as they were. Format on Save and Code Actions on Save wait for the formatting and code action providers (milestone 13); Save without Formatting (`workbench.action.files.saveWithoutFormatting`) skips all of them. The host's participants still run before the workbench's, where upstream registers the workbench's first.@@ -876,6 +876,7 @@ Scope as in the M19 Work row of port/ledger.md.- Debug hover (`workbench/debug_hover.rs`; debugHover.ts, debugEditorContribution.ts hover handling): while stopped, the expression at the mouse in the focused frame's file (the first `EvaluatableExpressionProvider` through `$provideEvaluatableExpression`, else `getExactExpressionStartAndEnd`) is evaluated with `context: "hover"` (or looked up in the cheap scopes without `supportsEvaluateForHovers`) after the doubled `editor.hover.delay`, the editor hover off meanwhile; Alt swaps it for the editor hover; Cmd+K Cmd+I shows it at the cursor. The focused tree takes listWidget.ts's and abstractTree.ts's keys through the `list.*` commands (Up, Down, Page Up, Page Down, Home, End, Left, Right, Space, Enter, type navigation by name), Escape clears a selection before it hides the widget; `layoutTree` sizes the tree to its rows plus 10px, at most max(266px, 55% of the editor) and the hovered line's top less 22px. The visualizers are a ledger gap of workbench/contrib/debug; the context menu is under Variable menus. The glyph margin lifts the editor hover lockout; the hovered position is the nearer edge of the character under the mouse, a tab's middle included. Lazy rows (`presentationHint.lazy`) draw the `$(eye)` button after the name in the hover, Variables and Watch trees; a lazy watch, hover or REPL result is evaluated at once (debugModel.ts `evaluateExpression` without `keepLazyVars`). A click on an expandable row focuses and toggles it; with Alt the descendants whose children are loaded follow, the others stay collapsed (indexTreeModel.ts `_setNodeCollapseState` recursive, asyncDataTree.ts collapsing a stale node a deep expand reaches). `list.find` (Cmd+Alt+F, F3) on the focused tree opens abstractTree.ts's find widget over 30px of padding: highlight or filter mode and fuzzy or contiguous match by `workbench.list.defaultFindMode` and `defaultFindMatchType` and the widget's toggles, the filter keeps a collapsed parent of a loaded match, "No results found.", the focus to the first match from the focused row; it outlives each shown value like the tree, and Escape hides the hover and runs `list.closeFind` after it. ui-pair on `port/fixtures/debug-node` (Cmd+K Cmd+I on `numbers` and `greeting`) matches the reference's placement, tree indent and focus outline.- Variable menus (`workbench/variable_menu.rs`; variablesView.ts `openContextMenuForVariableTreeElement`, watchExpressionsView.ts `onContextMenu`, debugContext.ts `getContextForVariable`): a right-click on a Variables, Watch or hover row opens `DebugVariablesContext`, `DebugWatchContext` or `DebugHoverContext` over the row's keys (`variableEvaluateNamePresent`, `variableIsReadonly`, `variableType`, `watchItemType`, `debugType`), with `{ sessionId, container, variable }` for a variable and `{ watchExpressionId, name }` for a watch expression. Copy Value evaluates `evaluateName || value` again with the `clipboard` context when the debugger supports it, else `variables` or `watch`, and falls back to the shown value. Set Value, View Binary Data and the Break on Value items are left out until their requests are ported (ledger debug row); `canViewMemory` is always false.- Extension host debugging (`extensionHost` launch type; rawDebugSession.ts `launchVsCode`, localProcessExtensionHost.ts `attachSession`, debugService.ts `onAttachSession`): js-debug's `launchVSCode` opens the Extension Development Host window (or reloads the one on the same extension path) with `--debugId`, `--inspect-brk-extensions` and `--extensionEnvironment`; the host it starts has the session attach to the inspector port on a new adapter. Decision: a host with an inspector port runs on Node, since Bun has no V8 inspector; a host without one stays on Bun, and there is no 5870 default port (environmentService.ts gives one to a build from source, which would put every checkout run on Node). The window closes with its current host's exit and at the end of a 'Run Without Debugging' session; a restart reloads it. Check: `cargo test -p app workbench::host::`, ui-pair `debug/extension-host.json` with `FOLDER=port/fixtures/debug-extension` (stops at the breakpoint in `activate`).+- 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).- 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@@ -935,7 +936,7 @@ What to do (milestone 21, in order):- Scroll frame costs, the Editor's slow start (branch port-fix-settings-scroll, same harness): the Editor's first 70 to 105 frames took 14 ms, the later ones 7, and waiting 3 s after the open removed it. An `xctrace` Time Profiler run over the editor test put half of those early frames in `key_context` > `explorer_context` > `FileTree::rows`, reading and sorting the 800-file root again (a `stat` per file, the ICU collator) on both `key_context` calls of each frame: `FileTree::entries` cached a folder only once its mtime was 2 s old (git's racy entries), and the fixture had just written it. A sub-second mtime now marks a fine-grained file system (APFS keeps nanoseconds), where 100 ms settles the folder; a whole-second mtime keeps the 2 s (cargo test -p app a_fine_grained_mtime_settles_after_100_ms). In a real window the same re-read ran on each `key_context` call for 2 s after any change to an expanded folder. Median / p95 ms, two interleaved runs, before then after: Editor 6.9 to 7.0 / 14.0 to 14.7 then 6.9 / 7.5 to 7.7; Explorer 3.0 to 3.2 / 7.2 to 7.3 then 2.9 / 3.2 to 3.6; Extensions 1.7 / 2.0 to 2.1 then 1.7 / 1.9 to 2.0; Settings 1.1 / 1.4 then 1.0 / 1.4. Every surface meets the 8 ms gate.- Scroll frame costs in the GUI (branch port-fix-settings-scroll): the release app on the Studio host lane over the same folder, a scratch Swift CGEvent probe posting 30px continuous scroll events at about 100 Hz, and a scratch timer in `Window::draw`, give the frame times the headless harness gives; tracing `Context::notify` callers with `#[track_caller]` found who draws the Workbench. An inlay-hint answer called the Workbench's `cx.notify()`, so every part drew again on 78 of 87 scroll frames; with no provider registered a scroll still sent a request, whose answer came at once. The answer now notifies the editor view, and no provider means no request (inlayHintsController.ts:189). The overview ruler then took 80 to 120 ms a frame: with the cursor on `export`, a word on every line of the 20000, `word_highlight_ruler_lines` looked each of the 20000 highlights' kind up by a scan of the 20000 document highlights; one map per frame now. Editor in the GUI after both: median 10.5 / p95 11.8 ms (450 frames), its main thread in taffy `layout_as_root` 24%, `key_context` 14%, `editor_lines` 10%, the highlights map 9%. The Studio's accessibility client turns on "Screen Reader Optimized". On the lane `screencapture` fails ("could not create image from display"); `cua-driver call get_window_state` with `screenshot_out_file` works. A bare `wait` in a script that started the app in the background waits for the app.- The Studio mirror of this branch had an `out-exthost` from Nov 23 that `port/tools/build-exthost` had not inlined (its `BUILD_INSERT_PRODUCT_CONFIGURATION` markers still there), so the extension host asked for `../product.json` and failed to start; `bun port/tools/build-exthost` in the mirror fixed it. The bundle is not affected: build-exthost inlines the product and package-app writes `product.json` into the app.-- Scroll frame costs, the second GUI round (branch port-fix-settings-scroll): logging `Context::notify` callers on the Workbench with `#[track_caller]` while scrolling each surface found two more answers that redrew every part: a file decoration answer (137 times in an Explorer scroll up) and a gallery icon (149 times in the Extensions @builtin list). Each answer now notifies the view that drew the asking label or row (`window.current_view()` at the request), so every view that draws labels sends its own decoration requests at the end of its render: the Workbench root, each cached part view and each editor window. The Explorer's frame then showed the collapsed Outline (17%, a clone of the whole outline model) and Timeline (13%, its menu's context keys) building bodies the pane view drops; they now return their header only while `is_view_visible` is false. Settings opens on the lane through a user keybinding (`f19` to `workbench.action.openSettings2`, a plain key the probe posts), where the probe's Cmd+, and Cmd+Shift+P did not reach the app. It opens as the modal editor (with `workbench.editor.useModal` `off` too), and in two runs a scroll over it moved the text editor below (line 36 to 2508) while the settings list stayed at Commonly Used, so the GUI cannot measure Settings until the modal takes the wheel (ledger workbench/parts/editor).+- Scroll frame costs, the second GUI round (branch port-fix-settings-scroll): logging `Context::notify` callers on the Workbench with `#[track_caller]` while scrolling each surface found two more answers that redrew every part: a file decoration answer (137 times in an Explorer scroll up) and a gallery icon (149 times in the Extensions @builtin list). Each answer now notifies the view that drew the asking label or row (`window.current_view()` at the request), so every view that draws labels sends its own decoration requests at the end of its render: the Workbench root, each cached part view and each editor window. The Explorer's frame then showed the collapsed Outline (17%, a clone of the whole outline model) and Timeline (13%, its menu's context keys) building bodies the pane view drops; they now return their header only while `is_view_visible` is false. Settings opens on the lane through a user keybinding (`f19` to `workbench.action.openSettings2`, a plain key the probe posts), where the probe's Cmd+, and Cmd+Shift+P did not reach the app. It opens as the modal editor (with `workbench.editor.useModal` `off` too), and in two runs a scroll over it moved the text editor below (line 36 to 2508) while the settings list stayed at Commonly Used, so the GUI cannot measure Settings until the modal takes the wheel (ledger workbench/parts/editor). Cause: `swapped_group_body`'s guard took the wheel, press and move of an inactive group in the capture phase by its bounds, under the modal's overlay too; it now asks its hitbox, which the overlay's `occlude` hides (cargo test -p app a_wheel_over_the_settings_modal_scrolls_the_settings_list), and Settings follows `useModal` `off`.## GUI lanes (Studio)diff --git a/port/results/language-features.md b/port/results/language-features.mdindex 72abcd3a30a..8bdc2886e40 100644--- a/port/results/language-features.md+++ b/port/results/language-features.md@@ -108,6 +108,6 @@ Pairs `comment-expanded-pair.png`, `comment-reacted-pair.png`, `comment-editing-Steps `steps-comment-commands.json`: Go to Line 3, Add Comment on Current Selection, Escape, Toggle Editor Commenting. Pairs `comment-add-pair.png` and `comment-toggled-pair.png`: the template thread "Start discussion" with the trash action and the reply input focused with "Type a new comment" (fixed: the port showed the collapsed button, as it revealed only templates already expanded), then no glyphs, ranges, threads or reserved gutter after the toggle. Escape keeps the new template open in both since milestone 20 (`steps-comment-escape-f1-palette.json`: the reference releases the hold mode, F1 after Escape opens the palette; `steps-comment-escape-typed.json`: it shows no unsubmitted-comment confirmation with text typed, so its collapse is not reached; port/notes.md). The `+` glyph on hover is checked by cargo test only: ui-pair's pointer moves did not reach the port's gutter rows.-The proposed comment menus, with the fixture's `Insert Note` (`comments/comment/editorActions`), `Copy Thread Link` (`comments/commentThread/title/context`) and `Copy Comment Link` (`comments/commentThread/comment/context`), `FOLDER=<repo>/port/fixtures/language-features FILE=a.ts ARGS=--extensionDevelopmentPath=<repo>/port/fixtures/extensions/comments` (absolute paths). Steps `steps-comment-menus.json`: Expand All Comments, right-click Ann's comment, Escape, right-click the thread head, Escape, click Ann's edit action. Shots `comment-context`, `title-context`, `editing`: the two context menus with their one item at the pointer, and Insert Note as a secondary button left of Save, match. Differences, fixed after the pair: the comment form buttons had no border (button.ts draws `button.border` and `button.secondaryBorder`, 1px), and the edit form's buttons sat 12px left (review.css keeps the 12px right margin on `.edit-textarea` only). Left: with the comment in edit, its reactions row sits about 3px left of the reference's (ledger).+The proposed comment menus, with the fixture's `Insert Note` (`comments/comment/editorActions`), `Copy Thread Link` (`comments/commentThread/title/context`) and `Copy Comment Link` (`comments/commentThread/comment/context`), `FOLDER=<repo>/port/fixtures/language-features FILE=a.ts ARGS=--extensionDevelopmentPath=<repo>/port/fixtures/extensions/comments` (absolute paths). Steps `steps-comment-menus.json`: Expand All Comments, right-click Ann's comment, Escape, right-click the thread head, Escape, click Ann's edit action. Shots `comment-context`, `title-context`, `editing`: the two context menus with their one item at the pointer, and Insert Note as a secondary button left of Save, match. Differences, fixed after the pair: the comment form buttons had no border (button.ts draws `button.border` and `button.secondaryBorder`, 1px), and the edit form's buttons sat 12px left (review.css keeps the 12px right margin on `.edit-textarea` only). Fixed later: the reactions row sat 4px left in both modes (review.css `.review-widget .action-item` gives each reaction and the picker a 4px left margin, where the port used `.monaco-text-button`'s 7px right margin).The thread's additional actions (commentThreadAdditionalActions.ts), with the fixture's `Mark Resolved` and the `Review` submenu of `Approve` and `Request Changes` in `comments/commentThread/additionalActions` (proposal `contribCommentThreadAdditionalMenu`), same `FOLDER`, `FILE` and `ARGS`. Steps `steps-comment-additional.json`: Expand All Comments, then click the submenu's chevron. Shots `additional`, `dropdown`: the separator under the "Reply..." button, then Mark Resolved and Approve with its chevron as secondary small buttons 10px apart, and the chevron's menu of Approve and Request Changes below it, match; the whole widget sits about 2px higher in the port, as in the other comment shots.