Skip to content

Visual Studio Code, rebuilt in Rust

Rust

docs(readme): present coverage in plain terms with the open gaps listed (#2)

Artur Rokf8cdae093659
diff --git a/README.md b/README.md
index 10513281f6a..73e6257ce2f 100644
--- a/README.md
+++ b/README.md
@@ -7,34 +7,37 @@ Not a fork of VS Code's TypeScript: this repository holds the port only. Upstrea
## Coverage
<!-- coverage:start -->
-Coverage of VS Code 1.147.0, from [port/ledger.md](port/ledger.md) (587 rows). Verified means 1:1 with a named check; ported means written, with its open gaps in the same row.
+**414 of the 433 parts of VS Code 1.147.0 the port covers match upstream 1:1 (95%).** The other 19 work, with open gaps listed below. 154 more are left out on purpose. A part is one upstream folder: a feature, a service or a built-in extension, counted from [port/ledger.md](port/ledger.md).
```mermaid
pie showData
- "verified" : 414
- "ported" : 19
- "removed" : 126
- "n/a" : 28
+ "Matches VS Code 1:1" : 414
+ "Works, with open gaps" : 19
+ "Left out on purpose" : 154
```
-| area | verified | ported | removed | n/a | verified of in scope |
-|---|---:|---:|---:|---:|---|
-| workbench contribution | 61 | 9 | 30 | 3 | `█████████████████░░░ 87%` |
-| src/vs/platform | 69 | 0 | 30 | 13 | `████████████████████ 100%` |
-| built-in extension | 88 | 1 | 6 | 0 | `████████████████████ 99%` |
-| MainThread* shape (Rust side) | 59 | 0 | 30 | 0 | `████████████████████ 100%` |
-| workbench service | 63 | 2 | 23 | 7 | `███████████████████░ 97%` |
-| src/vs/editor/contrib | 52 | 3 | 2 | 1 | `███████████████████░ 95%` |
-| workbench part | 9 | 2 | 2 | 0 | `████████████████░░░░ 82%` |
-| extension host seam | 7 | 0 | 0 | 0 | `████████████████████ 100%` |
-| cross-cutting check | 5 | 0 | 0 | 0 | `████████████████████ 100%` |
-| src/vs/editor | 0 | 2 | 1 | 1 | `░░░░░░░░░░░░░░░░░░░░ 0%` |
-| src/vs/base | 0 | 0 | 2 | 3 | `████████████████████ 100%` |
-| port feature | 1 | 0 | 0 | 0 | `████████████████████ 100%` |
-| **all** | **414** | **19** | **126** | **28** | `███████████████████░ 96%` |
+| What | Matches 1:1 | With gaps | Left out | Done |
+|---|---:|---:|---:|---|
+| Platform services: files, configuration, keybindings, windows, updates | 69 | 0 | 43 | `████████████████████` 100% |
+| Workbench features: debug, Git, terminal, search, settings, extensions view | 61 | 9 | 33 | `█████████████████░░░` 87% |
+| Workbench services: editors, views, layout, themes, storage | 63 | 2 | 30 | `███████████████████░` 96% |
+| Built-in extensions: languages, themes, Git, Markdown, npm | 88 | 1 | 6 | `███████████████████░` 98% |
+| Extension API: the calls extensions make into the editor | 59 | 0 | 30 | `████████████████████` 100% |
+| Editor features: find, folding, suggest, hover, multi-cursor | 52 | 3 | 3 | `██████████████████░░` 94% |
+| Window parts: title bar, activity bar, side bar, panel, status bar | 9 | 2 | 2 | `████████████████░░░░` 81% |
+| Extension host: runs unmodified VS Code extensions | 7 | 0 | 0 | `████████████████████` 100% |
+| Base library | 0 | 0 | 5 | all left out |
+| Whole-app checks: look, memory, no telemetry, Open VSX gallery | 5 | 0 | 0 | `████████████████████` 100% |
+| Text editor core: model, view, cursor | 0 | 2 | 2 | `░░░░░░░░░░░░░░░░░░░░` 0% |
+| Port-only features: settings import from VS Code | 1 | 0 | 0 | `████████████████████` 100% |
+| **All** | **414** | **19** | **154** | `███████████████████░` 95% |
+
+"Matches 1:1" means upstream's tests or a named check against VS Code pass. Parts that work with open gaps, by gap count:
+
+`workbench/contrib/debug` 21, `workbench/contrib/testing` 9, `workbench/contrib/mergeEditor` 5, `workbench/parts/editor` 5, `workbench/services/views` 4, `editor/contrib/inlineCompletions` 3, `workbench/contrib/extensions` 3, `workbench/services/layout` 3, `workbench/contrib/scm` 2, `workbench/parts/titlebar` 2, `editor/browser` 1, `editor/common` 1, `editor/contrib/codeAction` 1, `editor/contrib/inlayHints` 1, `extension/git` 1, `workbench/contrib/comments` 1, `workbench/contrib/multiDiffEditor` 1, `workbench/contrib/notebook` 1, `workbench/contrib/webview` 1.
<!-- coverage:end -->
-`removed` are parts left out by decision: AI features, Microsoft services, telemetry, remote and tunnels ([port/notes.md](port/notes.md)). `n/a` are upstream test infrastructure and the Electron process, IPC and DOM layers the native architecture replaces.
+Left out on purpose: AI features, Microsoft services, telemetry, remote and tunnels, by decision ([port/notes.md](port/notes.md)), and upstream's test infrastructure and the Electron process, IPC and DOM layers the native app replaces.
## Download
diff --git a/port/tools/readme-coverage.ts b/port/tools/readme-coverage.ts
index e42549aac6b..4ac0ce557bb 100755
--- a/port/tools/readme-coverage.ts
+++ b/port/tools/readme-coverage.ts
@@ -1,52 +1,83 @@
#!/usr/bin/env bun
-// Writes the coverage block of README.md (between the `coverage` markers) from the status column of port/ledger.md's Units table.
+// Writes the coverage block of README.md (between the `coverage` markers) from port/ledger.md's Units table.
// Run after a ledger recount: bun port/tools/readme-coverage.ts
import { readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
const root = join(import.meta.dir, '../..');
-const statuses = ['verified', 'ported', 'removed', 'n/a'] as const;
-const areas = new Map<string, Record<string, number>>();
+const areaNames: Record<string, string> = {
+ 'workbench contribution': 'Workbench features: debug, Git, terminal, search, settings, extensions view',
+ 'src/vs/platform': 'Platform services: files, configuration, keybindings, windows, updates',
+ 'built-in extension': 'Built-in extensions: languages, themes, Git, Markdown, npm',
+ 'MainThread* shape (Rust side)': 'Extension API: the calls extensions make into the editor',
+ 'workbench service': 'Workbench services: editors, views, layout, themes, storage',
+ 'src/vs/editor/contrib': 'Editor features: find, folding, suggest, hover, multi-cursor',
+ 'workbench part': 'Window parts: title bar, activity bar, side bar, panel, status bar',
+ 'extension host seam': 'Extension host: runs unmodified VS Code extensions',
+ 'cross-cutting check': 'Whole-app checks: look, memory, no telemetry, Open VSX gallery',
+ 'src/vs/editor': 'Text editor core: model, view, cursor',
+ 'src/vs/base': 'Base library',
+ 'port feature': 'Port-only features: settings import from VS Code',
+};
+const empty = () => ({ verified: 0, ported: 0, stub: 0, todo: 0, removed: 0, 'n/a': 0 });
+const areas = new Map<string, ReturnType<typeof empty>>();
+const openRows: { id: string; gaps: number }[] = [];
const units = readFileSync(join(root, 'port/ledger.md'), 'utf8').split('\n## Units')[1];
for (const line of units.split('\n')) {
const cells = line.split(' | ');
if (!line.startsWith('| ') || cells.length < 6 || cells[3] === 'status' || cells[3].startsWith('-')) {
continue;
}
- const [, area, , status] = cells;
- const counts = areas.get(area) ?? { verified: 0, ported: 0, removed: 0, 'n/a': 0, stub: 0, todo: 0 };
- counts[status]++;
+ const [id, area, , status, gaps] = cells;
+ if (!(area in areaNames)) {
+ throw new Error(`readme-coverage.ts has no plain name for the ledger area "${area}"`);
+ }
+ const counts = areas.get(area) ?? empty();
+ counts[status as keyof typeof counts]++;
areas.set(area, counts);
+ if (status !== 'verified' && status !== 'removed' && status !== 'n/a') {
+ openRows.push({ id: id.slice(2), gaps: gaps.match(/\[[^\]]+ [SML]\]/g)?.length ?? 0 });
+ }
}
-const total: Record<string, number> = { verified: 0, ported: 0, removed: 0, 'n/a': 0, stub: 0, todo: 0 };
+const total = empty();
for (const counts of areas.values()) {
for (const status in counts) {
- total[status] += counts[status];
+ total[status as keyof typeof total] += counts[status as keyof typeof counts];
}
}
-const bar = (done: number, all: number) => {
- const filled = all === 0 ? 20 : Math.round((done / all) * 20);
- return `${'█'.repeat(filled)}${'░'.repeat(20 - filled)} ${all === 0 ? 100 : Math.round((done / all) * 100)}%`;
+const inScope = (c: typeof total) => c.verified + c.ported + c.stub + c.todo;
+const leftOut = (c: typeof total) => c.removed + c['n/a'];
+const percent = (c: typeof total) => Math.floor((c.verified / inScope(c)) * 100);
+const bar = (c: typeof total) => {
+ if (inScope(c) === 0) {
+ return 'all left out';
+ }
+ const filled = Math.floor(percent(c) / 5);
+ return `\`${'█'.repeat(filled)}${'░'.repeat(20 - filled)}\` ${percent(c)}%`;
};
-const inScope = (c: Record<string, number>) => c.verified + c.ported + c.stub + c.todo;
const lines = [
- `Coverage of VS Code 1.147.0, from [port/ledger.md](port/ledger.md) (${inScope(total) + total.removed + total['n/a']} rows). Verified means 1:1 with a named check; ported means written, with its open gaps in the same row.`,
+ `**${total.verified} of the ${inScope(total)} parts of VS Code 1.147.0 the port covers match upstream 1:1 (${percent(total)}%).** The other ${inScope(total) - total.verified} work, with open gaps listed below. ${leftOut(total)} more are left out on purpose. A part is one upstream folder: a feature, a service or a built-in extension, counted from [port/ledger.md](port/ledger.md).`,
'',
'```mermaid',
'pie showData',
- ...statuses.map(status => ` "${status}" : ${total[status]}`),
+ ` "Matches VS Code 1:1" : ${total.verified}`,
+ ` "Works, with open gaps" : ${inScope(total) - total.verified}`,
+ ` "Left out on purpose" : ${leftOut(total)}`,
'```',
'',
- '| area | verified | ported | removed | n/a | verified of in scope |',
- '|---|---:|---:|---:|---:|---|',
+ '| What | Matches 1:1 | With gaps | Left out | Done |',
+ '|---|---:|---:|---:|---|',
];
-for (const [area, c] of [...areas].sort((a, b) => inScope(b[1]) + b[1].removed - inScope(a[1]) - a[1].removed)) {
- lines.push(`| ${area} | ${c.verified} | ${c.ported} | ${c.removed} | ${c['n/a']} | \`${bar(c.verified, inScope(c))}\` |`);
+for (const [area, c] of [...areas].sort((a, b) => inScope(b[1]) + leftOut(b[1]) - inScope(a[1]) - leftOut(a[1]))) {
+ lines.push(`| ${areaNames[area]} | ${c.verified} | ${inScope(c) - c.verified} | ${leftOut(c)} | ${bar(c)} |`);
}
-lines.push(`| **all** | **${total.verified}** | **${total.ported}** | **${total.removed}** | **${total['n/a']}** | \`${bar(total.verified, inScope(total))}\` |`);
+lines.push(`| **All** | **${total.verified}** | **${inScope(total) - total.verified}** | **${leftOut(total)}** | ${bar(total)} |`);
+lines.push('', '"Matches 1:1" means upstream\'s tests or a named check against VS Code pass. Parts that work with open gaps, by gap count:', '');
+openRows.sort((a, b) => b.gaps - a.gaps || a.id.localeCompare(b.id));
+lines.push(openRows.map(row => `\`${row.id}\` ${row.gaps}`).join(', ') + '.');
const readmePath = join(root, 'README.md');
const readme = readFileSync(readmePath, 'utf8');