Visual Studio Code, rebuilt in Rust
Rust
feat(testing): show a message's stack trace as a call stack
rokarturd9dfa874f634
diff --git a/native/crates/app/src/editor.rs b/native/crates/app/src/editor.rsindex dc55077eb3a..8b1ce1df46a 100644--- a/native/crates/app/src/editor.rs+++ b/native/crates/app/src/editor.rs@@ -916,6 +916,8 @@ pub enum PeekOwner {References,Hierarchy,QuickDiff,+ /// callStackWidget.ts `FrameCodeRenderer`: the Test Results call stack's frame at this index.+ CallStackFrame(usize),}/// `IRecentlyClosedEditor`: a closed file editor by its resource, group and tab index, and a side by side editor'sdiff --git a/native/crates/app/src/host_sync.rs b/native/crates/app/src/host_sync.rsindex 34c86fe1a1c..d59e911c97f 100644--- a/native/crates/app/src/host_sync.rs+++ b/native/crates/app/src/host_sync.rs@@ -441,7 +441,8 @@ impl HostSync {visible.extend(panel.map(|(editor, viewport)| (None, editor, viewport)));// An embedded editor is a text editor without a column (`_findEditorPosition`); the preview's "no preview available"// model is no model of the model service (referencesWidget.ts `_previewNotAvailableMessage`), so no text editor.- for peek in &group.peek_editors {+ // callStackWidget.ts creates its frames' editors with `isSimpleWidget: true`, which are no text editors.+ for peek in group.peek_editors.iter().filter(|peek| !matches!(peek.owner, crate::editor::PeekOwner::CallStackFrame(_))) {if group.all_editors().any(|editor| self.is_document(editor) && std::rc::Rc::ptr_eq(&editor.model, &peek.editor.model)) {visible.push((None, &peek.editor, peek.viewport));}diff --git a/native/crates/app/src/menus.rs b/native/crates/app/src/menus.rsindex d588f715eb2..90592fe601a 100644--- a/native/crates/app/src/menus.rs+++ b/native/crates/app/src/menus.rs@@ -155,6 +155,10 @@ pub enum MenuId {TestPeekElement,TestMessageContext,TestMessageContent,+ /// `MenuId.TestCallStack` and `DebugCallStackToolbar`: the actions of a Test Results call stack's message frame+ /// and of a frame with a source.+ TestCallStack,+ DebugCallStackToolbar,/// `MenuId.DebugCallStackContext`: a Call Stack row's context menu.DebugCallStackContext,/// `MenuId.DebugVariablesContext`: a Variables row's context menu.@@ -502,6 +506,10 @@ const WORKBENCH_MENUS: &[Row] = &[// debugEditorActions.ts `OpenDisassemblyViewAction`.(MenuId::EditorContext, None, "debug.action.openDisassemblyView", "Open Disassembly View", "debug", 5., Some("inDebugMode && !panelFocus && debugState == 'stopped' && editorTextFocus && disassembleRequestSupported && languageSupportsDisassembleRequest"), Some("focusedStackFrameHasInstructionReference")),(MenuId::EditorContext, None, "workbench.action.showCommands", "Command Palette...", "z_commands", 1., Some("!editorSimpleInput"), None),+ // testResultsViewContent.ts `testing.callStack.run` and `testing.callStack.debug`; callStackWidget.ts `callStackWidget.goToFile`.+ (MenuId::TestCallStack, None, "testing.callStack.run", "Rerun Test", "navigation", 0., Some("testing.hasRunnableTests"), None),+ (MenuId::TestCallStack, None, "testing.callStack.debug", "Debug Test", "navigation", 0., Some("testing.hasDebuggableTests"), None),+ (MenuId::DebugCallStackToolbar, None, "callStackWidget.goToFile", "Open File", "navigation", 22., None, None),// debug.contribution.ts `registerDebugViewMenuItem(MenuId.DebugCallStackContext, ...)`, then OpenDisassemblyViewAction.(MenuId::DebugCallStackContext, None, "workbench.action.debug.restart", "Restart", "3_modification", 10., Some("callStackItemType == 'session'"), None),(MenuId::DebugCallStackContext, None, "workbench.action.debug.disconnect", "Disconnect", "3_modification", 20., Some("callStackItemType == 'session'"), None),@@ -1130,8 +1138,8 @@ pub fn command_icons(extensions: &[ScannedExtension]) -> std::collections::HashMicons.insert("workbench.action.localHistory.restoreViaEditor".to_string(), CommandIcon::Codicon("check".into()));icons.insert("workbench.files.action.acceptLocalChanges".to_string(), CommandIcon::Codicon("check".into()));icons.insert("workbench.files.action.revertLocalChanges".to_string(), CommandIcon::Codicon("discard".into()));- // testing icons.ts: a test row's inline actions.- for (id, icon) in [("testing.run", "run"), ("testing.debug", "debug-alt-small"), ("testing.coverage", "run-coverage")] {+ // testing icons.ts: a test row's inline actions and the call stack's; callStackWidget.ts `Codicon.goToFile`.+ for (id, icon) in [("testing.run", "run"), ("testing.debug", "debug-alt-small"), ("testing.coverage", "run-coverage"), ("testing.callStack.run", "run"), ("testing.callStack.debug", "debug-alt-small"), ("callStackWidget.goToFile", "go-to-file")] {icons.insert(id.to_string(), CommandIcon::Codicon(icon.into()));}// notebookIcons.ts: the cell toolbar's buttons.diff --git a/native/crates/app/src/workbench/breakpoint_widget.rs b/native/crates/app/src/workbench/breakpoint_widget.rsindex 9244c2c0259..8f713eb8563 100644--- a/native/crates/app/src/workbench/breakpoint_widget.rs+++ b/native/crates/app/src/workbench/breakpoint_widget.rs@@ -327,6 +327,10 @@ impl Workbench {/// callStackEditorContribution.ts: the top frame of each stopped thread in this file, and the focused frame.fn stack_frames_in(&self, editor: &OpenEditor) -> Vec<(u32, bool, bool)> {+ // callStackWidget.ts `setupEditorAfterModel`: a call stack frame's editor shows its own line, no glyph.+ if let Some(frame) = self.call_stack_frame(editor) {+ return vec![(frame.line as u32, true, false)];+ }let path = editor.document().path.to_string_lossy().into_owned();let mut frames = Vec::new();for session in &self.debug.sessions {@@ -382,13 +386,9 @@ impl Workbench {let Some(top) = thread.frames.first().filter(|frame| frame.column > 1 && frame.path() == Some(&*path)) else { continue };// An adapter's line out of the model (callStackEditorContribution.ts warns and skips it).let Some((index, line)) = (top.line as usize).checked_sub(1).and_then(|index| Some((index, document.lines.get(index)?))) else { continue };- let column = (top.column as usize - 1).min(line.chars().count());- let position = Position::new(index, column);- // `getLineFirstNonWhitespaceColumn() >= startColumn`.- let start_of_line = line.chars().take(column).all(|c| c == ' ' || c == '\t');- let columns = if start_of_line { 0. } else { (0.9 * 16. + 4.) / char_width };- if !injections.iter().any(|injection: &InjectedText| injection.position == position) {- injections.push(InjectedText { position, columns, content: "\u{EB8B}".into(), wrap: WrapWidth::Fixed, owner: InjectionOwner::StackFrameColumn, id: usize::from(start_of_line), at_range_start: true });+ let injection = stack_frame_column(line, index, top.column as usize, char_width);+ if !injections.iter().any(|injected: &InjectedText| injected.position == injection.position) {+ injections.push(injection);}}injections.sort_by_key(|injection| injection.position);@@ -696,6 +696,15 @@ impl BreakpointWidget {}}+/// `makeStackFrameColumnDecoration` before 1-based `column` of `line`, line `index` of its model.+pub(super) fn stack_frame_column(line: &str, index: usize, column: usize, char_width: f32) -> InjectedText {+ let column = column.saturating_sub(1).min(line.chars().count());+ // `getLineFirstNonWhitespaceColumn() >= startColumn`.+ let start_of_line = line.chars().take(column).all(|c| c == ' ' || c == '\t');+ let columns = if start_of_line { 0. } else { (0.9 * 16. + 4.) / char_width };+ InjectedText { position: Position::new(index, column), columns, content: "\u{EB8B}".into(), wrap: WrapWidth::Fixed, owner: InjectionOwner::StackFrameColumn, id: usize::from(start_of_line), at_range_start: true }+}+/// breakpointWidget.ts `availableBreakpoints`: the source breakpoints but the edited one and logpoints.fn trigger_candidates<'a>(model: &'a DebugModel, own: Option<&str>) -> Vec<&'a Breakpoint> {model.breakpoints.iter().filter(|breakpoint| Some(breakpoint.id()) != own && breakpoint.base.log_message.is_none()).collect()diff --git a/native/crates/app/src/workbench/editor_view.rs b/native/crates/app/src/workbench/editor_view.rsindex 67b1c73c7f4..8de4a58efd5 100644--- a/native/crates/app/src/workbench/editor_view.rs+++ b/native/crates/app/src/workbench/editor_view.rs@@ -1078,8 +1078,8 @@ impl Workbench {return self.multi_diff_editor_metrics(editor, window);}let test_data = editor.document().scheme == crate::testing::TEST_DATA_SCHEME;- // testResultsOutput.ts builds its editors outside a text editor part: the default lineNumbersMinChars 5.- let min_chars = if test_data { 5 } else { LINE_NUMBERS_MIN_CHARS };+ // testResultsOutput.ts and callStackWidget.ts build their editors outside a text editor part: the default lineNumbersMinChars 5.+ let min_chars = if test_data || self.call_stack_frame(editor).is_some() { 5 } else { LINE_NUMBERS_MIN_CHARS };let mut metrics = EditorMetrics::measure_with_min_chars(window, editor.document().lines.len(), self.line_numbers(editor), self.editor_zoom.multiplier(), min_chars);// diffEditorEditors.ts `_adjustOptionsForSubEditor`: no folding and no minimap in either side.if self.quick_diff_editor_diff(editor).is_some() {@@ -1430,7 +1430,7 @@ impl Workbench {})),)// testResultsOutput.ts `commonEditorOptions`: `overviewRulerLanes: 0` in a result message's editor.- .when(!in_cell && editor.document().scheme != crate::testing::TEST_DATA_SCHEME, |area| area.child(div().debug_selector(move || format!("overview-ruler-{model_id}")).absolute().top_0().right_0().h_full().child(self.overview_ruler(editor).h_full())))+ .when(!in_cell && editor.document().scheme != crate::testing::TEST_DATA_SCHEME && self.call_stack_frame(editor).is_none(), |area| area.child(div().debug_selector(move || format!("overview-ruler-{model_id}")).absolute().top_0().right_0().h_full().child(self.overview_ruler(editor).h_full()))).when(!in_multi_diff, |area| area.child(self.scrollbars_canvas(editor, metrics, cx).absolute().inset_0()))// contextmenu.ts: a right press on the scrollbar (MouseTargetType.SCROLLBAR) shows the minimap menu..child(div().absolute().top_0().bottom_0().right_0().w(px(VERTICAL_SCROLLBAR_WIDTH)).on_mouse_down(@@ -1693,9 +1693,14 @@ impl Workbench {fn scrollbars_canvas(&self, editor: &OpenEditor, metrics: EditorMetrics, cx: &mut Context<Self>) -> gpui::Canvas<Vec<(Hitbox, Bounds<Pixels>, Axis)>> {let viewport = self.editors.viewport;let mut vertical = editor.vertical_scrollbar(viewport);- // testResultsOutput.ts `commonEditorOptions`: `scrollbar.vertical` hidden in a result message's editor.+ let mut horizontal = editor.horizontal_scrollbar(viewport);+ // testResultsOutput.ts `commonEditorOptions`: `scrollbar.vertical` hidden in a result message's editor;+ // callStackWidget.ts `editorOptions`: both hidden in a call stack frame's.vertical.needed &= editor.document().scheme != crate::testing::TEST_DATA_SCHEME;- let bars = [(Axis::Vertical, vertical), (Axis::Horizontal, editor.horizontal_scrollbar(viewport))];+ let call_stack_frame = self.call_stack_frame(editor).is_some();+ vertical.needed &= !call_stack_frame;+ horizontal.needed &= !call_stack_frame;+ let bars = [(Axis::Vertical, vertical), (Axis::Horizontal, horizontal)];let opacity = self.scrollbars.opacity(Instant::now());let shown = self.scrollbars.shown;let drag = self.scrollbars.drag;diff --git a/native/crates/app/src/workbench/readonly.rs b/native/crates/app/src/workbench/readonly.rsindex 8255246b6d6..a744a7c81a4 100644--- a/native/crates/app/src/workbench/readonly.rs+++ b/native/crates/app/src/workbench/readonly.rs@@ -139,6 +139,10 @@ impl Workbench {return Some(Readonly::Editor);}let editor = self.editors.active()?;+ // callStackWidget.ts `editorOptions`: `readOnly: true`.+ if self.call_stack_frame(editor).is_some() {+ return Some(Readonly::Editor);+ }self.readonly(&editor.document().scheme, &editor.document().path)}diff --git a/native/crates/app/src/workbench/testing_results.rs b/native/crates/app/src/workbench/testing_results.rsindex 40748136b1e..20d5be21dc7 100644--- a/native/crates/app/src/workbench/testing_results.rs+++ b/native/crates/app/src/workbench/testing_results.rs@@ -15,7 +15,7 @@ use super::testing_item_menu::result_state_context;use super::testing_view::state_icon;use crate::commands::Outcome;use crate::diff_editor::{DIFF_EDITOR_SCHEME, DiffInput, Side};-use crate::editor::{TEST_RESULTS_GROUP, TextDocument};+use crate::editor::{OpenEditor, PeekOwner, TEST_RESULTS_GROUP, TextDocument};use crate::markdown::MarkdownString;use crate::menus::{MenuAction, MenuId, menu_actions, menu_group_actions};use crate::testing::{GROUP_DEBUG, GROUP_RUN, ResultState, TEST_DATA_SCHEME, TestResult, parent_id};@@ -137,6 +137,31 @@ fn is_plain_text_message(message: &Value) -> bool {message["message"].is_string() && message["type"] != 1 && !is_diffable(message)}+/// callStackWidget.ts `CallStackFrame` of a message's `ITestMessageStackFrame`: its source by scheme and path,+/// its 1-based line and column, each 1 when the frame has no position.+#[derive(Clone, Debug, PartialEq)]+pub struct CallStackFrame {+ pub label: String,+ pub source: Option<(String, PathBuf)>,+ pub line: usize,+ pub column: usize,+}++/// A header of the call stack widget: the message's frame (`CustomRenderer`), a frame with a source and its code+/// editor (`FrameCodeRenderer`) or one without (`MissingCodeRenderer`), `icon` None for a file's icon.+#[derive(Debug)]+pub(super) struct CallStackRow {+ pub icon: Option<&'static str>,+ pub label: String,+ pub suffix: Option<String>,+ pub description: Option<String>,+ pub editor: Option<u32>,+}++/// callStackWidget.ts `CONTEXT_LINES` around a frame's line, and `CALL_STACK_WIDGET_HEADER_HEIGHT`.+const CONTEXT_LINES: usize = 2;+const CALL_STACK_HEADER_HEIGHT: f32 = 24.;+/// testingUri.ts `TestUriParts` of a message's models.const MESSAGE_PART: &str = "TestFailureMessage";const EXPECTED_PART: &str = "ExpectedOutput";@@ -229,7 +254,7 @@ impl Workbench {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) {+ workbench.show_results_subject(match args.get(2).and_then(Value::as_str) {Some(test) => InspectSubject::Output { result, task, test: test.to_owned() },None => InspectSubject::Task { result, task },});@@ -247,6 +272,24 @@ impl Workbench {workbench.select_range(&path, range, cx);Outcome::done()});+ // callStackWidget.ts `callStackWidget.goToFile`: the frame's file at its position.+ self.commands.register("callStackWidget.goToFile", |workbench, args, window, cx| {+ let Some(path) = args.first().and_then(|location| location["uri"]["path"].as_str()).map(std::path::PathBuf::from) else { return Outcome::done() };+ let range = &args[0]["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()+ });+ // testResultsViewContent.ts `runInLast` of a message's test: its current item in the group.+ for (id, group) in [("testing.callStack.run", GROUP_RUN), ("testing.callStack.debug", GROUP_DEBUG)] {+ self.commands.register(id, move |workbench, args, window, cx| {+ let Some(test) = args.first().and_then(Value::as_str).filter(|test| workbench.testing.collection.items.contains_key(*test)) else { return Outcome::done() };+ workbench.run_or_notify(&[test.to_owned()], group, window, 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);@@ -595,8 +638,105 @@ impl Workbench {}_ => return,};+ self.show_results_subject(subject);+ }++ /// testResultsViewContent.ts `reveal`: the subject's content and its call stack.+ pub(super) fn show_results_subject(&mut self, subject: InspectSubject) {self.testing_view.results_subject = Some(subject);self.show_message_editor();+ self.show_call_stack();+ }++ /// `setCallStackFrames` with `MessageSubject.stack`: an error message's stack frames, each with a source in a+ /// read-only code editor of its file (`FrameCodeRenderer`) showing its line and `CONTEXT_LINES` around it.+ fn show_call_stack(&mut self) {+ let frames = self.subject_stack();+ let old = std::mem::replace(&mut self.testing_view.call_stack, frames);+ self.testing_view.call_stack_collapsed.clear();+ if old.is_empty() && self.testing_view.call_stack.is_empty() {+ return;+ }+ self.editors.ensure_detached_group(TEST_RESULTS_GROUP);+ self.with_group(TEST_RESULTS_GROUP, |workbench| {+ for index in 0..old.len() {+ workbench.drop_peek_editor(PeekOwner::CallStackFrame(index));+ }+ for (index, frame) in workbench.testing_view.call_stack.clone().into_iter().enumerate() {+ let Some((scheme, path)) = frame.source else { continue };+ if workbench.editors.model(&scheme, &path).is_none() {+ // `createModelReference` of a file that cannot be read rejects: the frame has no editor.+ let read = (scheme == "file").then(|| TextDocument::read(&path, &workbench.languages, &workbench.settings.lock().unwrap()));+ let Some(Ok(document)) = read else { continue };+ workbench.editors.open_model(document);+ }+ let editor = &mut workbench.editors.show_in_peek_editor(PeekOwner::CallStackFrame(index), &scheme, &path, || unreachable!("the model is open")).editor;+ let count = editor.document().lines.len();+ // `setupEditorAfterModel`: lines 1 to `line - CONTEXT_LINES - 1` (at least line 1) and from `line + CONTEXT_LINES + 1` hidden.+ let before = 0..frame.line.saturating_sub(CONTEXT_LINES + 1).max(1);+ editor.folding.set_hidden_areas(vec![before, (frame.line + CONTEXT_LINES).min(count)..count]);+ }+ });+ }++ /// callStackWidget.ts `setupEditorAfterModel`: each frame's editor marks its frame's column, 1 too. The marker's+ /// width is in columns of `char_width`, which the results group's viewport lacks until its editors draw.+ pub(super) fn sync_call_stack_frame_columns(&mut self, char_width: f32) {+ for (index, frame) in self.testing_view.call_stack.iter().enumerate() {+ let Some(peek) = self.editors.peek_editors.iter_mut().find(|peek| peek.owner == PeekOwner::CallStackFrame(index)) else { continue };+ let line = frame.line.saturating_sub(1);+ let Some(text) = peek.editor.document().lines.get(line).cloned() else { continue };+ let wanted = super::breakpoint_widget::stack_frame_column(&text, line, frame.column, char_width);+ let current: Vec<_> = peek.editor.injected_text.iter().filter(|injection| injection.owner == crate::editor::injected_text::InjectionOwner::StackFrameColumn).collect();+ if current != [&wanted] {+ peek.editor.set_injected_text(crate::editor::injected_text::InjectionOwner::StackFrameColumn, vec![wanted]);+ }+ }+ }++ /// testResultsSubject.ts `MessageSubject.stack`: the stack trace of an opened error message.+ fn subject_stack(&self) -> Vec<CallStackFrame> {+ let Some(InspectSubject::Message { result, task, test, message }) = &self.testing_view.results_subject else { return Vec::new() };+ let message = &self.result_by_id(result).expect("the subject is a result's").items[test].tasks[*task].messages[*message];+ if !is_error_message(message) {+ return Vec::new();+ }+ let mut frames = Vec::new();+ for frame in message["stackTrace"].as_array().into_iter().flatten() {+ let source = super::host_requests::uri_parts(&frame["uri"]).ok().map(|(scheme, path)| (scheme.to_owned(), path));+ let at = |key: &str| frame["position"][key].as_u64().map_or(1, |value| value as usize);+ frames.push(CallStackFrame { label: frame["label"].as_str().unwrap_or_default().to_owned(), source, line: at("lineNumber"), column: at("column") });+ }+ frames+ }++ /// The call stack frame whose code editor `editor` is.+ pub(super) fn call_stack_frame(&self, editor: &OpenEditor) -> Option<&CallStackFrame> {+ let peek = self.editors.peek_editors.iter().find(|peek| peek.editor.model_id == editor.model_id)?;+ let PeekOwner::CallStackFrame(index) = peek.owner else { return None };+ self.testing_view.call_stack.get(index)+ }++ /// The call stack widget's headers, none without a stack: the message's frame (`MessageStackFrame`: the testing+ /// view icon and the test's label), then each frame, by `ResourceLabel.setFile` with a source, else its name,+ /// the line as the label's `range` suffix and `Line {0} column {1}`.+ pub(super) fn results_call_stack_rows(&self) -> Vec<CallStackRow> {+ let Some(InspectSubject::Message { result, test, .. }) = &self.testing_view.results_subject else { return Vec::new() };+ let Some(item) = self.result_by_id(result).and_then(|result| result.items.get(test)).filter(|_| !self.testing_view.call_stack.is_empty()) else { return Vec::new() };+ let label = item.item["label"].as_str().unwrap_or_default().to_owned();+ let mut rows = vec![CallStackRow { icon: Some("beaker"), label, suffix: None, description: None, editor: None }];+ for (index, frame) in self.testing_view.call_stack.iter().enumerate() {+ rows.push(match &frame.source {+ Some((_, path)) => {+ let label = path.file_name().map(|name| name.to_string_lossy().into_owned()).unwrap_or_default();+ let folder = path.parent().map(|folder| crate::quick_input::path_label(folder, self.workspace())).filter(|folder| !folder.is_empty() && folder != ".");+ let editor = self.editors.peek_editor(PeekOwner::CallStackFrame(index)).map(|editor| editor.model_id);+ CallStackRow { icon: None, label, suffix: None, description: folder, editor }+ }+ None => CallStackRow { icon: Some("file-binary"), label: frame.label.clone(), suffix: Some(format!(":{}", frame.line)), description: Some(format!("Line {} column {}", frame.line, frame.column)), editor: None },+ });+ }+ rows}/// testResultsOutput.ts `DiffContentProvider` and `PlainTextMessagePeek` `update`: a diffable message opens its@@ -849,29 +989,160 @@ impl Workbench {.child(self.hover_target(gpui::SharedString::from(format!("results-action-hover-{}", action.title)), HoverContent::Text(action.title), HoverOptions::action_item()))}+ /// The subject, with the call stack widget around it when it has a stack; its code editors draw in the results group.+ fn results_content(&mut self, window: &mut Window, cx: &mut Context<Self>) -> gpui::Stateful<Div> {+ if self.message_editor().is_none() && self.testing_view.call_stack.is_empty() {+ return self.results_subject_view(window, cx);+ }+ let body = |workbench: &mut Self, window: &mut Window, cx: &mut Context<Self>| {+ // A diff's side and the frames' code editors draw unfocused before the body, as editor_groups.rs `editor_group_body` does.+ workbench.draw_unfocused_code_editors(window, cx);+ let body = match workbench.testing_view.call_stack.is_empty() {+ true => workbench.results_subject_view(window, cx),+ false => workbench.call_stack_view(window, cx),+ };+ workbench.unfocused_code_editors_placed();+ // callStackWidget.ts hosts the message and the frames in list rows, so the pane's list row inset applies.+ div().flex_1().min_w_0().flex().px(px(workbench.pane_row_inset())).child(body)+ };+ let body = match self.editors.id == TEST_RESULTS_GROUP {+ true => body(self, window, cx),+ false => self.swapped_group_body(TEST_RESULTS_GROUP, body, window, cx),+ };+ div().id("test-results-content").flex_1().min_w_0().flex().child(body)+ }++ /// callStackWidget.ts `CallStackWidget` of the message's frame and its stack: each frame a list row of a 24px+ /// header over its content (callStackWidget.css `.multiCallStackFrame`), none while collapsed: the message at+ /// its content height (`IPeekOutputRenderer.layout` with `hasMultipleFrames`), a frame's code editor at its own.+ fn call_stack_view(&mut self, window: &mut Window, cx: &mut Context<Self>) -> gpui::Stateful<Div> {+ let char_width = self.results_call_stack_rows().iter().find_map(|row| row.editor).and_then(|id| self.editors.editor_by_id(id)).map(|editor| self.editor_metrics(editor, window).char_width);+ if let Some(char_width) = char_width {+ self.sync_call_stack_frame_columns(char_width);+ }+ let viewport = crate::editor::Viewport { top_whitespace: 0., ..self.editors.viewport };+ let content_height = |editor: &OpenEditor| editor.line_top(editor.view_line_count(), viewport);+ let mut list = div().id("test-results-call-stack").flex_1().min_w_0().overflow_y_scroll().flex().flex_col();+ for (index, row) in self.results_call_stack_rows().into_iter().enumerate() {+ let collapsible = index == 0 || self.testing_view.call_stack[index - 1].source.is_some();+ let collapsed = self.testing_view.call_stack_collapsed.contains(&index);+ list = list.child(self.call_stack_header(index, &row, collapsible, collapsed, window, cx));+ if collapsed {+ continue;+ }+ if index == 0 {+ let height = self.message_editor().map(|editor| match self.editors.diffs.get(&editor.model_id) {+ Some(diff) => [&diff.original_editor, &diff.modified_editor].into_iter().flatten().map(content_height).fold(0., f32::max),+ None => content_height(editor),+ });+ let message = self.results_subject_view(window, cx);+ list = list.child(div().flex_none().flex().when_some(height, |message, height| message.h(px(height))).child(message));+ } else if let Some(editor) = row.editor.and_then(|id| self.editors.editor_by_id(id)) {+ list = list.child(div().flex_none().h(px(content_height(editor))).flex().child(self.embedded_code_editor(editor, window, cx)));+ }+ }+ list+ }++ /// callStackWidget.ts `makeFrameElements` header: the collapse button (the title toggles too), the+ /// `ResourceLabel` and the frame's toolbar: `MenuId.TestCallStack` for the message's frame with the test's+ /// capabilities as `capabilityContextKeys`, `MenuId.DebugCallStackToolbar` for a frame's code.+ fn call_stack_header(&self, index: usize, row: &CallStackRow, collapsible: bool, collapsed: bool, window: &Window, cx: &mut Context<Self>) -> gpui::Stateful<Div> {+ let foreground = self.color("foreground");+ let icon_foreground = self.foreground_or("icon.foreground");+ let toggle = move |workbench: &mut Self, cx: &mut Context<Self>| {+ let collapsed = &mut workbench.testing_view.call_stack_collapsed;+ if !collapsed.remove(&index) {+ collapsed.insert(index);+ }+ cx.notify();+ };+ let chevron = if collapsed { "chevron-right" } else { "chevron-down" };+ let collapse = div().id(("call-stack-collapse", index)).w(px(16.)).flex_none().when(collapsible, |button| {+ button.cursor_pointer().child(self.icon(chevron, 16., 16., icon_foreground)).on_click(cx.listener(move |workbench, _: &ClickEvent, _, cx| toggle(workbench, cx)))+ });+ let frame = index.checked_sub(1).map(|frame| &self.testing_view.call_stack[frame]);+ let icon = match (row.icon, frame.and_then(|frame| frame.source.as_ref())) {+ (Some(icon), _) => Some(self.icon(icon, 16., 16., icon_foreground)),+ (None, Some((_, path))) => self.file_icons.as_ref().and_then(|icons| icons.file_icon(path, self.languages.language_of(path, ""), self.theme.kind, 13., CALL_STACK_HEADER_HEIGHT, foreground)),+ (None, None) => None,+ };+ let mut label = div().flex().items_baseline().whitespace_nowrap().child(row.label.clone()).children(row.suffix.clone());+ if let Some(description) = &row.description {+ label = label.child(super::icon_label::label_description().opacity(0.7).child(description.clone()));+ }+ let title = div()+ .id(("call-stack-title", index))+ .flex_1()+ .min_w_0()+ .overflow_hidden()+ .flex()+ .items_center()+ .children(icon.map(|icon| icon.mr(px(6.))))+ .child(label)+ .when(collapsible, |title| title.cursor_pointer().on_click(cx.listener(move |workbench, _: &ClickEvent, _, cx| toggle(workbench, cx))));+ let mut actions = div().flex_none().flex().items_center().gap(px(8.)).mr(px(12.));+ for (id, title, args) in self.call_stack_actions(frame, window) {+ actions = actions.child(self.command_button(&id, title, args, icon_foreground, cx));+ }+ div()+ .id(("call-stack-header", index))+ .h(px(CALL_STACK_HEADER_HEIGHT))+ .flex_none()+ .flex()+ .items_center()+ .px(px(5.))+ .border_t_1()+ .when(collapsed, |header| header.border_b_1())+ .border_color(self.color("multiDiffEditor.border"))+ .bg(self.color("multiDiffEditor.headerBackground"))+ .text_color(foreground)+ .text_size(px(13.))+ .child(collapse)+ .child(title)+ .child(actions)+ }++ /// The commands of a frame's toolbar, with the arguments its `context` gives them: the subject's test, or the+ /// frame's location.+ fn call_stack_actions(&self, frame: Option<&CallStackFrame>, window: &Window) -> Vec<(String, String, Vec<Value>)> {+ let (menu, context, args) = match frame {+ None => {+ let Some(InspectSubject::Message { test, .. }) = &self.testing_view.results_subject else { return Vec::new() };+ let capabilities = self.test_capabilities(test);+ let mut context = self.key_context(window);+ context.insert("testing.hasRunnableTests".into(), json!(capabilities & GROUP_RUN != 0));+ context.insert("testing.hasDebuggableTests".into(), json!(capabilities & GROUP_DEBUG != 0));+ (MenuId::TestCallStack, context, vec![json!(test)])+ }+ Some(CallStackFrame { source: Some((scheme, path)), line, column, .. }) => {+ let uri = json!({ "$mid": 1, "scheme": scheme, "path": path });+ let range = json!({ "startLineNumber": line, "startColumn": column, "endLineNumber": line, "endColumn": column });+ (MenuId::DebugCallStackToolbar, self.key_context(window), vec![json!({ "uri": uri, "range": range })])+ }+ Some(_) => return Vec::new(),+ };+ let mut actions = Vec::new();+ for action in menu_actions(&self.menus, menu, &context) {+ if let MenuAction::Command { id, title, .. } = action {+ actions.push((id, title, args.clone()));+ }+ }+ actions+ }+/// The subject: a diffable message in its diff editor, a plain text one in its code editor, else a task's or a/// test's output as plain lines; a message with testResultsViewContent.ts `populateFloatingClick`'s button.- fn results_content(&mut self, window: &mut Window, cx: &mut Context<Self>) -> gpui::Stateful<Div> {+ fn results_subject_view(&mut self, window: &mut Window, cx: &mut Context<Self>) -> gpui::Stateful<Div> {if self.message_editor().is_some() {- let body = |workbench: &mut Self, window: &mut Window, cx: &mut Context<Self>| {- // A diff's unfocused side editor draws before the body, as editor_groups.rs `editor_group_body` does.- workbench.draw_unfocused_code_editors(window, cx);- let editor = workbench.editors.active().expect("the message's editor");- let body = div().flex_1().min_h_0().flex().flex_col();- let body = match workbench.editors.active_diff() {- Some(diff) => body.child(workbench.diff_editor_body(diff, diff.modified_editor.as_ref().unwrap_or(editor), window, cx)),- None => body.child(workbench.text_area(editor, window, cx)),- };- workbench.unfocused_code_editors_placed();- body- };- let editor = match self.editors.id == TEST_RESULTS_GROUP {- true => body(self, window, cx),- false => self.swapped_group_body(TEST_RESULTS_GROUP, body, window, cx),+ let editor = self.editors.active().expect("the message's editor");+ let body = div().flex_1().min_h_0().flex().flex_col();+ let body = match self.editors.active_diff() {+ Some(diff) => body.child(self.diff_editor_body(diff, diff.modified_editor.as_ref().unwrap_or(editor), window, cx)),+ None => body.child(self.text_area(editor, window, cx)),};let floating = self.results_floating_button(window, cx);- // 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);+ return div().id("test-results-output").flex_1().min_w_0().relative().flex().flex_col().child(body).children(floating);}if let Some(output) = self.terminal_output() {let id = self.write_results_terminal(output);diff --git a/native/crates/app/src/workbench/testing_results/tests.rs b/native/crates/app/src/workbench/testing_results/tests.rsindex 8c0ee2e2ab6..97d82a159d5 100644--- a/native/crates/app/src/workbench/testing_results/tests.rs+++ b/native/crates/app/src/workbench/testing_results/tests.rs@@ -107,6 +107,45 @@ fn an_opened_markdown_message_renders_its_markdown(cx: &mut TestAppContext) {assert!(workbench.markdown_message().is_none());});}++/// testResultsViewContent.ts `setCallStackFrames` and callStackWidget.ts: a message's stack trace lists after it, a+/// frame with a source as a read-only editor of its line and 2 around it, the line highlighted and its column marked,+/// one without as its label and location; another message drops the frames' editors.+#[gpui::test]+fn an_opened_message_with_a_stack_trace_lists_its_frames(cx: &mut TestAppContext) {+ let (workbench, cx, _host) = workbench_with_tests("test-results-stack", TESTS, cx);+ let source = std::env::temp_dir().join(format!("code-gpui-test-results-stack-{}", std::process::id())).join("stack.test.js");+ std::fs::create_dir_all(source.parent().unwrap()).unwrap();+ std::fs::write(&source, (1..=12).map(|line| format!("line {line}\n")).collect::<String>()).unwrap();+ workbench.update_in(cx, |workbench, _, _| {+ add_results(workbench);+ let frames = json!([+ { "label": "sum", "uri": { "scheme": "file", "path": source.to_string_lossy() }, "position": { "lineNumber": 7, "column": 3 } },+ { "label": "processTicksAndRejections", "uri": null, "position": { "lineNumber": 96, "column": 6 } },+ ]);+ workbench.testing.results[0].append_message("c\0f\0b", "t1", json!({ "type": 0, "message": "sum failed", "expected": null, "actual": null, "contextValue": null, "location": null, "stackTrace": frames }));+ workbench.open_results_element(&ResultsElement::Message { result: "r1".into(), task: 0, test: "c\0f\0b".into(), message: 1 });+ let rows: Vec<_> = workbench.results_call_stack_rows().into_iter().map(|row| (row.icon, row.label, row.suffix, row.description)).collect();+ let folder = crate::quick_input::path_label(source.parent().unwrap(), None);+ let expected = [(Some("beaker"), "subtracts", None, None), (None, "stack.test.js", None, Some(folder.as_str())), (Some("file-binary"), "processTicksAndRejections", Some(":96"), Some("Line 96 column 6"))];+ assert_eq!(rows, expected.map(|(icon, label, suffix, description)| (icon, label.to_owned(), suffix.map(str::to_owned), description.map(str::to_owned))));+ let frame = workbench.results_call_stack_rows()[1].editor.expect("the frame's code editor");+ let editor = workbench.editors.editor_by_id(frame).expect("open");+ let shown: Vec<_> = (0..editor.view_line_count()).map(|view_line| editor.model_line(view_line) + 1).collect();+ assert_eq!(shown, vec![5, 6, 7, 8, 9]);+ assert_eq!(workbench.line_numbers(editor), crate::workbench::editor_view::LineNumbers::On);+ assert!(workbench.stack_frame_line(editor, 6).is_some() && workbench.stack_frame_line(editor, 5).is_none(), "the frame's line is highlighted");+ workbench.sync_call_stack_frame_columns(7.2);+ let editor = workbench.editors.editor_by_id(frame).expect("open");+ let columns: Vec<_> = editor.injected_text.iter().map(|injection| (injection.position, injection.content.as_str())).collect();+ assert_eq!(columns, vec![(crate::editor::Position::new(6, 2), "\u{EB8B}")]);+ let readonly = workbench.with_group(crate::editor::TEST_RESULTS_GROUP, |workbench| workbench.with_code_editor(frame, |workbench| workbench.active_editor_readonly()));+ assert_eq!(readonly, Some(crate::workbench::readonly::Readonly::Editor));+ workbench.open_results_element(&ResultsElement::Message { result: "r1".into(), task: 0, test: "c\0f\0b".into(), message: 0 });+ assert!(workbench.results_call_stack_rows().is_empty());+ assert!(workbench.editors.editor_by_id(frame).is_none(), "the frame's editor went with its message");+ });+}/// testResultsOutput.ts `DiffContentProvider`: an opened diffable message shows its expected and actual models side by/// side in an embedded diff editor, with line numbers when a side is multiline; a plain text message replaces it.#[gpui::test]diff --git a/native/crates/app/src/workbench/testing_view.rs b/native/crates/app/src/workbench/testing_view.rsindex 98d74711b64..8fd86b3be59 100644--- a/native/crates/app/src/workbench/testing_view.rs+++ b/native/crates/app/src/workbench/testing_view.rs@@ -39,6 +39,10 @@ pub struct TestingView {pub results_focus: gpui::FocusHandle,/// testResultsOutput.ts `TerminalMessagePeek`: its detached terminal and the text written to it.pub results_terminal: Option<(u32, String)>,+ /// testResultsViewContent.ts `setCallStackFrames`: the opened message's stack frames, and the collapsed frames+ /// of its call stack widget by index, the message's own frame first.+ pub call_stack: Vec<super::testing_results::CallStackFrame>,+ pub call_stack_collapsed: HashSet<usize>,/// 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.@@ -63,6 +67,8 @@ impl TestingView {expanded: HashSet::new(),results_subject: None,results_terminal: None,+ call_stack: Vec::new(),+ call_stack_collapsed: HashSet::new(),results_selected: None,results_focused: None,results_toggled: HashSet::new(),@@ -254,7 +260,7 @@ 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>) {// 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.show_results_subject(super::testing_results::InspectSubject::Task { result: run.to_owned(), task: 0 });self.testing_view.results_selected = Some(format!("{run}/0"));self.testing_view.results_focused = Some(format!("{run}/0"));if self.setting("testing.automaticallyOpenTestResults") == "openOnTestStart" {@@ -736,7 +742,8 @@ impl Workbench {/// them, a run icon while none ran. A click runs them with `testing.defaultGutterClickAction` (Alt runs the/// alternate group), or shows the line's menu as a right click does.pub(super) fn test_glyph(&self, editor: &OpenEditor, line: u32, cx: &mut Context<Self>) -> Option<gpui::AnyElement> {- if self.setting("testing.gutterEnabled") == false || editor.document().scheme != "file" {+ // callStackWidget.ts frame editors take only its `ClickToLocationContribution`, not `TestingDecorations`.+ if self.setting("testing.gutterEnabled") == false || editor.document().scheme != "file" || self.call_stack_frame(editor).is_some() {return None;}let path = editor.document().path.to_string_lossy().into_owned();diff --git a/port/fixtures/extensions/tests-provider/extension.js b/port/fixtures/extensions/tests-provider/extension.jsindex 345468ce733..5c0bbe25f39 100644--- a/port/fixtures/extensions/tests-provider/extension.js+++ b/port/fixtures/extensions/tests-provider/extension.js@@ -1,6 +1,6 @@// Each `test('name', ...)` line of a *.test.js file is one test; a test whose line says `fail` fails, with a// diffable message when the line also has `expected "..." actual "..."` (JSON strings), a markdown one when it has-// `markdown "..."`.+// `markdown "..."`, and a call stack when it has `stack`: a frame at the test's line and one without a source.const vscode = require('vscode');exports.activate = async function (context) {@@ -27,9 +27,16 @@ exports.activate = async function (context) {if (line.includes('fail')) {const diff = /expected (".*") actual (".*")/.exec(line);const markdown = /markdown (".*")/.exec(line);- failing.set(test.id, diff+ const message = diff? vscode.TestMessage.diff('Expected values to be strictly equal', JSON.parse(diff[1]), JSON.parse(diff[2]))- : new vscode.TestMessage(markdown ? new vscode.MarkdownString(JSON.parse(markdown[1])) : `${match[1]} failed`));+ : new vscode.TestMessage(markdown ? new vscode.MarkdownString(JSON.parse(markdown[1])) : `${match[1]} failed`);+ if (line.includes('stack')) {+ message.stackTrace = [+ new vscode.TestMessageStackFrame(match[1], item.uri, new vscode.Position(index, 2)),+ new vscode.TestMessageStackFrame('processTicksAndRejections', undefined, new vscode.Position(95, 5)),+ ];+ }+ failing.set(test.id, message);}item.children.add(test);}diff --git a/port/fixtures/testing-messages/stack.test.js b/port/fixtures/testing-messages/stack.test.jsnew file mode 100644index 00000000000..0c4057b2f1a--- /dev/null+++ b/port/fixtures/testing-messages/stack.test.js@@ -0,0 +1,9 @@+const assert = require('assert');++function sum(a, b) {+ return a + b;+}++test('fails with a stack', () => {}); // stack++assert.strictEqual(sum(2, 2), 4);diff --git a/port/ledger.md b/port/ledger.mdindex af889255e32..cb9a5cdcf82 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`: 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/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`); a call stack frame's editor has no Cmd+click to the word's location (callStackWidget.ts `ClickToLocationContribution`); 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, stack trace); 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 2199267cd9b..704a4d68f71 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. `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.+- 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. A message's `stackTrace` (testResultsSubject.ts `MessageSubject.stack`) shows as callStackWidget.ts `CallStackWidget`: a 24px header per frame (collapse button, label, toolbar), the message's frame first with `MenuId.TestCallStack` (Rerun Test, Debug Test by the test's capabilities), then each frame with a readable source as a read-only peek editor in `TEST_RESULTS_GROUP` (`PeekOwner::CallStackFrame`, kept out of host sync) showing its line and 2 around it through hidden areas, the line highlighted as the top stack frame and its column marked, with `MenuId.DebugCallStackToolbar`'s Open File; a frame without a source shows its label, `:line` and "Line N column M". The frame editors take only `ClickToLocationContribution` upstream, so no test glyphs, overview ruler or scrollbars, and `lineNumbersMinChars` 5. The column marker's width is in columns of the measured font: the results group copies an editor-less main group's viewport with no `char_width`, so the view marks the columns itself (`sync_call_stack_frame_columns`). ui-pair of `stack.test.js` (tests-provider sets `stackTrace` on a `stack` line): headers, labels, gutter and the frame line match; the 2:1 split is the open difference above. Cmd+click in a frame editor (`ClickToLocationContribution`) is not ported.- 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.