Visual Studio Code, rebuilt in Rust
Rust
feat(testing): port the Test Results tree with its menus and message rows
rokartur506d52aba157
diff --git a/native/crates/app/src/menus.rs b/native/crates/app/src/menus.rsindex 8b84855b5e4..3df2f366065 100644--- a/native/crates/app/src/menus.rs+++ b/native/crates/app/src/menus.rs@@ -136,6 +136,11 @@ pub enum MenuId {TestProfilesContext,/// `MenuId.TestItemGutter`: a test's items in the editor gutter's menu.TestItemGutter,+ /// `MenuId.TestPeekElement`, `TestMessageContext` and `TestMessageContent`: a Test Results row's actions, a+ /// message row's, and the message view's floating button.+ TestPeekElement,+ TestMessageContext,+ TestMessageContent,/// `MenuId.DebugCallStackContext`: a Call Stack row's context menu.DebugCallStackContext,/// `MenuId.DebugVariablesContext`: a Variables row's context menu.@@ -1015,6 +1020,9 @@ const API_MENUS: &[(&str, MenuId)] = &[("testing/item/context", MenuId::TestItem),("testing/profiles/context", MenuId::TestProfilesContext),("testing/item/gutter", MenuId::TestItemGutter),+ ("testing/item/result", MenuId::TestPeekElement),+ ("testing/message/context", MenuId::TestMessageContext),+ ("testing/message/content", MenuId::TestMessageContent),("debug/callstack/context", MenuId::DebugCallStackContext),("debug/variables/context", MenuId::DebugVariablesContext),("debug/watch/context", MenuId::DebugWatchContext),diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rsindex 20d311e6fcf..82d292ee920 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -41,6 +41,7 @@ mod disassembly_view;mod testing_continuous;mod testing_filter;mod testing_gutter;+mod testing_results;mod testing_item_menu;mod testing_profiles;pub(crate) mod testing_service;diff --git a/native/crates/app/src/workbench/testing_gutter.rs b/native/crates/app/src/workbench/testing_gutter.rsindex f37ad32b21c..e6de4e7520b 100644--- a/native/crates/app/src/workbench/testing_gutter.rs+++ b/native/crates/app/src/workbench/testing_gutter.rs@@ -36,16 +36,16 @@ impl Workbench {let mut actions = Vec::new();for (group, title) in [(GROUP_RUN, "Run Test"), (GROUP_DEBUG, "Debug Test"), (GROUP_COVERAGE, "Run with Coverage")] {if capabilities & group != 0 {- actions.push(self.gutter_action(title, "vscode.runTestsById", vec![json!(group), json!(id)]));+ actions.push(self.bound_action(title, "vscode.runTestsById", vec![json!(group), json!(id)]));}}if capabilities & HAS_NON_DEFAULT_PROFILE != 0 {- actions.push(self.gutter_action("Execute Using Profile...", "testing.runUsing", vec![json!(id)]));+ actions.push(self.bound_action("Execute Using Profile...", "testing.runUsing", vec![json!(id)]));}if self.testing.state_of(id) == Some(ResultState::Running) {- actions.push(self.gutter_action("Cancel Test Run", "testing.cancelRun", Vec::new()));+ actions.push(self.bound_action("Cancel Test Run", "testing.cancelRun", Vec::new()));}- actions.push(self.gutter_action("Reveal in Test Explorer", "_revealTestInExplorer", vec![json!(id)]));+ actions.push(self.bound_action("Reveal in Test Explorer", "_revealTestInExplorer", vec![json!(id)]));// `getContributedTestActions`: `MenuId.TestItemGutter` with the test as its argument.let context = self.test_item_context(id, window);let contributed = menu_actions(&self.menus, MenuId::TestItemGutter, &context);@@ -54,7 +54,7 @@ impl Workbench {actions.push(MenuAction::Separator);}for action in contributed {- let action = self.forward_with_arg(action, &arg);+ let action = self.forward_with_args(action, std::slice::from_ref(&arg));actions.push(action);}actions@@ -68,7 +68,7 @@ impl Workbench {if tests.iter().any(|id| self.test_capabilities(id) & group != 0) {let mut args = vec![json!(group)];args.extend(tests.iter().map(|id| json!(id)));- actions.push(self.gutter_action(title, "vscode.runTestsById", args));+ actions.push(self.bound_action(title, "vscode.runTestsById", args));}}let items = &self.testing.collection.items;@@ -107,14 +107,14 @@ impl Workbench {actions}- /// An item running `command` with `args`, registered under an id of its own since the gutter's menu passes every- /// item the line's `{ lineNumber, uri }`.- fn gutter_action(&mut self, title: &str, command: &str, args: Vec<Value>) -> MenuAction {- MenuAction::Command { id: self.gutter_command(command, args), title: title.into(), enabled: true, checked: false, alt: None }+ /// An item running `command` with `args`, registered under an id of its own since a menu passes every item the+ /// same arguments: the gutter's the line's `{ lineNumber, uri }`, the Test Results tree's the row's context.+ pub(super) fn bound_action(&mut self, title: &str, command: &str, args: Vec<Value>) -> MenuAction {+ MenuAction::Command { id: self.bound_command(command, args), title: title.into(), enabled: true, checked: false, alt: None }}- fn gutter_command(&mut self, command: &str, args: Vec<Value>) -> String {- let id = format!("_testing.gutter:{command}:{}", Value::from(args.clone()));+ 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();self.commands.register(id.clone(), move |workbench, _, window, cx| workbench.execute_command(&command, args.clone(), window, cx));@@ -122,18 +122,18 @@ impl Workbench {id}- /// `shouldForwardArgs` with `arg`: a contributed item and its alternative run with the test.- fn forward_with_arg(&mut self, action: MenuAction, arg: &Value) -> MenuAction {+ /// `shouldForwardArgs` with `args`: a contributed item and its alternative run with them.+ pub(super) fn forward_with_args(&mut self, action: MenuAction, args: &[Value]) -> MenuAction {match action {MenuAction::Command { id, title, enabled, checked, alt } => {- let alt = alt.map(|(alt_id, alt_title)| (self.gutter_command(&alt_id, vec![arg.clone()]), alt_title));- MenuAction::Command { id: self.gutter_command(&id, vec![arg.clone()]), title, enabled, checked, alt }+ let alt = alt.map(|(alt_id, alt_title)| (self.bound_command(&alt_id, args.to_vec()), alt_title));+ MenuAction::Command { id: self.bound_command(&id, args.to_vec()), title, enabled, checked, alt }}- MenuAction::Submenu { title, actions, checked } => MenuAction::Submenu { title, actions: actions.into_iter().map(|action| self.forward_with_arg(action, arg)).collect(), checked },+ MenuAction::Submenu { title, actions, checked } => MenuAction::Submenu { title, actions: actions.into_iter().map(|action| self.forward_with_args(action, args)).collect(), checked },MenuAction::Separator => MenuAction::Separator,}}}#[cfg(test)]-mod tests;+pub(super) mod tests;diff --git a/native/crates/app/src/workbench/testing_gutter/tests.rs b/native/crates/app/src/workbench/testing_gutter/tests.rsindex 59c0e1f97a3..4cc1bb4a869 100644--- a/native/crates/app/src/workbench/testing_gutter/tests.rs+++ b/native/crates/app/src/workbench/testing_gutter/tests.rs@@ -18,12 +18,12 @@ fn profile(profile_id: i64, label: &str, group: u64, is_default: bool) -> ProfilProfile { controller_id: "c".into(), profile_id, label: label.into(), group, is_default, tag: None, supports_continuous_run: false, has_configuration_handler: false }}-fn contributed(menu: MenuId, command: &str, title: &str) -> MenuItem {+pub(in crate::workbench) fn contributed(menu: MenuId, command: &str, title: &str) -> MenuItem {MenuItem { menu, entry: Entry::Command { id: command.into(), precondition: None, toggled: None, alt: None }, title: title.into(), group: String::new(), order: 0., when: None }}/// A workbench with `test.js` open and the tests `(id, label, line)` of controller `c` in it.-fn workbench_with_tests<'a>(name: &str, tests: &[(&str, &str, u32)], cx: &'a mut TestAppContext) -> (gpui::Entity<Workbench>, &'a mut VisualTestContext, Receiver<HostMessage>) {+pub(in crate::workbench) fn workbench_with_tests<'a>(name: &str, tests: &[(&str, &str, u32)], cx: &'a mut TestAppContext) -> (gpui::Entity<Workbench>, &'a mut VisualTestContext, Receiver<HostMessage>) {let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();let theme = crate::theme::load_theme(&[exthost::scan::scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap()], "Dark Modern").unwrap();let dir = std::env::temp_dir().join(format!("code-gpui-{name}-{}", std::process::id()));@@ -55,7 +55,7 @@ fn workbench_with_tests<'a>(name: &str, tests: &[(&str, &str, u32)], cx: &'a mut(workbench, cx, host)}-fn titles(actions: &[MenuAction]) -> Vec<String> {+pub(in crate::workbench) fn titles(actions: &[MenuAction]) -> Vec<String> {actions.iter().map(|action| match action {@@ -66,7 +66,7 @@ fn titles(actions: &[MenuAction]) -> Vec<String> {.collect()}-fn command_titled(actions: &[MenuAction], wanted: &str) -> String {+pub(in crate::workbench) fn command_titled(actions: &[MenuAction], wanted: &str) -> String {actions.iter().find_map(|action| match action {MenuAction::Command { id, title, .. } if title == wanted => Some(id.clone()),_ => None,diff --git a/native/crates/app/src/workbench/testing_item_menu.rs b/native/crates/app/src/workbench/testing_item_menu.rsindex 5869f6299e2..9120512103c 100644--- a/native/crates/app/src/workbench/testing_item_menu.rs+++ b/native/crates/app/src/workbench/testing_item_menu.rs@@ -34,6 +34,19 @@ pub(super) fn test_ids(args: &[Value]) -> Vec<String> {ids}+/// testingContextKeys.ts `testResultStateToContextValues`.+pub(super) fn result_state_context(state: ResultState) -> &'static str {+ match state {+ ResultState::Unset => "unset",+ ResultState::Queued => "queued",+ ResultState::Running => "running",+ ResultState::Passed => "passed",+ ResultState::Failed => "failed",+ ResultState::Skipped => "skipped",+ ResultState::Errored => "errored",+ }+}+impl Workbench {pub(super) fn register_test_item_commands(&mut self) {// `RunVisibleAction`: the shown tests within the row's.@@ -123,15 +136,7 @@ impl Workbench {let capabilities = self.test_capabilities(id);let supports_continuous = testing.profiles.iter().any(|profile| profile.controller_id == controller && profile.supports_continuous_run && profile.can_run(test));let refreshable = testing.controllers.get(controller).is_some_and(|controller| controller.capabilities & 2 != 0);- let state = match testing.state_of(id).unwrap_or_default() {- ResultState::Unset => "unset",- ResultState::Queued => "queued",- ResultState::Running => "running",- ResultState::Passed => "passed",- ResultState::Failed => "failed",- ResultState::Skipped => "skipped",- ResultState::Errored => "errored",- };+ let state = result_state_context(testing.state_of(id).unwrap_or_default());for (key, value) in [("testing.hasNonDefaultProfile", json!(all & HAS_NON_DEFAULT_PROFILE != 0)),("testId", json!(id.rsplit('\0').next())),diff --git a/native/crates/app/src/workbench/testing_results.rs b/native/crates/app/src/workbench/testing_results.rsnew file mode 100644index 00000000000..6e77c1abe9b--- /dev/null+++ b/native/crates/app/src/workbench/testing_results.rs@@ -0,0 +1,651 @@+//! testResultsTree.ts `OutputPeekTree` and testResultsViewContent.ts: the Test Results view's tree of runs, tasks,+//! tests and their error messages, beside the opened row's message or output.++use std::cmp::Reverse;+use std::collections::HashMap;++use gpui::{ClickEvent, Context, Div, MouseButton, MouseDownEvent, Window, div, prelude::*, px};+use serde_json::{Value, json};++use super::Workbench;+use super::hover::{HoverContent, HoverOptions};+use super::testing_item_menu::result_state_context;+use super::testing_view::state_icon;+use crate::commands::Outcome;+use crate::menus::{MenuAction, MenuId, menu_actions, menu_group_actions};+use crate::testing::{GROUP_DEBUG, GROUP_RUN, ResultState, TestResult, parent_id};++/// marshallingIds.ts `MarshalledId.TestItemContext` and `TestMessageMenuArgs`.+const TEST_ITEM_CONTEXT_MID: u64 = 16;+const TEST_MESSAGE_MENU_ARGS_MID: u64 = 18;+const ROW_HEIGHT: f32 = 22.;++/// A tree element: `TestResultElement`, `OlderResultsElement`, `TaskElement`, `TestCaseElement` or+/// `TestMessageElement`, by result id, task index, test id and message index.+#[derive(Clone, Debug, PartialEq)]+pub enum ResultsElement {+ Result { result: String },+ Older { count: usize },+ Task { result: String, task: usize },+ Test { result: String, task: usize, test: String },+ Message { result: String, task: usize, test: String, message: usize },+}++impl ResultsElement {+ fn id(&self) -> String {+ match self {+ ResultsElement::Result { result } => result.clone(),+ ResultsElement::Older { count } => format!("older-{count}"),+ ResultsElement::Task { result, task } => format!("{result}/{task}"),+ ResultsElement::Test { result, test, .. } => format!("{result}/{test}"),+ ResultsElement::Message { result, task, test, message } => format!("{result}/{task}/{test}/message/{message}"),+ }+ }++ /// `ITreeElement.type`, the `peekItemType` context key.+ fn kind(&self) -> &'static str {+ match self {+ ResultsElement::Result { .. } => "result",+ ResultsElement::Older { .. } => "older",+ ResultsElement::Task { .. } => "task",+ ResultsElement::Test { .. } => "test",+ ResultsElement::Message { .. } => "message",+ }+ }+}++/// testResultsSubject.ts `InspectSubject`: what the content beside the tree shows.+#[derive(Clone, Debug, PartialEq)]+pub enum InspectSubject {+ Task { result: String, task: usize },+ Message { result: String, task: usize, test: String, message: usize },+ Output { result: String, task: usize, test: String },+}++/// A drawn row. A compressed row draws `element` with its only child `subject`, a task or an error message, as+/// `TestRunElementRenderer.renderCompressedElements` does; the tree's events see the child.+#[derive(Clone, Debug, PartialEq)]+pub struct ResultsRow {+ pub element: ResultsElement,+ pub subject: Option<ResultsElement>,+ pub depth: usize,+ pub collapsible: bool,+ pub collapsed: bool,+}++impl ResultsRow {+ /// The element the tree selects and opens.+ fn target(&self) -> &ResultsElement {+ self.subject.as_ref().unwrap_or(&self.element)+ }+}++/// An `ICompressedTreeElement` of `getRootChildren`.+struct Node {+ element: ResultsElement,+ incompressible: bool,+ collapsed: bool,+ children: Vec<Node>,+}++/// A built-in action of `TreeActionsProvider.provideActionBar`, or a menu item when `icon` is None.+pub struct ResultsAction {+ icon: Option<&'static str>,+ title: String,+ command: String,+ args: Vec<Value>,+}++impl ResultsAction {+ fn new(icon: &'static str, title: &str, command: &str, args: Vec<Value>) -> Self {+ ResultsAction { icon: Some(icon), title: title.to_owned(), command: command.to_owned(), args }+ }+}++/// The tests of a result in the order they were added: each chain's parents before its children.+fn tests_in_order(result: &TestResult) -> Vec<&String> {+ let mut ordered = Vec::new();+ let mut stack: Vec<&String> = result.roots.iter().rev().collect();+ while let Some(id) = stack.pop() {+ ordered.push(id);+ stack.extend(result.items[id].children.iter().rev());+ }+ ordered+}++/// `renderTestMessageAsText` of an `ITestMessage.Serialized`: its string, or its markdown's source.+fn message_text(message: &Value) -> &str {+ message["message"].as_str().or(message["message"]["value"].as_str()).unwrap_or_default()+}++fn is_error_message(message: &Value) -> bool {+ message["type"] == 0+}++/// `getResultChildren`: a node per task with its tests that ran or have messages, worst state first, each with+/// its error messages.+fn result_children(result: &TestResult) -> Vec<Node> {+ let order = tests_in_order(result);+ let mut tasks = Vec::new();+ for task in 0..result.tasks.len() {+ let mut tests: Vec<&String> = order.iter().copied().filter(|id| {+ let state = &result.items[*id].tasks[task];+ state.state.to_value() >= ResultState::Running.to_value() || !state.messages.is_empty()+ }).collect();+ tests.sort_by_key(|id| Reverse(result.items[*id].tasks[task].state.priority()));+ let mut children = Vec::new();+ for test in tests {+ let messages = &result.items[test].tasks[task].messages;+ let mut message_nodes = Vec::new();+ for (message, value) in messages.iter().enumerate() {+ if is_error_message(value) {+ let element = ResultsElement::Message { result: result.id.clone(), task, test: test.clone(), message };+ message_nodes.push(Node { element, incompressible: false, collapsed: false, children: Vec::new() });+ }+ }+ let element = ResultsElement::Test { result: result.id.clone(), task, test: test.clone() };+ children.push(Node { element, incompressible: true, collapsed: false, children: message_nodes });+ }+ tasks.push(Node { element: ResultsElement::Task { result: result.id.clone(), task }, incompressible: false, collapsed: false, children });+ }+ tasks+}++/// `getRootChildren`: the tasks of the newest result with tasks, then "n older results" holding the others.+fn root_nodes(results: &[TestResult]) -> Vec<Node> {+ let mut children = Vec::new();+ let mut older = Vec::new();+ for result in results {+ if children.is_empty() && !result.tasks.is_empty() {+ children = result_children(result);+ } else {+ older.push(Node { element: ResultsElement::Result { result: result.id.clone() }, incompressible: true, collapsed: true, children: result_children(result) });+ }+ }+ if children.is_empty() {+ return older;+ }+ if !older.is_empty() {+ children.push(Node { element: ResultsElement::Older { count: older.len() }, incompressible: true, collapsed: true, children: older });+ }+ children+}++/// The visible rows below `node`, compressing a node with its only compressible child.+fn push_rows(node: &Node, depth: usize, toggled: &std::collections::HashSet<String>, rows: &mut Vec<ResultsRow>) {+ let mut last = node;+ let mut chain = vec![&node.element];+ while let [child] = last.children.as_slice()+ && !child.incompressible+ {+ chain.push(&child.element);+ last = child;+ }+ let (element, subject) = match chain.as_slice() {+ [.., parent, child @ (ResultsElement::Task { .. } | ResultsElement::Message { .. })] => (*parent, Some((*child).clone())),+ [.., only] => (*only, None),+ [] => unreachable!("the chain starts with the node"),+ };+ let collapsible = !last.children.is_empty();+ let collapsed = collapsible && node.collapsed != toggled.contains(&element.id());+ rows.push(ResultsRow { element: element.clone(), subject, depth, collapsible, collapsed });+ if collapsible && !collapsed {+ for child in &last.children {+ push_rows(child, depth + 1, toggled, rows);+ }+ }+}++impl Workbench {+ pub(super) fn register_testing_results_commands(&mut self) {+ // `requestReveal` of the actions' Show Result Output: a task's output, or a test's in that task.+ self.commands.register("_testing.results.showOutput", |workbench, args, _, cx| {+ let (Some(result), Some(task)) = (args.first().and_then(Value::as_str), args.get(1).and_then(Value::as_u64)) else { return Outcome::done() };+ let (result, task) = (result.to_owned(), task as usize);+ workbench.testing_view.results_subject = Some(match args.get(2).and_then(Value::as_str) {+ Some(test) => InspectSubject::Output { result, task, test: test.to_owned() },+ None => InspectSubject::Task { result, task },+ });+ cx.notify();+ Outcome::done()+ });+ // `Go to Error`: the message's location, keeping focus in the results.+ self.commands.register("_testing.results.goToError", |workbench, args, window, cx| {+ let Some(location) = args.first() else { return Outcome::done() };+ let Some(path) = location["uri"]["path"].as_str().map(std::path::PathBuf::from) else { return Outcome::done() };+ let range = &location["range"];+ let at = |key: &str| range[key].as_u64().unwrap_or(1) as usize;+ workbench.open_file(path.clone(), true, window, cx);+ let range = crate::anything_quick_access::TextRange { start_line_number: at("startLineNumber"), start_column: at("startColumn"), end_line_number: at("endLineNumber"), end_column: at("endColumn") };+ workbench.select_range(&path, range, cx);+ Outcome::done()+ });+ self.commands.register("vscode.revealTest", |workbench, args, window, cx| {+ if let Some(id) = args.first().and_then(Value::as_str) {+ workbench.reveal_test(id, window, cx);+ }+ Outcome::done()+ });+ // testExplorerActions.ts `RunOrDebugLastRun`: the run's request again, or its tests in the other group.+ for (id, group) in [("testing.reRunLastRun", GROUP_RUN), ("testing.debugLastRun", GROUP_DEBUG)] {+ self.commands.register(id, move |workbench, args, window, cx| {+ let run = args.first().and_then(Value::as_str);+ let Some(last) = workbench.testing.results.iter().find(|result| run.is_none_or(|run| result.id == run)) else { return Outcome::done() };+ let request = last.request.clone();+ if request["group"].as_u64().unwrap_or(GROUP_RUN) & group != 0 {+ workbench.run_resolved_tests(request, window, cx);+ cx.notify();+ return Outcome::done();+ }+ let ids: Vec<String> = request["targets"].as_array().into_iter().flatten().flat_map(|target| target["testIds"].as_array().into_iter().flatten()).filter_map(|id| id.as_str().map(str::to_owned)).collect();+ workbench.run_or_notify(&ids, group, window, cx);+ Outcome::done()+ });+ }+ // `RunOrDebugFailedTests`: the tests whose latest own state across the results is failed or errored.+ for (id, group) in [("testing.reRunFailedFromLastRun", GROUP_RUN), ("testing.debugFailedFromLastRun", GROUP_DEBUG)] {+ self.commands.register(id, move |workbench, _, window, cx| {+ let mut failed = Vec::new();+ for result in workbench.testing.results.iter().rev() {+ for (test, item) in &result.items {+ failed.retain(|id| id != test);+ if matches!(item.own_state, ResultState::Failed | ResultState::Errored) {+ failed.push(test.clone());+ }+ }+ }+ failed.sort();+ workbench.run_or_notify(&failed, group, window, cx);+ Outcome::done()+ });+ }+ }++ /// The rows the tree shows, `testing_view.results_toggled` holding the rows flipped from their default.+ pub(super) fn results_rows(&self) -> Vec<ResultsRow> {+ let mut rows = Vec::new();+ for node in root_nodes(&self.testing.results) {+ push_rows(&node, 0, &self.testing_view.results_toggled, &mut rows);+ }+ rows+ }++ fn result_by_id(&self, id: &str) -> Option<&TestResult> {+ self.testing.results.iter().find(|result| result.id == id)+ }++ /// `ITreeElement` `label`, `description` and `icon`.+ fn results_label(&self, element: &ResultsElement) -> (String, Option<String>, Option<ResultState>) {+ match element {+ ResultsElement::Result { result } => {+ let result = self.result_by_id(result).expect("rows come from the results");+ let state = match result.completed_at {+ None => ResultState::Running,+ Some(_) => result.items.values().fold(ResultState::Unset, |state, item| state.max(item.own_state)),+ };+ (result.name(), None, Some(state))+ }+ ResultsElement::Older { count: 1 } => ("1 older result".into(), None, None),+ ResultsElement::Older { count } => (format!("{count} older results"), None, None),+ ResultsElement::Task { result, task } => {+ let task = &self.result_by_id(result).expect("rows come from the results").tasks[*task];+ (task.name.clone(), None, task.running.then_some(ResultState::Running))+ }+ ResultsElement::Test { result, task, test } => {+ let result = self.result_by_id(result).expect("rows come from the results");+ let item = &result.items[test];+ let mut parents = Vec::new();+ let mut parent = parent_id(test);+ while let Some(id) = parent.filter(|id| parent_id(id).is_some()) {+ let Some(parent_item) = result.items.get(id) else { break };+ parents.push(parent_item.label().to_owned());+ parent = parent_id(id);+ }+ let description = parent_id(test).map(|_| parents.join(" \u{2039} "));+ (item.label().to_owned(), description, Some(item.tasks[*task].state))+ }+ ResultsElement::Message { result, task, test, message } => {+ let result = self.result_by_id(result).expect("rows come from the results");+ let text = message_text(&result.items[test].tasks[*task].messages[*message]);+ let lines = text.trim_end().matches('\n').count();+ let description = match lines {+ 0 => None,+ 1 => Some("+ 1 more line".to_owned()),+ lines => Some(format!("+ {lines} more lines")),+ };+ (text.split('\n').next().unwrap_or_default().to_owned(), description, None)+ }+ }+ }++ /// `doRenderInner`: a row compressed with an error message describes itself with the message.+ pub(super) fn results_row_label(&self, row: &ResultsRow) -> (String, Option<String>, Option<ResultState>) {+ let (label, description, state) = self.results_label(&row.element);+ let Some(subject @ ResultsElement::Message { .. }) = &row.subject else { return (label, description, state) };+ let message = self.results_label(subject).0;+ let description = match description {+ Some(own) => format!("{message} @ {own}"),+ None => message,+ };+ (label, Some(description), state)+ }++ /// `getTaskContext`.+ fn result_task_context(&self, result: &str, task: usize) -> Value {+ let task = &self.result_by_id(result).expect("rows come from the results").tasks[task];+ json!({ "testRunName": task.name, "controllerId": task.controller_id, "resultId": result, "taskId": task.id })+ }++ /// `InternalTestItem.serialize` of the result's test.+ fn result_test_arg(&self, result: &str, test: &str) -> Value {+ let item = &self.result_by_id(result).expect("rows come from the results").items[test];+ json!({ "expand": item.expand, "item": item.item })+ }++ /// The element's `context`, spread over the actions' arguments by `SpreadableActionRunner`.+ fn results_element_args(&self, element: &ResultsElement) -> Vec<Value> {+ match element {+ ResultsElement::Result { result } => vec![json!(result)],+ ResultsElement::Older { .. } => Vec::new(),+ ResultsElement::Task { result, task } => vec![self.result_task_context(result, *task)],+ ResultsElement::Test { result, task, test } => vec![json!({ "$mid": TEST_ITEM_CONTEXT_MID, "tests": [self.result_test_arg(result, test)] }), self.result_task_context(result, *task)],+ ResultsElement::Message { result, task, .. } => vec![self.message_args(element), self.result_task_context(result, *task)],+ }+ }++ /// testResultsSubject.ts `getMessageArgs`.+ fn message_args(&self, element: &ResultsElement) -> Value {+ let ResultsElement::Message { result, task, test, message } = element else { unreachable!("a message element") };+ let message = &self.result_by_id(result).expect("rows come from the results").items[test].tasks[*task].messages[*message];+ json!({ "$mid": TEST_MESSAGE_MENU_ARGS_MID, "test": self.result_test_arg(result, test), "message": message })+ }++ /// `TreeActionsProvider.provideActionBar`: the built-in actions, then the `inline` group of+ /// `MenuId.TestPeekElement` (`MenuId.TestMessageContext` on a message) as primary and the other groups after+ /// the built-in secondary ones.+ pub(super) fn results_actions(&self, element: &ResultsElement, window: &Window) -> (Vec<ResultsAction>, Vec<ResultsAction>, Vec<MenuAction>) {+ let mut primary = Vec::new();+ let mut secondary = Vec::new();+ let mut context = self.key_context(window);+ let mut menu = MenuId::TestPeekElement;+ match element {+ ResultsElement::Task { result: result_id, task } => {+ let result = self.result_by_id(result_id).expect("rows come from the results");+ primary.push(ResultsAction::new("terminal", "Show Result Output", "_testing.results.showOutput", vec![json!(result_id), json!(task)]));+ if result.tasks[*task].running {+ primary.push(ResultsAction::new("debug-stop", "Cancel Test Run", "testing.cancelRun", vec![json!(result_id), json!(result.tasks[*task].id)]));+ } else {+ let failed = result.items.values().any(|item| matches!(item.own_state, ResultState::Failed | ResultState::Errored));+ primary.push(ResultsAction::new("debug-rerun", "Rerun Last Run", "testing.reRunLastRun", vec![json!(result_id)]));+ if failed {+ primary.push(ResultsAction::new("debug-rerun", "Rerun Failed Tests", "testing.reRunFailedFromLastRun", vec![json!(result_id)]));+ }+ primary.push(ResultsAction::new("debug-alt-small", "Debug Last Run", "testing.debugLastRun", vec![json!(result_id)]));+ if failed {+ primary.push(ResultsAction::new("debug-alt-small", "Debug Failed Tests", "testing.debugFailedFromLastRun", vec![json!(result_id)]));+ }+ }+ }+ ResultsElement::Result { result: result_id } => {+ let result = self.result_by_id(result_id).expect("rows come from the results");+ if result.tasks.len() == 1 {+ primary.push(ResultsAction::new("terminal", "Show Result Output", "_testing.results.showOutput", vec![json!(result_id), json!(0)]));+ }+ primary.push(ResultsAction::new("run", "Rerun Test", "testing.reRunLastRun", vec![json!(result_id)]));+ if result.items.values().any(|item| matches!(item.own_state, ResultState::Failed | ResultState::Errored)) {+ primary.push(ResultsAction::new("debug-rerun", "Rerun Failed Tests", "testing.reRunFailedFromLastRun", vec![json!(result_id)]));+ }+ }+ ResultsElement::Test { result: result_id, task, test } | ResultsElement::Message { result: result_id, task, test, .. } => {+ let result = self.result_by_id(result_id).expect("rows come from the results");+ 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("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)]));+ }+ if item.tasks[*task].messages.iter().any(|message| !is_error_message(message)) {+ primary.push(ResultsAction::new("terminal", "Show Result Output", "_testing.results.showOutput", vec![json!(result_id), json!(task), json!(test)]));+ }+ secondary.push(ResultsAction::new("list-tree", "Reveal in Test Explorer", "_revealTestInExplorer", vec![json!(test)]));+ if capabilities & GROUP_RUN != 0 {+ primary.push(ResultsAction::new("run", "Run Test", "vscode.runTestsById", vec![json!(GROUP_RUN), json!(test)]));+ }+ if capabilities & GROUP_DEBUG != 0 {+ primary.push(ResultsAction::new("debug-alt-small", "Debug Test", "vscode.runTestsById", vec![json!(GROUP_DEBUG), json!(test)]));+ }+ }+ ResultsElement::Older { .. } => {}+ }+ if let ResultsElement::Message { result, task, test, message } = element {+ menu = MenuId::TestMessageContext;+ let message = &self.result_by_id(result).expect("rows come from the results").items[test].tasks[*task].messages[*message];+ context.insert("testMessage".into(), message["contextValue"].clone());+ // testingOutputPeek.ts `TestResultsView` passes `showRevealLocationOnMessages: true`.+ if message["location"].is_object() {+ primary.push(ResultsAction::new("debug-stackframe", "Go to Error", "_testing.results.goToError", vec![message["location"].clone()]));+ }+ }+ context.insert("peek".into(), json!("editor.contrib.testingOutputPeek"));+ context.insert("peekItemType".into(), json!(element.kind()));+ let args = self.results_element_args(element);+ for action in menu_group_actions(&self.menus, menu, &context, |group| group == "inline") {+ if let MenuAction::Command { id, title, .. } = action {+ primary.push(ResultsAction { icon: None, title, command: id, args: args.clone() });+ }+ }+ let contributed = menu_group_actions(&self.menus, menu, &context, |group| group != "inline");+ (primary, secondary, contributed)+ }++ /// `OutputPeekTree.onContextMenu`: the row's primary actions, a separator, then its secondary ones.+ fn show_results_menu(&mut self, element: &ResultsElement, position: gpui::Point<gpui::Pixels>, window: &mut Window, cx: &mut Context<Self>) {+ let actions = self.results_menu_actions(element, window);+ let context = self.key_context(window);+ self.show_context_menu_actions(actions, &context, gpui::Bounds::new(position, Default::default()), Vec::new(), window, cx);+ }++ pub(super) fn results_menu_actions(&mut self, element: &ResultsElement, window: &Window) -> Vec<MenuAction> {+ let (primary, secondary, contributed) = self.results_actions(element, window);+ let args = self.results_element_args(element);+ let mut actions: Vec<MenuAction> = primary.into_iter().map(|action| self.bound_action(&action.title, &action.command, action.args)).collect();+ let mut rest: Vec<MenuAction> = secondary.into_iter().map(|action| self.bound_action(&action.title, &action.command, action.args)).collect();+ if !rest.is_empty() && !contributed.is_empty() {+ rest.push(MenuAction::Separator);+ }+ for action in contributed {+ let action = self.forward_with_args(action, &args);+ rest.push(action);+ }+ if !rest.is_empty() {+ actions.push(MenuAction::Separator);+ actions.extend(rest);+ }+ actions+ }++ /// `onDidOpen`: a message shows itself, a test its first message or else its output, the others nothing.+ fn open_results_element(&mut self, element: &ResultsElement) {+ let subject = match element {+ ResultsElement::Message { result, task, test, message } => InspectSubject::Message { result: result.clone(), task: *task, test: test.clone(), message: *message },+ ResultsElement::Test { result: result_id, test, .. } => {+ let result = self.result_by_id(result_id).expect("rows come from the results");+ let first = result.items[test].tasks.iter().enumerate().find_map(|(task, state)| (!state.messages.is_empty()).then_some(task));+ match first {+ Some(task) => InspectSubject::Message { result: result_id.clone(), task, test: test.clone(), message: 0 },+ None => InspectSubject::Output { result: result_id.clone(), task: 0, test: test.clone() },+ }+ }+ _ => return,+ };+ self.testing_view.results_subject = Some(subject);+ }++ /// The Test Results view: the opened subject's text and, by `testing.resultsView.layout`, the tree on its right+ /// or left, each half the width (`Sizing.Distribute`).+ pub(super) fn test_results_body(&self, window: &Window, cx: &mut Context<Self>) -> Div {+ let content = self.results_content(window, cx);+ let tree = self.results_tree(window, cx);+ let body = div().flex_1().min_h_0().flex();+ match self.setting("testing.resultsView.layout").as_str() {+ Some("treeLeft") => body.child(tree).child(content),+ _ => body.child(content).child(tree),+ }+ }++ fn results_tree(&self, window: &Window, cx: &mut Context<Self>) -> gpui::Stateful<Div> {+ let mut tree = div()+ .id("test-results-tree")+ .flex_1()+ .min_w_0()+ .overflow_y_scroll()+ .border_l_1()+ .border_color(self.color("panelSection.border"))+ .text_color(self.color("editor.foreground"))+ .flex()+ .flex_col();+ let selected = self.testing_view.results_selected.clone();+ for row in self.results_rows() {+ let is_selected = selected.as_ref() == Some(&row.target().id());+ tree = tree.child(self.results_row(row, is_selected, window, cx));+ }+ tree+ }++ /// `TestRunElementRenderer.doRenderInner`: twistie, state icon, label with its description, and the primary+ /// actions while hovered (testing.css `.testing-stdtree-container`).+ fn results_row(&self, row: ResultsRow, selected: bool, window: &Window, cx: &mut Context<Self>) -> gpui::Stateful<Div> {+ let (label, description, state) = self.results_row_label(&row);+ let twistie_color = self.foreground_or("icon.foreground");+ let hover = self.color("list.hoverBackground");+ let id = row.target().id();+ let mut label_box = div().flex_1().min_w_0().flex().items_baseline().overflow_hidden().whitespace_nowrap().child(div().min_w_0().overflow_hidden().text_ellipsis().child(label));+ if let Some(description) = description.filter(|description| !description.is_empty()) {+ label_box = label_box.child(div().flex_1().min_w_0().overflow_hidden().text_ellipsis().ml(px(6.5)).text_size(px(11.7)).opacity(0.7).child(description));+ }+ let mut actions = div().flex().flex_none().mr(px(10.)).invisible().group_hover("results-row", |actions| actions.visible());+ let (primary, ..) = self.results_actions(&row.element, window);+ for action in primary {+ actions = actions.child(self.results_action_button(action, cx));+ }+ let (toggle, open, menu) = (row.element.id(), row.target().clone(), row.element.clone());+ let collapsible = row.collapsible;+ div()+ .id(gpui::SharedString::from(format!("results-row:{id}")))+ .group("results-row")+ .h(px(ROW_HEIGHT))+ .flex_none()+ .pl(px(8. * row.depth as f32 + 4.))+ .flex()+ .items_center()+ .cursor_pointer()+ .hover(move |row| row.bg(hover))+ .when(selected, |row| row.bg(self.color("list.inactiveSelectionBackground")))+ .child(match row.collapsible {+ true => self.icon(if row.collapsed { "chevron-right" } else { "chevron-down" }, 16., 16., twistie_color),+ false => div().w(px(16.)).flex_none(),+ })+ .child(match state {+ Some(state) => {+ let (icon, color) = state_icon(state);+ self.icon(icon, 16., 16., self.foreground_or(color)).mr(px(3.25))+ }+ None => div().w(px(3.25)).flex_none(),+ })+ .child(label_box)+ .child(actions)+ .on_click(cx.listener(move |workbench, _: &ClickEvent, _, cx| {+ workbench.testing_view.results_selected = Some(open.id());+ if collapsible && !workbench.testing_view.results_toggled.remove(&toggle) {+ workbench.testing_view.results_toggled.insert(toggle.clone());+ }+ workbench.open_results_element(&open);+ cx.notify();+ }))+ .on_mouse_down(MouseButton::Right, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| {+ workbench.show_results_menu(&menu, event.position, window, cx);+ }))+ }++ fn results_action_button(&self, action: ResultsAction, cx: &mut Context<Self>) -> gpui::Stateful<Div> {+ let foreground = self.foreground_or("icon.foreground");+ let Some(icon) = action.icon else { return self.command_button(&action.command, action.title, action.args, foreground, cx) };+ let (command, args) = (action.command, action.args);+ self.icon(icon, 22., 16., foreground)+ .id(gpui::SharedString::from(format!("results-action-{command}-{}", Value::from(args.clone()))))+ .rounded(px(4.))+ .cursor_pointer()+ .hover(|icon| icon.bg(self.color("toolbar.hoverBackground")))+ .on_mouse_down(MouseButton::Left, super::scm_view::stop_action_mouse_down)+ .on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {+ cx.stop_propagation();+ drop(workbench.execute_command(&command, args.clone(), window, cx));+ }))+ .child(self.hover_target(gpui::SharedString::from(format!("results-action-hover-{}", action.title)), HoverContent::Text(action.title), HoverOptions::action_item()))+ }++ /// The subject's text: a message, a task's output or a test's output in a task, as plain lines; a message+ /// with testResultsViewContent.ts `populateFloatingClick`'s button.+ fn results_content(&self, window: &Window, cx: &mut Context<Self>) -> gpui::Stateful<Div> {+ let mut content = div().id("test-results-output").flex_1().min_w_0().relative().overflow_y_scroll().p(px(8.)).font_family("Menlo").text_size(px(12.)).flex().flex_col();+ let text = match &self.testing_view.results_subject {+ Some(InspectSubject::Task { result, task }) => self.result_by_id(result).and_then(|result| result.tasks.get(*task)).map(|task| task.output.clone()),+ Some(InspectSubject::Output { result, task, test }) => self.result_by_id(result).and_then(|result| result.items.get(test)).map(|item| {+ item.tasks[*task].messages.iter().filter(|message| !is_error_message(message)).map(message_text).collect::<String>()+ }),+ Some(InspectSubject::Message { result, task, test, message }) => self.result_by_id(result).map(|result| message_text(&result.items[test].tasks[*task].messages[*message]).to_owned()),+ None => None,+ };+ for line in super::debug_console::strip_ansi(&text.unwrap_or_default()).lines() {+ content = content.child(div().whitespace_nowrap().child(line.to_owned()));+ }+ content.children(self.results_floating_button(window, cx))+ }++ /// floatingMenu.ts `FloatingClickMenu` of `MenuId.TestMessageContent`: its first item as a button at the+ /// message's bottom right (testing.css `.floating-click-widget`), run with `getMessageArgs`.+ 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 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));+ let first = menu_actions(&self.menus, MenuId::TestMessageContent, &context).into_iter().find_map(|action| match action {+ MenuAction::Command { id, title, .. } => Some((id, title)),+ _ => None,+ })?;+ Some((first.0, first.1, self.message_args(&element)))+ }++ fn results_floating_button(&self, window: &Window, cx: &mut Context<Self>) -> Option<gpui::Stateful<Div>> {+ let (command, title, arg) = self.results_floating_action(window)?;+ let background = self.theme.color("button.background").unwrap_or(self.color("editor.background"));+ let foreground = self.theme.color("button.foreground").unwrap_or(self.color("editor.foreground"));+ let mut button = div()+ .id("test-message-floating-click")+ .absolute()+ .right(px(20.))+ .bottom(px(10.))+ .px(px(11.))+ .py(px(6.))+ .rounded(px(2.))+ .cursor_pointer()+ .bg(background)+ .text_color(foreground)+ .text_size(px(13.))+ .child(title)+ .on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {+ drop(workbench.execute_command(&command, vec![arg.clone()], window, cx));+ }));+ if let Some(border) = self.theme.color("contrastBorder") {+ button = button.border_1().border_color(border);+ }+ Some(button)+ }+}++#[cfg(test)]+mod tests;diff --git a/native/crates/app/src/workbench/testing_results/tests.rs b/native/crates/app/src/workbench/testing_results/tests.rsnew file mode 100644index 00000000000..f776713ae24--- /dev/null+++ b/native/crates/app/src/workbench/testing_results/tests.rs@@ -0,0 +1,125 @@+use gpui::TestAppContext;+use serde_json::{Value, json};++use super::{InspectSubject, ResultsElement};+use crate::menus::{Entry, MenuId, MenuItem};+use crate::testing::{ResultState, TestResult};+use crate::workbench::Workbench;+use crate::workbench::testing_gutter::tests::{contributed, titles, workbench_with_tests};++const TESTS: &[(&str, &str, u32)] = &[("c\0f", "math", 0), ("c\0f\0a", "adds", 1), ("c\0f\0b", "subtracts", 2), ("c\0f\0c", "throws", 3)];++fn error(text: &str) -> Value {+ json!({ "type": 0, "message": text, "expected": null, "actual": null, "contextValue": "diff", "location": null })+}++/// A result of one task in which `adds` passed, `subtracts` failed with one message and `throws` with two, and an+/// older result in which `adds` passed.+fn add_results(workbench: &mut Workbench) {+ let chain = |workbench: &Workbench, id: &str| -> Vec<Value> {+ let file = workbench.testing.collection.items["c\0f"].item.clone();+ vec![workbench.testing.collection.items["c"].item.clone(), file, workbench.testing.collection.items[id].item.clone()]+ };+ let mut older = TestResult::new("r0".into(), json!({ "group": 2, "targets": [{ "testIds": ["c\0f\0a"] }] }));+ older.add_task(&json!({ "id": "t0", "name": "Old Task", "ctrlId": "c", "running": false }));+ older.add_chain(&chain(workbench, "c\0f\0a"));+ older.update_state("c\0f\0a", "t0", ResultState::Passed, Some(1.));+ older.mark_complete(1);+ let mut newest = TestResult::new("r1".into(), json!({ "group": 2, "targets": [{ "testIds": ["c\0f"] }] }));+ newest.add_task(&json!({ "id": "t1", "name": "Task A", "ctrlId": "c", "running": false }));+ for id in ["c\0f\0a", "c\0f\0b", "c\0f\0c"] {+ newest.add_chain(&chain(workbench, id));+ }+ newest.update_state("c\0f\0a", "t1", ResultState::Passed, Some(1.));+ newest.update_state("c\0f\0b", "t1", ResultState::Failed, Some(1.));+ newest.append_message("c\0f\0b", "t1", error("expected 1\nbut got 2"));+ newest.update_state("c\0f\0c", "t1", ResultState::Failed, Some(1.));+ newest.append_message("c\0f\0c", "t1", error("first"));+ newest.append_message("c\0f\0c", "t1", error("second"));+ newest.mark_complete(2);+ workbench.testing.results = vec![newest, older];+}++fn drawn_rows(workbench: &Workbench) -> Vec<String> {+ workbench+ .results_rows()+ .iter()+ .map(|row| {+ let (label, description, _) = workbench.results_row_label(row);+ format!("{}{label} | {}{}", " ".repeat(row.depth), description.unwrap_or_default(), if row.collapsed { " +" } else { "" })+ })+ .collect()+}++/// testResultsTree.ts `getRootChildren`: the newest result's tasks with the tests that ran, worst first, a test with+/// one error message drawn with it on one row, then the older results collapsed.+#[gpui::test]+fn the_results_tree_shows_tasks_tests_and_messages_as_testresultstree(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with_tests("test-results-tree", TESTS, cx);+ let rows = workbench.update(cx, |workbench, _| {+ add_results(workbench);+ drawn_rows(workbench)+ });+ assert_eq!(rows, ["Task A | ", " subtracts | expected 1 @ math", " throws | math", " first | ", " second | ", " adds | math", "1 older result | +"]);++ let rows = workbench.update(cx, |workbench, _| {+ workbench.testing_view.results_toggled.insert("older-1".into());+ drawn_rows(workbench)+ });+ assert_eq!(rows[6..], ["1 older result | ", " adds | +"]);+}++/// `TreeActionsProvider.provideActionBar` in `onContextMenu`: a test row's built-in actions, its+/// `testing/item/result` items with the test and the task as arguments, and a message row's+/// `testing/message/context` items.+#[gpui::test]+fn a_results_rows_menu_shows_its_actions_and_the_contributed_items(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with_tests("test-results-menu", TESTS, cx);+ let (test_menu, message_menu, result_menu) = workbench.update_in(cx, |workbench, window, _| {+ add_results(workbench);+ workbench.menus.push(MenuItem { group: "inline".into(), ..contributed(MenuId::TestPeekElement, "ext.inline", "Ext Inline") });+ workbench.menus.push(contributed(MenuId::TestPeekElement, "ext.result", "Ext Result"));+ let when = crate::contextkey::Expr::deserialize("testMessage == diff");+ workbench.menus.push(MenuItem { when, ..contributed(MenuId::TestMessageContext, "ext.message", "Ext Message") });+ let test = ResultsElement::Test { result: "r1".into(), task: 0, test: "c\0f\0b".into() };+ let message = ResultsElement::Message { result: "r1".into(), task: 0, test: "c\0f\0c".into(), message: 1 };+ let result = ResultsElement::Result { result: "r0".into() };+ (workbench.results_menu_actions(&test, window), workbench.results_menu_actions(&message, window), workbench.results_menu_actions(&result, window))+ });+ assert_eq!(titles(&test_menu), ["Go to Test", "Run Test", "Debug Test", "Ext Inline", "---", "Reveal in Test Explorer", "---", "Ext Result"]);+ assert_eq!(titles(&message_menu), ["Go to Test", "Run Test", "Debug Test", "---", "Reveal in Test Explorer", "---", "Ext Message"]);+ assert_eq!(titles(&result_menu), ["Show Result Output", "Rerun Test", "Ext Inline", "---", "Ext Result"]);++ let received = std::rc::Rc::new(std::cell::RefCell::new(Vec::new()));+ let sink = received.clone();+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.commands.register("ext.result", move |_, args, _, _| {+ sink.borrow_mut().push(args);+ crate::commands::Outcome::done()+ });+ let id = super::super::testing_gutter::tests::command_titled(&test_menu, "Ext Result");+ drop(workbench.execute_command(&id, Vec::new(), window, cx));+ });+ let args = received.borrow()[0].clone();+ assert_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")));+}++/// 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]+fn an_opened_message_shows_the_first_message_content_item(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with_tests("test-results-content", TESTS, cx);+ let floating = workbench.update_in(cx, |workbench, window, _| {+ add_results(workbench);+ let entry = |id: &str| Entry::Command { id: id.into(), precondition: None, toggled: None, alt: None };+ let when = crate::contextkey::Expr::deserialize("testMessage == diff");+ workbench.menus.push(MenuItem { menu: MenuId::TestMessageContent, entry: entry("ext.accept"), title: "Accept".into(), group: "a".into(), order: 0., when });+ workbench.menus.push(contributed(MenuId::TestMessageContent, "ext.other", "Other"));+ workbench.open_results_element(&ResultsElement::Test { result: "r1".into(), task: 0, test: "c\0f\0c".into() });+ workbench.results_floating_action(window)+ });+ let subject = workbench.read_with(cx, |workbench, _| workbench.testing_view.results_subject.clone());+ assert_eq!(subject, Some(InspectSubject::Message { result: "r1".into(), task: 0, test: "c\0f\0c".into(), message: 0 }));+ let (command, title, arg) = floating.expect("a floating button");+ assert_eq!((command.as_str(), title.as_str(), arg["$mid"].clone(), arg["message"]["message"].clone(), arg["test"]["item"]["extId"].clone()), ("ext.accept", "Accept", json!(18), json!("first"), json!("c\0f\0c")));+}diff --git a/native/crates/app/src/workbench/testing_view.rs b/native/crates/app/src/workbench/testing_view.rsindex fa88d3a68f0..a2ea484e83d 100644--- a/native/crates/app/src/workbench/testing_view.rs+++ b/native/crates/app/src/workbench/testing_view.rs@@ -1,6 +1,5 @@-//! The Testing view container (testingExplorerView.ts), the Test Results editor (testResultsViewContent.ts with-//! its tree and the task output), the run glyphs of testingDecorations.ts and the commands of-//! testExplorerActions.ts.+//! The Testing view container (testingExplorerView.ts), the Test Results panel view's registration, the run glyphs+//! of testingDecorations.ts and the commands of testExplorerActions.ts.use std::collections::HashSet;@@ -26,9 +25,11 @@ pub struct TestingView {/// Rows the user collapsed; others below the roots start collapsed until expanded (`expanded`).pub collapsed: HashSet<String>,pub expanded: HashSet<String>,- /// The result and test the results editor shows the output of.- pub selected_result: Option<String>,- pub selected_test: Option<String>,+ /// The Test Results view: the opened subject, the selected row and the rows flipped from their default+ /// collapse state.+ pub results_subject: Option<super::testing_results::InspectSubject>,+ pub results_selected: Option<String>,+ pub results_toggled: HashSet<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.@@ -42,8 +43,9 @@ impl TestingView {TestingView {collapsed: HashSet::new(),expanded: HashSet::new(),- selected_result: None,- selected_test: None,+ results_subject: None,+ results_selected: None,+ results_toggled: HashSet::new(),continuous_dropdown_bounds: Default::default(),run_dropdown_bounds: Default::default(),debug_dropdown_bounds: Default::default(),@@ -103,6 +105,7 @@ impl Workbench {self.register_testing_profile_commands();self.register_test_item_commands();self.register_testing_gutter_commands();+ self.register_testing_results_commands();self.register_testing_filter_commands();self.commands.register("workbench.view.extension.test", |workbench, args, window, cx| workbench.execute_command("workbench.view.testing", args, window, cx));for (id, group) in [("testing.runAll", GROUP_RUN), ("testing.debugAll", GROUP_DEBUG)] {@@ -151,13 +154,6 @@ impl Workbench {let ids: Vec<String> = args.iter().skip(1).filter_map(|arg| arg.as_str().map(str::to_owned)).collect();Outcome::Ready(Ok(json!(workbench.run_tests(&ids, None, group, window, cx))))});- self.commands.register("testing.reRunLastRun", |workbench, _, window, cx| {- let Some(last) = workbench.testing.results.first() else { return Outcome::done() };- let ids: Vec<String> = last.request["targets"].as_array().into_iter().flatten().flat_map(|target| target["testIds"].as_array().into_iter().flatten()).filter_map(|id| id.as_str().map(str::to_owned)).collect();- let group = last.request["group"].as_u64().unwrap_or(GROUP_RUN);- workbench.run_or_notify(&ids, group, window, cx);- Outcome::done()- });self.commands.register("testing.cancelRun", |workbench, _, _, _| {workbench.cancel_test_runs();Outcome::done()@@ -187,7 +183,7 @@ impl Workbench {}/// The command's tests, else testExplorerActions.ts's "No tests found here" notification.- fn run_or_notify(&mut self, ids: &[String], group: u64, window: &mut Window, cx: &mut Context<Self>) {+ pub(super) fn run_or_notify(&mut self, ids: &[String], group: u64, window: &mut Window, cx: &mut Context<Self>) {if self.run_tests(ids, None, group, window, cx).is_none() {self.notify_error("No tests found here");}@@ -212,8 +208,9 @@ impl Workbench {/// `testing.automaticallyOpenTestResults`: `openOnTestStart` opens the results without focus.pub(super) fn show_test_results_on_start(&mut self, run: &str, cx: &mut Context<Self>) {- self.testing_view.selected_result = Some(run.to_owned());- self.testing_view.selected_test = None;+ // testResultsTree.ts `attachToResults`: a new run reveals its first task.+ self.testing_view.results_subject = Some(super::testing_results::InspectSubject::Task { result: run.to_owned(), task: 0 });+ self.testing_view.results_selected = None;if self.setting("testing.automaticallyOpenTestResults") == "openOnTestStart" {self.open_panel_view(TEST_RESULTS_VIEW_ID, cx);}@@ -225,7 +222,6 @@ impl Workbench {pub(super) fn test_run_finished(&mut self, run: &str, cx: &mut Context<Self>) {let failed = self.testing.results.iter().find(|result| result.id == run).is_some_and(|result| result.count(ResultState::Failed) + result.count(ResultState::Errored) > 0);if failed && self.setting("testing.automaticallyOpenTestResults") == "openOnTestFailure" {- self.testing_view.selected_result = Some(run.to_owned());self.open_panel_view(TEST_RESULTS_VIEW_ID, cx);}}@@ -238,7 +234,7 @@ impl Workbench {view_id: "workbench.panel.testResults.view",title: "Test Results",open: |workbench, _, cx| workbench.open_panel_view(TEST_RESULTS_VIEW_ID, cx),- render: |workbench, _, cx| workbench.test_results_body(cx).into_any_element(),+ render: |workbench, window, cx| workbench.test_results_body(window, cx).into_any_element(),actions: |_, _, _| gpui::Empty.into_any_element(),visible: |workbench| !workbench.testing.results.is_empty(),badge: |_| None,@@ -543,53 +539,4 @@ impl Workbench {.into_any_element(),)}-- /// The Test Results editor: the selected result's tests with their states, then the output of its tasks.- pub(super) fn test_results_body(&self, cx: &mut Context<Self>) -> Div {- let result = match &self.testing_view.selected_result {- Some(id) => self.testing.results.iter().find(|result| result.id == *id),- None => self.testing.results.first(),- };- let mut tree = div().id("test-results-tree").w(px(260.)).flex_none().overflow_y_scroll().border_r_1().border_color(self.color("panel.border")).flex().flex_col();- let mut output = div().id("test-results-output").flex_1().min_w_0().overflow_y_scroll().p(px(8.)).font_family("Menlo").text_size(px(12.)).flex().flex_col();- let Some(result) = result else {- return div().flex_1().min_h_0().flex().child(div().p(px(12.)).child("No test results yet."));- };- let mut queue: Vec<(String, usize)> = result.roots.iter().rev().map(|id| (id.clone(), 0)).collect();- while let Some((id, depth)) = queue.pop() {- let item = &result.items[&id];- let state = result.computed_state(&id);- let (icon, color) = state_icon(state);- let duration = item.own_duration.map(|duration| format!("{}ms", duration.round())).unwrap_or_default();- let selected = self.testing_view.selected_test.as_deref() == Some(id.as_str());- let select_id = id.clone();- tree = tree.child(- div()- .id(gpui::SharedString::from(format!("result:{id}")))- .h(px(ROW_HEIGHT))- .pl(px(8. * depth as f32 + 4.))- .flex()- .items_center()- .cursor_pointer()- .when(selected, |row| row.bg(self.color("list.inactiveSelectionBackground")))- .child(self.icon(icon, 22., 16., self.foreground_or(color)))- .child(div().min_w_0().overflow_hidden().whitespace_nowrap().text_ellipsis().child(item.label().to_owned()))- .child(div().ml_auto().mr(px(6.)).opacity(0.7).text_size(px(11.)).child(duration))- .on_click(cx.listener(move |workbench, _: &ClickEvent, _, cx| {- workbench.testing_view.selected_test = Some(select_id.clone());- cx.notify();- })),- );- queue.extend(item.children.iter().rev().map(|child| (child.clone(), depth + 1)));- }- let lines: Vec<String> = match self.testing_view.selected_test.as_ref().and_then(|id| result.items.get(id)) {- // The selected test's messages: its errors, then what it wrote.- Some(item) => item.tasks.iter().flat_map(|task| task.messages.iter()).map(|message| message["message"].as_str().or(message["message"]["value"].as_str()).unwrap_or_default().to_owned()).collect(),- None => result.tasks.iter().map(|task| task.output.clone()).collect(),- };- for line in lines.iter().flat_map(|text| super::debug_console::strip_ansi(text).lines().map(str::to_owned).collect::<Vec<_>>()) {- output = output.child(div().whitespace_nowrap().child(line));- }- div().flex_1().min_h_0().flex().child(tree).child(output)- }}diff --git a/port/ledger.md b/port/ledger.mdindex 0c211fbb08d..78bb6e2a2bc 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -546,7 +546,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: the Terminal panel view, terminals, split, kill, rename, profiles (`newWithProfile` with `profileName`: cargo test -p app new_with_profile), tabs list, the `TerminalInstanceContext` menu; no exit alert after a Ctrl+D exit (cargo test -p app a_ctrl_d_exit_shows_no_exit_alert); gutter command decorations with their menu (workbench/terminal_decorations.rs), scroll to previous/next command (terminal/marks.rs; cargo test -p app terminal::marks); ui-pair against the reference. Copy as HTML and Copy Output as HTML (terminal/serialize_html.rs; cargo test -p app serialize_html); the decoration hover with duration and exit code (cargo test -p app terminal_decorations, hover); Record Terminal Session (cargo test -p app a_recording_keeps_each_kind_of_event); overview ruler marks, Toggle Visibility (cargo test -p app toggle_visibility_writes_the_decorations_setting), the Rerun Command trust prompt, `terminal.integrated.cwd` variables (cargo test -p app the_cwd_setting_resolves_its_variables); ui-pair of OSC 99, decorations, overview ruler, Copy as HTML and Record Terminal Session (port/results/terminal.md); tab description `terminal.integrated.tabs.description` with `${cwdFolder}` (terminal/label.rs, TerminalLabelComputer and labels.ts `template`), the single tab "fish - docs": cargo test -p app terminal::label; ui-pair m12/folder-terminal.json matches but the reference's panel overflow "..." (its Ports view, remote is out of scope). The grid below `padding-block` 8px with columns from the rendered cell, the title toolbar at the reference's x and its "..." menu (cargo test -p app terminal_view::tests), Run Selected Text and Run Active File with paths quoted as `preparePathForShell` (cargo test -p app paths_are_quoted, call_operator); ui-pair m11/task-presentation.json for `reveal: silent` and `close` (port/results/manage-menu.md). Tab list rows: 4px inset, 8px padding (modernUI tabs.css), `┌ ` prefix, icon, name and description at the reference's device pixels (cargo test -p app a_tab_row_is_inset_and_its_label_is_one_line_of_text; ui-pair terminal tabs). Persistent sessions: panel groups with their splits and active panes, and terminal editors, revive with their history after a restart (cargo test -p app panel_terminals_revive_in_their_groups_after_a_restart a_terminal_editor_revives_with_its_history_after_a_restart) || workbench/contrib/terminalContrib | workbench contribution | M15 | verified | | links (terminal/link_parsing.rs, link_computer.rs, workbench/terminal_links.rs: Cmd+click URLs and paths with line:column), sendSequence, sendSignal, zoom (font size commands, Cmd+wheel), autoReplies (terminal/auto_replies.rs), find (terminal/search.rs and workbench/terminal_find.rs: case, whole word, regex, count, previous/next, match highlights), prompt input model (terminal/prompt_input.rs), suggest (workbench/terminal_suggest.rs), history (terminal/history.rs, workbench/terminal_history.rs: Run Recent Command, Go to Recent Directory, pinned items, shell history files), quick access (`term `, workbench/terminal_quick_access.rs), sticky scroll (terminal/sticky_scroll.rs, workbench/terminal_sticky_scroll.rs); cargo test -p app link_, terminal::search, prompt_input, auto_replies, terminal_contrib, terminal_links, terminal::history, sticky_scroll, quick_access; ui-pair of Run Recent Command, `term ` and sticky scroll; resize overlay (workbench/terminal_resize_overlay.rs), environment changes (Show Environment Contributions, workbench/terminal_environment.rs; cargo test -p app environment_collection), developer Write Data to Terminal (Show Terminal Texture Atlas and Restart Pty Host have no counterpart: GPUI draws without an atlas page and there is no pty host), command guide (cargo test -p app terminal::marks), notification (OSC 99, terminal/osc99.rs, workbench/terminal_notifications.rs; cargo test -p app osc99), quick fix (terminal/quick_fix.rs, workbench/terminal_quick_fix.rs: builtin fixes, extension providers, light bulb, Cmd+. widget, decoration menu; cargo test -p app quick_fix), accessibility (terminal/accessible_buffer.rs, the terminal provider of workbench/accessible_view.rs; cargo test -p app accessible), links in wrapped lines with the hover and underline (cargo test -p app terminal_links). inlineHint without AI: the initial hint "Show suggestions ⌃Space" with its dismiss links (workbench/terminal_initial_hint.rs; ui-pair against the reference); its Copilot CLI part, chat and voice are AI (removed), wslRecommendation is 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 L] testing_view.rs `test_results_body`: the results list is not testResultsTree.ts (no message rows, no context menus with `MenuId.TestPeekElement` and `MenuId.TestMessageContext`) and the message view lacks testResultsViewContent.ts's `FloatingClickMenu` of `MenuId.TestMessageContent`, so `testing/item/result`, `testing/message/context` and `testing/message/content` have no menu | The editor gutter's menu on a test line (editorLineNumberMenu.ts `doShow`, testingDecorations.ts gutter actions generator in `1_testing`): Run Test, Debug Test, Run with Coverage, Execute Using Profile..., Cancel Test Run, Reveal in Test Explorer and the `testing/item/gutter` items with the test as argument, before the `editor/lineNumber/context` items (cargo test -p app the_gutter_menu_shows_the_tests_actions_before_the_line_number_items), on a line of several tests Run All Tests and a submenu per test labeled by its parents (cargo test -p app a_line_with_two_tests_shows_run_all_and_a_submenu_per_test), `_revealTestInExplorer` (cargo test -p app reveal_in_test_explorer_expands_the_tests_parents), the glyph's right click, Ctrl+click, `testing.defaultGutterClickAction` `contextMenu` and `runWithCoverage`, Alt for the alternate group; ui-pair right-click on the run glyph of line 2 of port/fixtures/debug-node/math.test.js with tests-provider: the testing items match the reference; The view title's run and debug group dropdowns once a group has two profiles (testingExplorerView.ts `getRunGroupDropdown`, `getTestConfigGroupActions`: controller labels, `(Default)`, `MenuId.TestProfilesContext` by `testing.profile.context.group`, Select Default Profile, Configure Test Profiles; a profile runs the controller's roots; cargo test -p app the_run_group_dropdown_lists_its_profiles_and_runs_the_picked_one), Select Default Profile stores the defaults in `testingPreferredProfiles2` and they outlive a republish (testProfileService.ts; cargo test -p app select_default_profile_stores_the_picked_defaults), the chevron keeps the title's actions in the side bar and Refresh Tests shows only `when: canRefreshTests` (cargo test -p app the_run_group_chevron_keeps_the_view_title_actions_in_the_side_bar); ui-pair with a two-run-profile tests-provider: the open dropdown matches the reference; `getTreeIncludeExclude` for the view title's Run Tests and Debug Tests (`ExecuteSelectedAction`) and a row's `RunVisibleAction`: the tests the filter box hides are excluded (cargo test -p app runs_from_the_explorer_exclude_the_tests_the_filter_hides); The explorer's filter box (testingExplorerFilter.ts and testExplorerFilterState.ts: text with history, terms, tags, globs, fuzzy; cargo test -p app testing_filter); testExclusions.ts: Hide Test, Unhide Test, Unhide All Tests, `@hidden`, `excludedTestItems` in workspace storage, runs exclude hidden tests (cargo test -p app a_hidden_test_leaves_the_tree_and_runs_until_it_is_unhidden); A test row's actions are `MenuId.TestItem`'s `inline` group with the testing icons (testingExplorerView.ts `fillActionBar`: cargo test -p app a_test_row_shows_the_test_item_menu_s_inline_group); A test row's context menu (testingExplorerView.ts `onContextMenu`: `MenuId.TestItem` but `inline`, the `getActionableElementActions` keys, the row as `TestItemContext`; cargo test -p app a_test_rows_context_menu_shows_and_runs_the_test_item_actions); `TreeSorter` by location with `compareFileNames` (cargo test -p app children_sort_by_line_then_by_file_name_order). The view title's continuous run dropdown when several profiles of controllers with tests support it (testingExplorerView.ts `getContinuousRunDropdown`: group labels, checked profiles, `stopProfile` cancels only that profile; cargo test -p app the_view_title_dropdown_starts_and_stops_one_profile_of_several); `testing.continuousRunUsingForTest` picks from the test's controller's profiles (cargo test -p app continuous_run_using_picks_from_the_tests_controller_only); testingContinuousRunService.ts: Turn on Continuous Run of a test and Start Continuous Run each hold one cancellable `$startContinuousRun` per profile until stopped, the eye activity badge, `testing.isContinuousModeOn`, the last run's profiles in workspace storage (cargo test -p app a_continuous_run_holds_one_cancellable_request_per_profile_until_it_stops). The Testing item's activity badge: the spinner during a run, else the newest result's `testing.countBadge` count (cargo test -p app the_testing_item_spins). ui-pair port/fixtures/debug-node with tests-provider: Testing view tree, Run All, pass/fail icons, Test Results tree and output, run glyphs in the gutter; cargo test -p app testing::; testServiceImpl.ts `runResolvedTests` asks for workspace trust after the live result is created, a refusal completes it (cargo test -p app a_test_run_waits_for_workspace_trust_and_completes_when_it_is_refused) |+| 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 | testResultsTree.ts's Test Results tree: the newest result's tasks with the tests that ran, worst first, a test with one error message on one row, the older results collapsed (cargo test -p app the_results_tree_shows_tasks_tests_and_messages_as_testresultstree); a row's actions and context menu with `testing/item/result` and, on a message, `testing/message/context`, the test and task as arguments (cargo test -p app a_results_rows_menu_shows_its_actions_and_the_contributed_items); an opened message's `testing/message/content` button with `getMessageArgs` (cargo test -p app an_opened_message_shows_the_first_message_content_item); ui-pair port/fixtures/debug-node with tests-provider after Run All: rows, hover actions, context menu and the opened message match the reference; The editor gutter's menu on a test line (editorLineNumberMenu.ts `doShow`, testingDecorations.ts gutter actions generator in `1_testing`): Run Test, Debug Test, Run with Coverage, Execute Using Profile..., Cancel Test Run, Reveal in Test Explorer and the `testing/item/gutter` items with the test as argument, before the `editor/lineNumber/context` items (cargo test -p app the_gutter_menu_shows_the_tests_actions_before_the_line_number_items), on a line of several tests Run All Tests and a submenu per test labeled by its parents (cargo test -p app a_line_with_two_tests_shows_run_all_and_a_submenu_per_test), `_revealTestInExplorer` (cargo test -p app reveal_in_test_explorer_expands_the_tests_parents), the glyph's right click, Ctrl+click, `testing.defaultGutterClickAction` `contextMenu` and `runWithCoverage`, Alt for the alternate group; ui-pair right-click on the run glyph of line 2 of port/fixtures/debug-node/math.test.js with tests-provider: the testing items match the reference; The view title's run and debug group dropdowns once a group has two profiles (testingExplorerView.ts `getRunGroupDropdown`, `getTestConfigGroupActions`: controller labels, `(Default)`, `MenuId.TestProfilesContext` by `testing.profile.context.group`, Select Default Profile, Configure Test Profiles; a profile runs the controller's roots; cargo test -p app the_run_group_dropdown_lists_its_profiles_and_runs_the_picked_one), Select Default Profile stores the defaults in `testingPreferredProfiles2` and they outlive a republish (testProfileService.ts; cargo test -p app select_default_profile_stores_the_picked_defaults), the chevron keeps the title's actions in the side bar and Refresh Tests shows only `when: canRefreshTests` (cargo test -p app the_run_group_chevron_keeps_the_view_title_actions_in_the_side_bar); ui-pair with a two-run-profile tests-provider: the open dropdown matches the reference; `getTreeIncludeExclude` for the view title's Run Tests and Debug Tests (`ExecuteSelectedAction`) and a row's `RunVisibleAction`: the tests the filter box hides are excluded (cargo test -p app runs_from_the_explorer_exclude_the_tests_the_filter_hides); The explorer's filter box (testingExplorerFilter.ts and testExplorerFilterState.ts: text with history, terms, tags, globs, fuzzy; cargo test -p app testing_filter); testExclusions.ts: Hide Test, Unhide Test, Unhide All Tests, `@hidden`, `excludedTestItems` in workspace storage, runs exclude hidden tests (cargo test -p app a_hidden_test_leaves_the_tree_and_runs_until_it_is_unhidden); A test row's actions are `MenuId.TestItem`'s `inline` group with the testing icons (testingExplorerView.ts `fillActionBar`: cargo test -p app a_test_row_shows_the_test_item_menu_s_inline_group); A test row's context menu (testingExplorerView.ts `onContextMenu`: `MenuId.TestItem` but `inline`, the `getActionableElementActions` keys, the row as `TestItemContext`; cargo test -p app a_test_rows_context_menu_shows_and_runs_the_test_item_actions); `TreeSorter` by location with `compareFileNames` (cargo test -p app children_sort_by_line_then_by_file_name_order). The view title's continuous run dropdown when several profiles of controllers with tests support it (testingExplorerView.ts `getContinuousRunDropdown`: group labels, checked profiles, `stopProfile` cancels only that profile; cargo test -p app the_view_title_dropdown_starts_and_stops_one_profile_of_several); `testing.continuousRunUsingForTest` picks from the test's controller's profiles (cargo test -p app continuous_run_using_picks_from_the_tests_controller_only); testingContinuousRunService.ts: Turn on Continuous Run of a test and Start Continuous Run each hold one cancellable `$startContinuousRun` per profile until stopped, the eye activity badge, `testing.isContinuousModeOn`, the last run's profiles in workspace storage (cargo test -p app a_continuous_run_holds_one_cancellable_request_per_profile_until_it_stops). The Testing item's activity badge: the spinner during a run, else the newest result's `testing.countBadge` count (cargo test -p app the_testing_item_spins). ui-pair port/fixtures/debug-node with tests-provider: Testing view tree, Run All, pass/fail icons, Test Results tree and output, run glyphs in the gutter; cargo test -p app testing::; testServiceImpl.ts `runResolvedTests` asks for workspace trust after the live result is created, a refusal completes it (cargo test -p app a_test_run_waits_for_workspace_trust_and_completes_when_it_is_refused) || 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) |