Visual Studio Code, rebuilt in Rust
Rust
feat(testing): show task and test output in a detached terminal
rokarturb219f1f26278
diff --git a/native/crates/app/src/workbench/terminal_links.rs b/native/crates/app/src/workbench/terminal_links.rsindex cef91f0f912..85c0c955847 100644--- a/native/crates/app/src/workbench/terminal_links.rs+++ b/native/crates/app/src/workbench/terminal_links.rs@@ -392,7 +392,7 @@ mod tests {// The hover anchors on the painted pane.workbench.terminal_view.pane_bounds.insert(id, Bounds::new(point(px(0.), px(0.)), size(px(400.), px(200.))));let (bold_weight, normal_weight) = (gpui::FontWeight::BOLD, gpui::FontWeight::NORMAL);- workbench.terminal_view.metrics = Some(grid::CellMetrics { family: "Menlo".into(), font_size: 12., bold_weight, normal_weight, line_height: 1., letter_spacing: 0., cell_width: 7., cell_height: 16., descent: 3.3, scale: 2. });+ workbench.terminal_view.metrics = Some(grid::CellMetrics { family: "Menlo".into(), font_size: 12., bold_weight, normal_weight, line_height: 1., letter_spacing: 0., cell_width: 7., dom_cell_width: 7.2, cell_height: 16., descent: 3.3, scale: 2. });workbench.terminal_data(id, "go \u{1F980} run:task now".as_bytes(), window, cx);let start = exthost::session::ForwardedRequest { req: 1, proxy: "MainThreadTerminalService", method: "$startLinkProvider".into(), args: Vec::new() };drop(workbench.handle_terminal_request(start, window, cx));diff --git a/native/crates/app/src/workbench/terminal_view.rs b/native/crates/app/src/workbench/terminal_view.rsindex ef4517e6eb4..c87da407626 100644--- a/native/crates/app/src/workbench/terminal_view.rs+++ b/native/crates/app/src/workbench/terminal_view.rs@@ -61,6 +61,8 @@ const SCROLL_WHEEL_SENSITIVITY: f32 = 50.;pub struct TerminalView {pub(super) focus: FocusHandle,pub(super) instances: Vec<TerminalInstance>,+ /// terminalService.ts `createDetachedTerminal`: read-only terminals without a process, in no group or list.+ pub(super) detached: Vec<TerminalInstance>,/// terminalGroupService.ts groups: each holds instance ids, laid out side by side.pub(super) groups: Vec<Group>,pub(super) active_group: usize,@@ -197,6 +199,7 @@ impl TerminalView {TerminalView {focus: cx.focus_handle().tab_stop(true),instances: Vec::new(),+ detached: Vec::new(),groups: Vec::new(),active_group: 0,editor_instances: Vec::new(),@@ -248,11 +251,30 @@ impl TerminalView {}pub(super) fn instance(&self, id: u32) -> Option<&TerminalInstance> {- self.instances.iter().find(|instance| instance.id == id)+ self.instances.iter().chain(&self.detached).find(|instance| instance.id == id)}pub(super) fn instance_mut(&mut self, id: u32) -> Option<&mut TerminalInstance> {- self.instances.iter_mut().find(|instance| instance.id == id)+ self.instances.iter_mut().chain(&mut self.detached).find(|instance| instance.id == id)+ }++ /// A detached terminal of `rows` by `cols`, its id counting down from `u32::MAX` so the instance ids of the+ /// terminals stay as upstream's.+ pub(super) fn create_detached(&mut self, cols: u16, rows: u16, config: Config) -> u32 {+ let id = u32::MAX - self.detached.len() as u32;+ let launch = crate::terminal::ShellLaunchConfig { extension_pty: true, hide_from_user: true, ..Default::default() };+ self.detached.push(TerminalInstance::new(id, launch, cols, rows, config).0);+ id+ }++ /// The pane's cell: testResultsOutput.ts attaches a detached terminal with `enableGpu: false`, so its+ /// DomRenderer cell is the unrounded advance.+ pub(super) fn pane_metrics(&self, id: u32) -> Option<CellMetrics> {+ let metrics = self.metrics.clone()?;+ if !self.detached.iter().any(|instance| instance.id == id) {+ return Some(metrics);+ }+ Some(CellMetrics { cell_width: metrics.dom_cell_width, ..metrics })}pub(super) fn active_instance_mut(&mut self) -> Option<&mut TerminalInstance> {@@ -1582,7 +1604,8 @@ impl Workbench {/// Lays out and paints one pane: the instance takes the columns and rows its pane fits (`_evaluateColsAndRows`).fn paint_terminal_pane(&mut self, id: u32, bounds: Bounds<Pixels>, window: &mut Window, cx: &mut Context<Self>) {- let metrics = self.terminal_metrics(window);+ self.terminal_metrics(window);+ let metrics = self.terminal_view.pane_metrics(id).expect("measured above");let scrollbar_width = self.terminal_scrollbar_width();let sticky_look = self.terminal_sticky_look(id);let colors = if self.terminal_view.editor_instances.contains(&id) { TerminalColors::in_editor(&self.theme) } else { TerminalColors::new(&self.theme) };@@ -1623,12 +1646,14 @@ impl Workbench {let fixed_cols = self.terminal_view.instance(id).and_then(|instance| instance.fixed_cols);// `_evaluateColsAndRows`: a fixed width leaves 5px for its horizontal scroll bar.let scroll_bar_height = if fixed_cols.is_some() { 5. } else { 0. };- let padded = self.setting("workbench.experimental.modernUI") == true && !self.terminal_view.editor_instances.contains(&id);+ let detached = self.terminal_view.detached.iter().any(|instance| instance.id == id);+ let padded = self.setting("workbench.experimental.modernUI") == true && !self.terminal_view.editor_instances.contains(&id) && !detached;let padding_block = if padded { grid::PADDING_BLOCK } else { 0. };let pane_height = f32::from(bounds.size.height);let (fitted_cols, rows) = metrics.grid_size(f32::from(bounds.size.width) - GUTTER - scrollbar_width, pane_height - 2. * padding_block - scroll_bar_height);// terminal.css bottom aligns `.xterm`; a `.fixed-dims` one is static and a modernUI panel one sits at `top: 0`.- let grid_top = if padded || fixed_cols.is_some() { padding_block } else { pane_height - rows as f32 * metrics.cell_height };+ // A detached terminal's `.xterm` sits at the top of the element it attaches to.+ let grid_top = if padded || fixed_cols.is_some() || detached { padding_block } else { pane_height - rows as f32 * metrics.cell_height };let cols = fixed_cols.unwrap_or(fitted_cols);let config = self.terminal_config();let Some(instance) = self.terminal_view.instance_mut(id) else { return };@@ -1658,7 +1683,7 @@ impl Workbench {grid::paint_horizontal_scrollbar(bounds, xterm_bounds, &look, window);}});- if resized {+ if resized && !detached {self.terminal_resized(id);self.show_resize_overlay(id, cx);}@@ -1670,7 +1695,7 @@ impl Workbench {/// The xterm.js options the settings set: `scrollback`, `wordSeparator` and `cursorStyle`, which a program's/// DECSCUSR overrides.- fn terminal_config(&self) -> Config {+ pub(super) fn terminal_config(&self) -> Config {let shape = match self.setting("terminal.integrated.cursorStyle").as_str() {Some("line") => CursorShape::Beam,Some("underline") => CursorShape::Underline,@@ -1762,7 +1787,7 @@ impl Workbench {window.focus(&self.terminal_view.focus, cx);cx.stop_propagation();let force_selection = event.modifiers.alt && self.setting("terminal.integrated.macOptionClickForcesSelection") == true;- let (Some(bounds), Some(metrics)) = (self.terminal_view.pane_bounds.get(&id).copied(), self.terminal_view.metrics.clone()) else { return };+ let (Some(bounds), Some(metrics)) = (self.terminal_view.pane_bounds.get(&id).copied(), self.terminal_view.pane_metrics(id)) else { return };let Some(instance) = self.terminal_view.instance_mut(id) else { return };let (row, column, side) = grid::cell_at(bounds, event.position, instance, &metrics);let link_modifier = self.terminal_link_modifier(event.modifiers);@@ -1805,7 +1830,7 @@ impl Workbench {}fn terminal_mouse_move(&mut self, id: u32, event: &MouseMoveEvent, window: &mut Window, cx: &mut Context<Self>) {- let (Some(bounds), Some(metrics)) = (self.terminal_view.pane_bounds.get(&id).copied(), self.terminal_view.metrics.clone()) else { return };+ let (Some(bounds), Some(metrics)) = (self.terminal_view.pane_bounds.get(&id).copied(), self.terminal_view.pane_metrics(id)) else { return };let selecting = self.terminal_view.selecting == Some(id) && event.pressed_button == Some(MouseButton::Left);let show_command_guide = self.setting("terminal.integrated.shellIntegration.showCommandGuide") != false;let Some(instance) = self.terminal_view.instance(id) else { return };@@ -1840,7 +1865,7 @@ impl Workbench {fn terminal_mouse_up(&mut self, id: u32, event: &MouseUpEvent, cx: &mut Context<Self>) {let was_selecting = self.terminal_view.selecting.take() == Some(id);let copy_on_selection = self.setting("terminal.integrated.copyOnSelection") == true;- let (Some(bounds), Some(metrics)) = (self.terminal_view.pane_bounds.get(&id).copied(), self.terminal_view.metrics.clone()) else { return };+ let (Some(bounds), Some(metrics)) = (self.terminal_view.pane_bounds.get(&id).copied(), self.terminal_view.pane_metrics(id)) else { return };let Some(instance) = self.terminal_view.instance_mut(id) else { return };if was_selecting {if copy_on_selection && let Some(text) = instance.selection_text() {diff --git a/native/crates/app/src/workbench/terminal_view/grid.rs b/native/crates/app/src/workbench/terminal_view/grid.rsindex dd6468bf17e..9c8232f4de4 100644--- a/native/crates/app/src/workbench/terminal_view/grid.rs+++ b/native/crates/app/src/workbench/terminal_view/grid.rs@@ -34,6 +34,8 @@ pub struct CellMetrics {pub letter_spacing: f32,/// The rendered cell in px: whole device pixels.pub cell_width: f32,+ /// DomRenderer's cell width (`enableGpu: false`): the unrounded advance plus the letter spacing.+ pub dom_cell_width: f32,pub cell_height: f32,pub descent: f32,pub scale: f32,@@ -60,6 +62,7 @@ impl CellMetrics {line_height,letter_spacing,cell_width: device_cell_width / scale,+ dom_cell_width: char_width + letter_spacing,cell_height: device_cell_height / scale,descent,scale,diff --git a/native/crates/app/src/workbench/terminal_view/tests.rs b/native/crates/app/src/workbench/terminal_view/tests.rsindex f218fd55ab9..95dec42eb11 100644--- a/native/crates/app/src/workbench/terminal_view/tests.rs+++ b/native/crates/app/src/workbench/terminal_view/tests.rs@@ -43,7 +43,7 @@ fn a_tab_row_is_inset_and_its_label_is_one_line_of_text(cx: &mut gpui::TestAppCo/// The quiet-fail ui-pair: a 710px panel fits 97 columns in the reference, Menlo 12 at 2x taking 14 device pixels.#[test]fn columns_divide_by_the_rendered_cell_not_the_advance() {- let metrics = super::grid::CellMetrics { family: "Menlo".into(), font_size: 12., bold_weight: FontWeight::BOLD, normal_weight: FontWeight::NORMAL, line_height: 1., letter_spacing: 0., cell_width: 7., cell_height: 16., descent: 3.3, scale: 2. };+ let metrics = super::grid::CellMetrics { family: "Menlo".into(), font_size: 12., bold_weight: FontWeight::BOLD, normal_weight: FontWeight::NORMAL, line_height: 1., letter_spacing: 0., cell_width: 7., dom_cell_width: 7.2, cell_height: 16., descent: 3.3, scale: 2. };assert_eq!(metrics.grid_size(710. - super::grid::GUTTER - super::grid::SCROLLBAR_WIDTH_MODERN, 196.), (97, 12));}diff --git a/native/crates/app/src/workbench/testing_results.rs b/native/crates/app/src/workbench/testing_results.rsindex 23eeb1dc664..40748136b1e 100644--- a/native/crates/app/src/workbench/testing_results.rs+++ b/native/crates/app/src/workbench/testing_results.rs@@ -670,6 +670,53 @@ impl Workbench {Some(div().h(px(height)).relative().child(label))}+ /// TerminalMessagePeek `update`: what its terminal shows for a task, a test's output or an output message: the+ /// output, else once the run completed the notice that there is none.+ pub(super) fn terminal_output(&self) -> Option<String> {+ let (result_id, task, test) = match self.testing_view.results_subject.as_ref()? {+ InspectSubject::Task { result, task } => (result, *task, None),+ InspectSubject::Output { result, task, test } => (result, *task, Some(test)),+ InspectSubject::Message { result, task, test, message } => {+ let result = self.result_by_id(result)?;+ (result.items[test].tasks[*task].messages[*message]["type"] == 1).then_some(())?;+ (&result.id, *task, Some(test))+ }+ };+ let result = self.result_by_id(result_id)?;+ let (output, notice) = match test {+ None => (result.tasks.get(task)?.output.clone(), "The test run did not record any output."),+ Some(test) => {+ let messages = &result.items.get(test)?.tasks[task].messages;+ (messages.iter().filter(|message| message["type"] == 1).map(message_text).collect(), "The test case did not report any output.")+ }+ };+ if output.is_empty() && result.completed_at.is_some() {+ return Some(format!("\r\n{}", crate::terminal::format_message_for_terminal(notice)));+ }+ Some(output)+ }++ /// Writes `output` to the detached terminal: what it adds to the text written, else all of it after a reset+ /// (`makeTerminal` reuses the terminal with `\x1bc`), the cursor hidden (`attachTerminalToDom`).+ fn write_results_terminal(&mut self, output: String) -> u32 {+ let (id, written) = match self.testing_view.results_terminal.take() {+ Some((id, written)) => (id, Some(written)),+ None => (self.terminal_view.create_detached(80, 10, self.terminal_config()), None),+ };+ let colors = crate::terminal::colors::TerminalColors::new(&self.theme);+ let instance = self.terminal_view.instance_mut(id).expect("created above");+ match written.as_deref().and_then(|written| output.strip_prefix(written)) {+ Some(added) => {+ instance.process(added.as_bytes(), &colors);+ }+ None => {+ instance.process(format!("\x1bc\x1b[?25l{output}").as_bytes(), &colors);+ }+ }+ self.testing_view.results_terminal = Some((id, output));+ id+ }+/// MarkdownTestMessagePeek `update`: the opened message's markdown, when it is neither a string nor diffable.pub(super) fn markdown_message(&self) -> Option<MarkdownString<'_>> {let Some(InspectSubject::Message { result, task, test, message }) = &self.testing_view.results_subject else { return None };@@ -826,6 +873,12 @@ impl Workbench {// callStackWidget.ts hosts the message in a list row, so the pane's list row inset applies.return div().id("test-results-output").flex_1().min_w_0().relative().px(px(self.pane_row_inset())).flex().flex_col().child(editor).children(floating);}+ if let Some(output) = self.terminal_output() {+ let id = self.write_results_terminal(output);+ let pane = self.terminal_pane(id, false, self.color("panel.border"), cx);+ // callStackWidget.ts hosts the terminal in a list row, so the pane's list row inset applies.+ return div().id("test-results-output").flex_1().min_w_0().relative().flex().px(px(self.pane_row_inset())).child(pane).children(self.results_floating_button(window, cx));+ }if let Some(markdown) = self.markdown_message() {let blocks = crate::markdown::parse(&markdown);// `line-height: normal` of the 13px system font.diff --git a/native/crates/app/src/workbench/testing_results/tests.rs b/native/crates/app/src/workbench/testing_results/tests.rsindex 24c9a897604..8c0ee2e2ab6 100644--- a/native/crates/app/src/workbench/testing_results/tests.rs+++ b/native/crates/app/src/workbench/testing_results/tests.rs@@ -60,6 +60,37 @@ fn an_opened_plain_text_message_shows_in_a_read_only_code_editor(cx: &mut TestAp});}+/// testResultsOutput.ts `TerminalMessagePeek`: a task shows the run's output in a detached terminal, a test its own+/// output, appended as it comes, and a test without output the notice once the run completed.+#[gpui::test]+fn task_and_test_output_show_in_a_detached_terminal(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with_tests("test-results-terminal", TESTS, cx);+ workbench.update_in(cx, |workbench, _, _| {+ add_results(workbench);+ workbench.testing.results[0].append_output("t1", "run start\r\n", None, None);+ workbench.testing.results[0].append_output("t1", "adds out\r\n", None, Some("c\0f\0a"));+ let shown = |workbench: &mut Workbench, subject: InspectSubject| {+ workbench.testing_view.results_subject = Some(subject);+ let output = workbench.terminal_output().expect("a terminal subject");+ let id = workbench.write_results_terminal(output);+ let instance = workbench.terminal_view.instance_mut(id).expect("the detached terminal");+ instance.select_all();+ let text = instance.selection_text().unwrap_or_default();+ assert!(workbench.terminal_view.instances.is_empty(), "no terminal in the terminal list");+ text.trim_end().to_owned()+ };+ assert_eq!(shown(workbench, InspectSubject::Task { result: "r1".into(), task: 0 }), "run start\nadds out");+ workbench.testing.results[0].append_output("t1", "more\r\n", None, None);+ assert_eq!(shown(workbench, InspectSubject::Task { result: "r1".into(), task: 0 }), "run start\nadds out\nmore");+ assert_eq!(shown(workbench, InspectSubject::Message { result: "r1".into(), task: 0, test: "c\0f\0a".into(), message: 0 }), "adds out");+ assert_eq!(shown(workbench, InspectSubject::Output { result: "r1".into(), task: 0, test: "c\0f\0b".into() }), "\n * The test case did not report any output.");+ let id = workbench.testing_view.results_terminal.as_ref().expect("the results terminal").0;+ let (normal_weight, bold_weight) = (gpui::FontWeight::NORMAL, gpui::FontWeight::BOLD);+ workbench.terminal_view.metrics = Some(super::super::terminal_view::grid::CellMetrics { family: "Menlo".into(), font_size: 12., bold_weight, normal_weight, line_height: 1., letter_spacing: 0., cell_width: 7., dom_cell_width: 7.2, cell_height: 16., descent: 3.3, scale: 2. });+ assert_eq!(workbench.terminal_view.pane_metrics(id).map(|metrics| metrics.cell_width), Some(7.2), "`enableGpu: false` lays out on the DOM cell");+ });+}+/// testResultsOutput.ts `MarkdownTestMessagePeek`: an opened markdown message renders its markdown, without an editor.#[gpui::test]fn an_opened_markdown_message_renders_its_markdown(cx: &mut TestAppContext) {diff --git a/native/crates/app/src/workbench/testing_view.rs b/native/crates/app/src/workbench/testing_view.rsindex 1715b575657..98d74711b64 100644--- a/native/crates/app/src/workbench/testing_view.rs+++ b/native/crates/app/src/workbench/testing_view.rs@@ -37,6 +37,8 @@ pub struct TestingView {pub results_focused: Option<String>,pub results_toggled: HashSet<String>,pub results_focus: gpui::FocusHandle,+ /// testResultsOutput.ts `TerminalMessagePeek`: its detached terminal and the text written to it.+ pub results_terminal: Option<(u32, String)>,/// Where the continuous run dropdown's chevron last painted, to anchor its menu.pub continuous_dropdown_bounds: std::rc::Rc<std::cell::Cell<gpui::Bounds<gpui::Pixels>>>,/// Where the run and the debug group dropdowns' chevrons last painted.@@ -60,6 +62,7 @@ impl TestingView {collapsed: HashSet::new(),expanded: HashSet::new(),results_subject: None,+ results_terminal: None,results_selected: None,results_focused: None,results_toggled: HashSet::new(),diff --git a/port/ledger.md b/port/ledger.mdindex 7d3a03d30fb..af889255e32 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -602,7 +602,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_results.rs `results_content`: an output is plain text lines, not testResultsOutput.ts's `TerminalMessagePeek`; a markdown message's text cannot be selected (`userSelect: text`); the content and tree split in half where the reference splits them about 2:1 (testResultsViewContent.ts `SplitView`); a plain text message's ANSI colors are stripped (`colorizeTestMessageInEditor`); 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 the_results_tree_moves_its_focus_with_the_list_commands a_results_rows_menu_shows_its_actions_and_the_contributed_items an_opened_ 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 view_as_list_shows_the_leaves_and_the_more_menu_checks_the_mode peek_error_opens_the_failed_childs_message_at_the_test 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); ui-pair port/fixtures/testing-messages (diff message); 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/testing | workbench contribution | M16 | ported | [3 M] testing_results.rs `results_content`: a markdown message's text cannot be selected (`userSelect: text`); the content and tree split in half where the reference splits them about 2:1 (testResultsViewContent.ts `SplitView`); a plain text message's ANSI colors are stripped (`colorizeTestMessageInEditor`); 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 the_results_tree_moves_its_focus_with_the_list_commands a_results_rows_menu_shows_its_actions_and_the_contributed_items an_opened_ 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 view_as_list_shows_the_leaves_and_the_more_menu_checks_the_mode peek_error_opens_the_failed_childs_message_at_the_test a_test_run_waits_for_workspace_trust_and_completes_when_it_is_refused task_and_test_output_show_in_a_detached_terminal; 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); ui-pair port/fixtures/testing-messages (diff message, markdown message output); 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) |diff --git a/port/notes.md b/port/notes.mdindex 63702da406b..2199267cd9b 100644--- a/port/notes.md+++ b/port/notes.md@@ -880,7 +880,7 @@ Scope as in the M19 Work row of port/ledger.md.- Test Explorer title (testExplorerActions.ts, `testing_view.rs`): the navigation actions end with Show Output (`terminal`, disabled until a result exists); the "..." holds View as List/Tree, Sort by Status/Location/Duration (workspace storage `testing.viewMode` and `testing.viewSorting`, as testingExplorerView.ts) and Collapse All Tests, Clear All Results. Shortcut: View as List lists the tests the collection has resolved; listProjection.ts also asks the controller to resolve every level (`expandElement(root, Infinity)`), which the port does not send.- Test Results tree (`workbench/testing_results.rs`; testResultsTree.ts `OutputPeekTree`): rows drawn as the workbench tree rows (4px inset, rounded, `list_row_selection`, indent guides, listCommands.ts keys while focused); a new run selects and focuses its first task without taking the focus (`revealItem` with `preserveFocus`). Decision: the task row always shows its twistie when it has children. The reference renders the task row while the task is still childless (`onNewTask`), and abstractTree.ts `renderTreeElement` redraws a twistie only on a collapse state change, so the reference shows no twistie until the row is toggled or rendered again; the port draws the state a fresh render gives.- Test resolution timing: treeProjection.ts `storeItem` expands only depth-0 items, the controller roots; a single root's children show on the explorer's top level collapsed (index.ts `getChildrenForParent`, `depth > 0`) and resolve only when the user expands them, and testService.ts `testsInFile` yields an open file's item without expanding it. The port expanded those file items at publish, so the tests-provider fixture's `resolveHandler` ran for every file and Run All ran each test, where the reference's run handler finds the unresolved file item and runs it as one test (`math.test.js` without children in the results). `TestCollection::apply` now answers only the roots.-- Test Results content editors (`workbench/testing_results.rs`; testResultsOutput.ts content providers): the view's code editors live in `TEST_RESULTS_GROUP`, a group outside the grid like the Output view's `PANEL_GROUP` (`is_panel_group`), so they select, copy and take the editor keys through the same code; `PlainTextMessagePeek` opens a plain text message's `messageUri` model (`vscode-test-data://results/<result>/message/<task>/<message>/TestFailureMessage?<test>`) there read-only, without line numbers, glyph margin, minimap or `scrollBeyondLastLine` (`commonEditorOptions`). Shortcut: ANSI escapes in the message are stripped, not colored as `colorizeTestMessageInEditor` does. `DiffContentProvider` opens a diffable message (an error with string `expected` and `actual`) as an embedded diff of its `ExpectedOutput` and `ActualOutput` models (`DiffInput.embedded`): `diffEditorOptions` fixes the options (side by side, no overview ruler, `ignoreTrimWhitespace` false, unchanged regions shown) instead of reading `diffEditor.*`, line numbers turn on when either side is multiline, and a 20px zone above line 1 holds the "Expected" and "Actual" titles (testingDecorations.ts `TitleLensContentWidget`). The editors are built outside a text editor part, so `lineNumbersMinChars` is the default 5, and only the original side has a glyph margin (`_adjustOptionsForLeftHandSide`). The diff's `diff_part_width` moved to the group state, since the results diff and an editor area diff lay out at once. ui-pair port/fixtures/testing-messages (`compare.test.js`): gutters, fills and titles match; the reference splits the content and tree about 2:1 where the port splits them in half (`TestResultsViewContent.lastSplitWidth`), open. `MarkdownTestMessagePeek` renders a markdown message through `markdown_view.rs` in testing.css `.preview-text` (8px 12px 8px 20px padding, paragraphs 1em apart at `line-height: normal`, 15px here), and its results row reads the rendered text (`renderTestMessageAsText`). ui-pair of a `markdown "..."` test (tests-provider): text box 240x77 at the same left in both, 1px lower in the reference.+- Test Results content editors (`workbench/testing_results.rs`; testResultsOutput.ts content providers): the view's code editors live in `TEST_RESULTS_GROUP`, a group outside the grid like the Output view's `PANEL_GROUP` (`is_panel_group`), so they select, copy and take the editor keys through the same code; `PlainTextMessagePeek` opens a plain text message's `messageUri` model (`vscode-test-data://results/<result>/message/<task>/<message>/TestFailureMessage?<test>`) there read-only, without line numbers, glyph margin, minimap or `scrollBeyondLastLine` (`commonEditorOptions`). Shortcut: ANSI escapes in the message are stripped, not colored as `colorizeTestMessageInEditor` does. `DiffContentProvider` opens a diffable message (an error with string `expected` and `actual`) as an embedded diff of its `ExpectedOutput` and `ActualOutput` models (`DiffInput.embedded`): `diffEditorOptions` fixes the options (side by side, no overview ruler, `ignoreTrimWhitespace` false, unchanged regions shown) instead of reading `diffEditor.*`, line numbers turn on when either side is multiline, and a 20px zone above line 1 holds the "Expected" and "Actual" titles (testingDecorations.ts `TitleLensContentWidget`). The editors are built outside a text editor part, so `lineNumbersMinChars` is the default 5, and only the original side has a glyph margin (`_adjustOptionsForLeftHandSide`). The diff's `diff_part_width` moved to the group state, since the results diff and an editor area diff lay out at once. ui-pair port/fixtures/testing-messages (`compare.test.js`): gutters, fills and titles match; the reference splits the content and tree about 2:1 where the port splits them in half (`TestResultsViewContent.lastSplitWidth`), open. `MarkdownTestMessagePeek` renders a markdown message through `markdown_view.rs` in testing.css `.preview-text` (8px 12px 8px 20px padding, paragraphs 1em apart at `line-height: normal`, 15px here), and its results row reads the rendered text (`renderTestMessageAsText`). ui-pair of a `markdown "..."` test (tests-provider): text box 240x77 at the same left in both, 1px lower in the reference. `TerminalMessagePeek` writes a task's output, a test's output or an output message's range into a detached terminal (`TerminalView.detached`: an `extension_pty` instance with ids counting down from `u32::MAX`, kept out of the terminal list), appending when the earlier text is its prefix and resetting with `\x1bc` otherwise; an empty finished output writes the `formatMessageForTerminal` notice. It attaches with `enableGpu: false`, so the DomRenderer lays the cells out on the unrounded advance (Menlo 12: 7.2px, `CellMetrics.dom_cell_width`), not the WebGL renderer's whole device pixels. ui-pair of the `markdown "..."` test's output: the line is 385px wide in the reference and 384px in the port, at the same origin.- Continuous run (`workbench/testing_continuous.rs`): the view title's dropdown of `getContinuousRunDropdown` runs plain actions upstream; the port's context menu runs commands, so each profile item is an internal `_testing.toggleContinuousRunProfile.<controller>.<profile>` command registered when the menu shows. testingExplorerView.ts re-sorts a parent when a continuous run changes, but `TreeSorter` has no continuous run criterion in 1.147.0, so the order does not change; the port draws rows from the run state each frame and needs no re-sort. The unattended restart participant `testing.continuousRun` waits on the unattended restart service (ledger row workbench/services/lifecycle).- Inline values (`workbench/debug_inline_values.rs`; debugEditorContribution.ts): `debug.inlineValues` `on` or `auto` with a provider shows the focused frame's values as `InjectionOwner::DebugInlineValue` text after the lines, `editor.inlineValuesForeground` on `editor.inlineValuesBackground`. Shortcuts: only the active editor shows them, where upstream decorates every editor on the frame's file; the scopes and variables are fetched again, not shared with the Variables view's cache; the text area width stands in for `layoutInfo.width` in the line length cut.- Debug hover (`workbench/debug_hover.rs`; debugHover.ts, debugEditorContribution.ts hover handling): while stopped, the expression at the mouse in the focused frame's file (the first `EvaluatableExpressionProvider` through `$provideEvaluatableExpression`, else `getExactExpressionStartAndEnd`) is evaluated with `context: "hover"` (or looked up in the cheap scopes without `supportsEvaluateForHovers`) after the doubled `editor.hover.delay`, the editor hover off meanwhile; Alt swaps it for the editor hover; Cmd+K Cmd+I shows it at the cursor. The focused tree takes listWidget.ts's and abstractTree.ts's keys through the `list.*` commands (Up, Down, Page Up, Page Down, Home, End, Left, Right, Space, Enter, type navigation by name), Escape clears a selection before it hides the widget; `layoutTree` sizes the tree to its rows plus 10px, at most max(266px, 55% of the editor) and the hovered line's top less 22px. The 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.