Skip to content

Visual Studio Code, rebuilt in Rust

Rust

feat(testing): list declarations under a file in the Test Coverage view

rokartur5e6727bb295e
diff --git a/native/crates/app/src/testing_coverage.rs b/native/crates/app/src/testing_coverage.rs
index 7ce4b0e315d..a73aa235c2c 100644
--- a/native/crates/app/src/testing_coverage.rs
+++ b/native/crates/app/src/testing_coverage.rs
@@ -276,17 +276,17 @@ fn tree_path_to_uri(path: &[String]) -> CoverageUri {
}
/// configuration.ts `TestingDisplayedCoveragePercent`, the `testing.displayedCoveragePercent` values.
-pub fn displayed_stat(file: &FileCoverage, method: &str) -> f64 {
+pub fn displayed_stat(statement: CoverageCount, branch: Option<CoverageCount>, declaration: Option<CoverageCount>, method: &str) -> f64 {
match method {
- "statement" => file.statement.percent(),
+ "statement" => statement.percent(),
"minimum" => {
- let mut value = file.statement.percent();
- for count in [file.branch, file.declaration].into_iter().flatten() {
+ let mut value = statement.percent();
+ for count in [branch, declaration].into_iter().flatten() {
value = value.min(count.percent());
}
value
}
- _ => file.total_percent(),
+ _ => total_coverage_percent(statement, branch, declaration),
}
}
@@ -370,6 +370,14 @@ impl HitCount {
pub fn is_hit(self) -> bool {
self != HitCount::Times(0) && self != HitCount::Ran(false)
}
+
+ /// `+hits` of a count or a boolean.
+ pub fn as_number(self) -> u64 {
+ match self {
+ HitCount::Times(times) => times,
+ HitCount::Ran(ran) => ran as u64,
+ }
+ }
}
/// `IBranchCoverage`.
@@ -395,6 +403,8 @@ pub struct CoverageDetail {
pub name: String,
pub count: HitCount,
pub location: CoverageRange,
+ /// The wire location was an `IPosition`, which holds no other detail.
+ pub position: bool,
pub branches: Vec<BranchCoverage>,
}
@@ -406,8 +416,64 @@ impl CoverageDetail {
label: branch["label"].as_str().map(str::to_owned),
location: CoverageRange::from_location(&branch["location"]),
});
- Some(CoverageDetail { kind, name: value["name"].as_str().unwrap_or_default().to_owned(), count: HitCount::from_value(&value["count"]), location: CoverageRange::from_location(&value["location"])?, branches: branches.collect() })
+ Some(CoverageDetail { kind, name: value["name"].as_str().unwrap_or_default().to_owned(), count: HitCount::from_value(&value["count"]), location: CoverageRange::from_location(&value["location"])?, position: value["location"]["lineNumber"].is_u64(), branches: branches.collect() })
+ }
+
+ /// testCoverageView.ts `DeclarationCoverageNode.contains`: `containsRange`, or `containsPosition` of a position.
+ fn contains(&self, other: &CoverageDetail) -> bool {
+ let end = if other.position { other.location.start } else { other.location.end };
+ !self.position && self.location.contains(other.location.start) && self.location.contains(end)
+ }
+}
+
+/// testCoverageView.ts `DeclarationCoverageNode`: a declaration detail, the details its range holds, and the
+/// declarations nested in it.
+#[derive(Clone, Debug, PartialEq)]
+pub struct DeclarationNode {
+ pub detail: usize,
+ contained: Vec<usize>,
+ pub children: Vec<DeclarationNode>,
+}
+
+impl DeclarationNode {
+ /// `attributableCoverage`: the statements and branches inside a hit declaration with a range.
+ pub fn attributable(&self, details: &[CoverageDetail]) -> Option<(CoverageCount, CoverageCount)> {
+ let own = &details[self.detail];
+ if own.position || !own.count.is_hit() {
+ return None;
+ }
+ let (mut statement, mut branch) = (CoverageCount::default(), CoverageCount::default());
+ for &index in &self.contained {
+ let detail = &details[index];
+ if detail.kind != DetailType::Statement {
+ continue;
+ }
+ statement.covered += detail.count.is_hit() as u64;
+ statement.total += 1;
+ for coverage in &detail.branches {
+ branch.covered += coverage.count.is_hit() as u64;
+ branch.total += 1;
+ }
+ }
+ Some((statement, branch))
+ }
+}
+
+/// testCoverageView.ts `updateWithDetails`: each declaration under the first one at each level that holds it.
+pub fn declaration_tree(details: &[CoverageDetail]) -> Vec<DeclarationNode> {
+ let mut roots: Vec<DeclarationNode> = Vec::new();
+ for (index, detail) in details.iter().enumerate() {
+ if detail.kind != DetailType::Declaration {
+ continue;
+ }
+ let mut level = &mut roots;
+ while let Some(parent) = level.iter().position(|parent| parent.contained.contains(&index)) {
+ level = &mut level[parent].children;
+ }
+ let contained = (0..details.len()).filter(|&other| detail.contains(&details[other])).collect();
+ level.push(DeclarationNode { detail: index, contained, children: Vec::new() });
}
+ roots
}
/// codeCoverageDecorations.ts `DetailRange`: a detail (`branch` set for one of a statement's branches) over a range
diff --git a/native/crates/app/src/workbench/testing_coverage_view.rs b/native/crates/app/src/workbench/testing_coverage_view.rs
index cfca2c02867..ffab52193ef 100644
--- a/native/crates/app/src/workbench/testing_coverage_view.rs
+++ b/native/crates/app/src/workbench/testing_coverage_view.rs
@@ -12,7 +12,7 @@ use crate::commands::Outcome;
use crate::main_thread_quick_open::Owner;
use crate::quick_input::{Entry, Item, Kind, QuickInput};
use crate::testing::{RunTask, TestResult, parent_id};
-use crate::testing_coverage::{CoverageNode, CoverageUri, DetailType, FileCoverage, SerializedFileCoverage, TestCoverage, coverage_color, detail_ranges, display_percent, displayed_stat};
+use crate::testing_coverage::{CoverageCount, CoverageDetail, CoverageNode, CoverageUri, DeclarationNode, DetailType, FileCoverage, SerializedFileCoverage, TestCoverage, coverage_color, declaration_tree, detail_ranges, display_percent, displayed_stat, total_coverage_percent};
#[cfg(test)]
mod tests;
@@ -44,17 +44,27 @@ pub enum SortOrder {
Name,
}
-/// A drawn row of the Test Coverage view: `CurrentlyFilteredTo`, or a file or folder node, folders with one folder
-/// child compressed into one row as `WorkbenchCompressibleObjectTree` does.
+/// A drawn row of the Test Coverage view: `CurrentlyFilteredTo`, a file or folder node, folders with one folder
+/// child compressed into one row as `WorkbenchCompressibleObjectTree` does, or a declaration in its `file`.
#[derive(Clone, Debug, PartialEq)]
pub struct CoverageRow {
+ pub id: String,
pub label: String,
pub file: Option<FileCoverage>,
+ pub declaration: Option<DeclarationRow>,
pub depth: usize,
pub folder: bool,
+ pub collapsible: bool,
pub collapsed: bool,
}
+/// `DeclarationCoverageNode` as `DeclarationCoverageRenderer` draws it.
+#[derive(Clone, Debug, PartialEq)]
+pub struct DeclarationRow {
+ pub detail: CoverageDetail,
+ pub attributable: Option<(CoverageCount, CoverageCount)>,
+}
+
/// codeCoverageDecorations.ts `CLASS_HIT` and `CLASS_MISS` of a line's `lineNumberClassName`s.
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct LineCoverage {
@@ -87,8 +97,8 @@ impl Workbench {
Outcome::done()
});
self.commands.register("testing.coverageViewCollapseAll", |workbench, _, _, cx| {
- let folders: Vec<String> = workbench.coverage_rows().into_iter().filter(|row| row.folder && !row.collapsed).filter_map(|row| row.file.map(|file| file.uri.to_uri_string())).collect();
- for id in folders {
+ let expanded: Vec<String> = workbench.coverage_rows().into_iter().filter(|row| row.collapsible && !row.collapsed).map(|row| row.id).collect();
+ for id in expanded {
workbench.toggle_coverage_row(&id);
}
cx.notify();
@@ -238,7 +248,8 @@ impl Workbench {
filtered = coverage.filter_tree_for_test(test);
tree = &filtered;
if let Some(item) = result.items.get(test) {
- rows.push(CoverageRow { label: format!("Showing coverage for \"{}\"", item.label()), file: None, depth: 0, folder: false, collapsed: false });
+ let label = format!("Showing coverage for \"{}\"", item.label());
+ rows.push(CoverageRow { id: "filtered-to".into(), label, file: None, declaration: None, depth: 0, folder: false, collapsible: false, collapsed: false });
}
}
let mut tops = Vec::new();
@@ -262,16 +273,61 @@ impl Workbench {
label = format!("{label}/{}", node_label(node));
}
let file = node.value.clone().expect("coverage nodes carry their value");
+ let id = file.uri.to_uri_string();
let folder = !node.children.is_empty();
- let collapsed = folder == self.testing.coverage.toggled.contains(&file.uri.to_uri_string());
- rows.push(CoverageRow { label, file: Some(file), depth, folder, collapsed: folder && collapsed });
- if folder && !collapsed {
+ let collapsible = folder || file.declaration.is_some_and(|declaration| declaration.total > 0);
+ // Folders start expanded, files collapsed.
+ let collapsed = collapsible && folder == self.testing.coverage.toggled.contains(&id);
+ rows.push(CoverageRow { id, label, file: Some(file.clone()), declaration: None, depth, folder, collapsible, collapsed });
+ if !collapsible || collapsed {
+ return;
+ }
+ if folder {
for child in self.sorted_coverage_nodes(node.children.values().collect()) {
self.push_coverage_rows(child, depth + 1, rows);
}
+ return;
+ }
+ if let Some(details) = self.cached_coverage_details(&file) {
+ self.push_declaration_rows(&file, details, &declaration_tree(details), depth + 1, rows);
}
}
+ /// `updateWithDetails`' children of an expanded file or declaration, each collapsed.
+ fn push_declaration_rows(&self, file: &FileCoverage, details: &[CoverageDetail], nodes: &[DeclarationNode], depth: usize, rows: &mut Vec<CoverageRow>) {
+ for node in self.sorted_declarations(nodes, details) {
+ let id = format!("{}#{}", file.uri.to_uri_string(), node.detail);
+ let collapsible = !node.children.is_empty();
+ let collapsed = collapsible && !self.testing.coverage.toggled.contains(&id);
+ let detail = details[node.detail].clone();
+ let declaration = DeclarationRow { attributable: node.attributable(details), detail };
+ rows.push(CoverageRow { id, label: declaration.detail.name.clone(), file: Some(file.clone()), declaration: Some(declaration), depth, folder: false, collapsible, collapsed });
+ if collapsible && !collapsed {
+ self.push_declaration_rows(file, details, &node.children, depth + 1, rows);
+ }
+ }
+ }
+
+ /// testCoverageView.ts `Sorter` of declarations.
+ fn sorted_declarations<'a>(&self, nodes: &'a [DeclarationNode], details: &[CoverageDetail]) -> Vec<&'a DeclarationNode> {
+ let mut nodes: Vec<_> = nodes.iter().collect();
+ let name = |node: &DeclarationNode| details[node.detail].name.to_lowercase();
+ match self.testing.coverage.sort_order {
+ SortOrder::Location => nodes.sort_by_key(|node| details[node.detail].location.start),
+ SortOrder::Name => nodes.sort_by_key(|node| name(node)),
+ SortOrder::Coverage => nodes.sort_by(|a, b| {
+ let tpc = |node: &DeclarationNode| node.attributable(details).map(|(statement, branch)| total_coverage_percent(statement, Some(branch), None));
+ let by_tpc = match (tpc(a), tpc(b)) {
+ (Some(a), Some(b)) => b.total_cmp(&a),
+ _ => std::cmp::Ordering::Equal,
+ };
+ let hits = |node: &DeclarationNode| details[node.detail].count.as_number();
+ by_tpc.then(hits(b).cmp(&hits(a))).then_with(|| name(a).cmp(&name(b)))
+ }),
+ }
+ nodes
+ }
+
/// testCoverageView.ts `Sorter` of file nodes.
fn sorted_coverage_nodes<'a>(&self, mut nodes: Vec<&'a CoverageNode>) -> Vec<&'a CoverageNode> {
let value = |node: &&'a CoverageNode| node.value.clone().expect("coverage nodes carry their value");
@@ -296,15 +352,20 @@ impl Workbench {
.when(per_test, |actions| actions.child(self.search_action(filter_icon, "testing.coverageFilterToTest", true, cx)));
let mut body = div().id("test-coverage-tree").flex_1().min_h_0().overflow_y_scroll().flex().flex_col();
for row in self.coverage_rows() {
+ // `onDidChangeCollapseState`: an expanded file loads its details for its declarations.
+ if let Some(file) = row.file.as_ref().filter(|_| !row.folder && row.declaration.is_none() && row.collapsible && !row.collapsed) {
+ self.coverage_details(file, cx);
+ }
body = body.child(self.coverage_row(row, cx));
}
super::view_panes::ViewPane { id: TEST_COVERAGE_VIEW, title: "Test Coverage".into(), description: None, actions: Some(actions.into_any_element()), draws_more: false, show_actions: false, body: body.into_any_element() }
}
- /// `FileCoverageRenderer` (twistie, resource label, `ManagedTestCoverageBars`) or `CurrentlyFilteredToRenderer`.
+ /// `FileCoverageRenderer` (twistie, resource label, `ManagedTestCoverageBars`), `DeclarationCoverageRenderer` or
+ /// `CurrentlyFilteredToRenderer`.
fn coverage_row(&self, row: CoverageRow, cx: &mut Context<Self>) -> gpui::Stateful<Div> {
let foreground = self.foreground_or("icon.foreground");
- let id = row.file.as_ref().map_or_else(|| "filtered-to".to_owned(), |file| file.uri.to_uri_string());
+ let id = row.id;
let selected = self.testing.coverage.selected_row.as_ref() == Some(&id);
let element = div()
.id(gpui::SharedString::from(format!("coverage-row:{id}")))
@@ -325,7 +386,7 @@ impl Workbench {
};
let twistie_id = id.clone();
let twistie = div().id(gpui::SharedString::from(format!("coverage-twistie:{id}"))).w(px(19.)).h_full().flex().items_center().flex_none();
- let twistie = match row.folder {
+ let twistie = match row.collapsible {
true => twistie.child(self.icon(if row.collapsed { "chevron-right" } else { "chevron-down" }, 16., 16., foreground)).on_click(cx.listener(move |workbench, _: &ClickEvent, _, cx| {
cx.stop_propagation();
workbench.toggle_coverage_row(&twistie_id);
@@ -335,13 +396,26 @@ impl Workbench {
};
// testCoverageView.ts never sets `show-file-icons` on its tree, so the resource label draws no file icon.
let label = div().flex_1().min_w_0().overflow_hidden().text_ellipsis().whitespace_nowrap().child(row.label);
- let bars = (file.kind != crate::testing_coverage::CoverageKind::Bypassed).then(|| self.coverage_bars(&file));
+ let (icon, bars, options) = match &row.declaration {
+ Some(declaration) => {
+ let icon = match declaration.detail.count.is_hit() {
+ true => self.icon("check", 16., 16., foreground),
+ false => self.icon("circle-outline", 16., 16., self.color("testing.iconUnset")),
+ };
+ let bars = declaration.attributable.map(|(statement, branch)| self.coverage_bars(statement, Some(branch), None));
+ let location = declaration.detail.location;
+ let end = if declaration.detail.position { location.start } else { location.end };
+ let selection = json!({ "startLineNumber": location.start.line, "startColumn": location.start.column, "endLineNumber": end.line, "endColumn": end.column });
+ (Some(icon), bars, json!({ "selection": selection, "selectionRevealType": 3 }))
+ }
+ None => (None, (file.kind != crate::testing_coverage::CoverageKind::Bypassed).then(|| self.coverage_bars(file.statement, file.branch, file.declaration)), Value::Null),
+ };
let open = (!row.folder).then(|| file.uri.clone());
- element.child(twistie).child(label).children(bars).on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {
+ element.child(twistie).children(icon).child(label).children(bars).on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {
workbench.testing.coverage.selected_row = Some(id.clone());
if let Some(uri) = &open {
let uri = json!({ "scheme": uri.scheme, "authority": uri.authority, "path": uri.path });
- if let Err(error) = workbench.try_show_text_document(&uri, &Value::Null, window, cx) {
+ if let Err(error) = workbench.try_show_text_document(&uri, &options, window, cx) {
workbench.notify_error(error["message"].as_str().unwrap_or("Unable to open the editor").to_owned());
}
}
@@ -351,12 +425,12 @@ impl Workbench {
/// testCoverageBars.ts `ManagedTestCoverageBars` without `compact`: the displayed percent at precision 2, then the
/// statement, function and branch bars (testing.css `.test-coverage-bars`).
- fn coverage_bars(&self, file: &FileCoverage) -> Div {
+ fn coverage_bars(&self, statement: CoverageCount, branch: Option<CoverageCount>, declaration: Option<CoverageCount>) -> Div {
let thresholds = self.setting("testing.coverageBarThresholds");
let method = self.setting("testing.displayedCoveragePercent");
- let overall = display_percent(displayed_stat(file, method.as_str().unwrap_or("totalCoverage")), 2);
+ let overall = display_percent(displayed_stat(statement, branch, declaration, method.as_str().unwrap_or("totalCoverage")), 2);
let mut bars = div().flex().flex_none().items_center().gap(px(4.)).text_size(px(11.)).mr(px(12.)).child(overall);
- for count in [Some(file.statement), file.declaration, file.branch].into_iter().flatten() {
+ for count in [Some(statement), declaration, branch].into_iter().flatten() {
bars = bars.child(self.coverage_bar(count.percent(), count.total == 0, &thresholds));
}
bars
@@ -378,14 +452,7 @@ impl Workbench {
pub(super) fn coverage_lines(&self, uri: &Value, line_count: usize, cx: &mut Context<Self>) -> HashMap<usize, LineCoverage> {
let mut lines = HashMap::new();
let Some(file) = self.file_coverage(uri) else { return lines };
- let (_, _, coverage) = self.selected_coverage().expect("file_coverage found it");
- let key = (file.uri.clone(), self.testing.coverage.filter_to_test.clone());
- let Some(details) = coverage.details.get(&key) else {
- let (selected, file_id) = (self.testing.coverage.selected.clone().expect("open"), file.id.clone());
- cx.spawn(async move |this, cx| this.update(cx, |workbench, cx| workbench.load_coverage_details(selected, key, file_id, cx))).detach();
- return lines;
- };
- let Some(details) = details else { return lines };
+ let Some(details) = self.coverage_details(&file, cx) else { return lines };
for range in detail_ranges(details) {
let detail = &details[range.detail];
let hit = match (range.kind(), range.branch) {
@@ -404,6 +471,23 @@ impl Workbench {
lines
}
+ /// The opened coverage's details of a file for the test filter, loaded on first ask.
+ fn coverage_details(&self, file: &FileCoverage, cx: &mut Context<Self>) -> Option<&[CoverageDetail]> {
+ let (_, _, coverage) = self.selected_coverage()?;
+ let key = (file.uri.clone(), self.testing.coverage.filter_to_test.clone());
+ if !coverage.details.contains_key(&key) {
+ let (selected, file_id) = (self.testing.coverage.selected.clone().expect("open"), file.id.clone());
+ cx.spawn(async move |this, cx| this.update(cx, |workbench, cx| workbench.load_coverage_details(selected, key, file_id, cx))).detach();
+ }
+ self.cached_coverage_details(file)
+ }
+
+ /// The opened coverage's loaded details of a file for the test filter.
+ fn cached_coverage_details(&self, file: &FileCoverage) -> Option<&[CoverageDetail]> {
+ let (_, _, coverage) = self.selected_coverage()?;
+ coverage.details.get(&(file.uri.clone(), self.testing.coverage.filter_to_test.clone()))?.as_deref()
+ }
+
/// `FileCoverage.details` / `detailsForTest`: `$getCoverageDetails` of the file's id, cached on the coverage
/// with `None` while it loads.
fn load_coverage_details(&mut self, selected: (String, String), key: crate::testing_coverage::DetailsKey, file_id: String, cx: &mut Context<Self>) {
diff --git a/native/crates/app/src/workbench/testing_coverage_view/tests.rs b/native/crates/app/src/workbench/testing_coverage_view/tests.rs
index a4fc9446037..9f58410d1e6 100644
--- a/native/crates/app/src/workbench/testing_coverage_view/tests.rs
+++ b/native/crates/app/src/workbench/testing_coverage_view/tests.rs
@@ -195,3 +195,67 @@ fn the_high_contrast_gutter_draws_borders_instead_of_fills(cx: &mut TestAppConte
assert!(style.background.is_none(), "no fill");
});
}
+
+/// testCoverageView.ts `updateWithDetails`: an expanded file with declarations asks for its details and lists them,
+/// each under the declaration holding it, collapsed, with the statements and branches inside it as its coverage and
+/// sorted by the view's order.
+#[gpui::test]
+fn an_expanded_file_lists_its_declarations(cx: &mut TestAppContext) {
+ use crate::workbench::testing_coverage_view::SortOrder;
+ let (workbench, cx, host) = workbench_with_tests("coverage-declarations", TESTS, cx);
+ let file_id = workbench.update_in(cx, |workbench, window, cx| {
+ add_result(workbench);
+ let coverage = json!({ "id": "f1", "uri": { "scheme": "file", "path": "/w/a.js" }, "statement": { "covered": 1, "total": 2 }, "declaration": { "covered": 1, "total": 3 } });
+ drop(workbench.handle_testing_request(request("$appendCoverage", vec![json!("r1"), json!("t1"), coverage]), window, cx));
+ workbench.open_coverage("r1", 0, false, cx);
+ workbench.set_part_hidden(crate::workbench::layout::Part::SideBar, false, cx);
+ workbench.open_testing_view(true, window, cx);
+ let file = &workbench.coverage_rows()[0];
+ assert_eq!((file.label.as_str(), file.collapsible, file.collapsed), ("a.js", true, true), "files start collapsed");
+ file.id.clone()
+ });
+ cx.update(|window, cx| drop(window.draw(cx)));
+ cx.run_until_parked();
+ assert!(host.try_iter().all(|message| message.method != "$getCoverageDetails"), "a collapsed file loads nothing");
+ workbench.update(cx, |workbench, cx| {
+ workbench.toggle_coverage_row(&file_id);
+ cx.notify();
+ });
+ cx.update(|window, cx| drop(window.draw(cx)));
+ cx.run_until_parked();
+ let sent: Vec<_> = host.try_iter().filter(|message| message.method == "$getCoverageDetails").map(|message| message.args).collect();
+ assert_eq!(sent, vec![vec![json!("f1"), Value::Null]]);
+ let rows = workbench.update(cx, |workbench, _| {
+ let range = |start: u32, end: u32| json!({ "startLineNumber": start, "startColumn": 1, "endLineNumber": end, "endColumn": 1 });
+ let details = [
+ json!({ "type": 0, "name": "outer", "count": 1, "location": range(1, 10) }),
+ json!({ "type": 1, "count": 1, "location": range(2, 2) }),
+ json!({ "type": 1, "count": 0, "location": range(3, 3), "branches": [{ "count": 1 }] }),
+ json!({ "type": 0, "name": "inner", "count": 0, "location": range(4, 6) }),
+ json!({ "type": 0, "name": "alpha", "count": 0, "location": { "lineNumber": 12, "column": 1 } }),
+ ];
+ let details = details.iter().filter_map(crate::testing_coverage::CoverageDetail::from_value).collect();
+ let uri = crate::testing_coverage::CoverageUri::file("/w/a.js");
+ workbench.testing.results[0].tasks[0].coverage.as_mut().expect("coverage").details.insert((uri, None), Some(details));
+ let rows = |workbench: &Workbench| -> Vec<_> {
+ workbench.coverage_rows().into_iter().map(|row| {
+ let tpc = row.declaration.as_ref().and_then(|declaration| declaration.attributable).map(|(statement, branch)| crate::testing_coverage::total_coverage_percent(statement, Some(branch), None));
+ (row.label, row.depth, row.collapsible, row.collapsed, tpc)
+ }).collect()
+ };
+ let by_location = rows(workbench);
+ let outer = workbench.coverage_rows()[1].id.clone();
+ workbench.toggle_coverage_row(&outer);
+ let expanded = rows(workbench);
+ workbench.testing.coverage.sort_order = SortOrder::Name;
+ let by_name: Vec<_> = rows(workbench).into_iter().map(|row| row.0).collect();
+ workbench.testing.coverage.sort_order = SortOrder::Coverage;
+ let by_coverage: Vec<_> = rows(workbench).into_iter().map(|row| row.0).collect();
+ (by_location, expanded, by_name, by_coverage)
+ });
+ let two_of_three = Some(2. / 3.);
+ assert_eq!(rows.0, vec![("a.js".to_owned(), 0, true, false, None), ("outer".to_owned(), 1, true, true, two_of_three), ("alpha".to_owned(), 1, false, false, None)]);
+ assert_eq!(rows.1[2], ("inner".to_owned(), 2, false, false, None), "an uncovered declaration has no attributable coverage");
+ assert_eq!(rows.2, ["a.js", "alpha", "outer", "inner"]);
+ assert_eq!(rows.3, ["a.js", "outer", "inner", "alpha"]);
+}
diff --git a/port/ledger.md b/port/ledger.md
index 0c4ad025311..cd65892275a 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 L] testing_coverage_view.rs: no inline coverage (codeCoverageDecorations.ts `CoverageToolbarWidget`, `testing.toggleInlineCoverage`, the line hover, `testing.coverage.goToNextMissedLine` and `goToPreviousMissedLine`), no Filter Coverage by Test or coverage actions in the editor title (`MenuId.EditorTitle`), no percent in the Explorer (`testing.showCoverageInExplorer`), no minimap or overview ruler marks (`testing.coverageMinimapEnabled`), no declaration rows under a file in the Test Coverage view (testCoverageView.ts `DeclarationCoverageNode`) | cargo test -p app testing:: testing_filter testing_message_colorizer testing_results:: coverage 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 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; 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 math.test.js line 2, the run profile dropdown); ui-pair port/fixtures/testing-messages (diff message, markdown message output and selection copy, ANSI message, stack trace and a press in a frame); ui-pair m16/coverage.json |
+| workbench/contrib/testing | workbench contribution | M16 | ported | [3 L] testing_coverage_view.rs: no inline coverage (codeCoverageDecorations.ts `CoverageToolbarWidget`, `testing.toggleInlineCoverage`, the line hover, `testing.coverage.goToNextMissedLine` and `goToPreviousMissedLine`), no Filter Coverage by Test or coverage actions in the editor title (`MenuId.EditorTitle`), no percent in the Explorer (`testing.showCoverageInExplorer`), no minimap or overview ruler marks (`testing.coverageMinimapEnabled`) | cargo test -p app testing:: testing_filter testing_message_colorizer testing_results:: coverage 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 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; 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 math.test.js line 2, the run profile dropdown); ui-pair port/fixtures/testing-messages (diff message, markdown message output and selection copy, ANSI message, stack trace and a press in a frame); ui-pair m16/coverage.json |
| 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) |