Visual Studio Code, rebuilt in Rust
Rust
docs(readme): redo the README with a screenshot and benchmark
rokarturcba2753398bc
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdnew file mode 100644index 00000000000..67df6400e1f--- /dev/null+++ b/CONTRIBUTING.md@@ -0,0 +1,35 @@+# Contributing to VSRustium++VSRustium is a 1:1 port of VS Code 1.147.0 to Rust and [GPUI](https://www.gpui.rs): the same look, keyboard, mouse, settings, extension API and tests. The port lives in `native/` (Rust) and `port/` (tools, ledger, notes, patches). Upstream VS Code is a plain checkout of its `1.147.0` tag in `upstream/` and is never edited: the few changes the extension host needs are `port/patches/*.patch`, applied to a build copy, and the port's product settings are `port/product.json`.++## Setup++You need Rust (stable), [Bun](https://bun.sh) 1.4.5 and Node.js 24 (for VS Code's own install and compile).++```sh+git clone --branch 1.147.0 --depth 1 https://github.com/microsoft/vscode upstream+(cd upstream && npx -y [email protected] install && npx -y [email protected] run compile)+bun port/tools/build-exthost+(cd native && cargo build --release -p app)+native/target/release/vsrustium+```++`port/tools/package-app` (macOS) and `port/tools/package-linux` make the release app; their headers list the options. Run `port/tools/build-exthost` again after a change to `port/patches/` or `port/product.json`.++## How work is tracked++- `port/ledger.md` is the one source of truth. The Work table holds decisions and milestones with their "done when" checks. The Units table has one row per upstream folder, with its status, open gaps and the narrowest check that proves it. Search it, it is large: `rg -n '^\| workbench/contrib/scm ' port/ledger.md`.+- `port/notes.md` holds decisions, traps and findings per milestone, reached from the ledger rows.+- A gap leaves its cell, and a row turns `verified`, in the commit that closes it. `bun port/tools/ledger-check.ts` checks that the two tables agree.++## The bar for a change++- Match upstream 1.147.0: its behavior, look and tests. Cite the upstream file the change follows. A deliberate difference is a decision in `port/notes.md`.+- A fix comes with a test that fails without it (`cargo test -p app <name>`).+- A UI change comes with a side-by-side check against VS Code: `port/tools/pixel-check` for still windows, `port/tools/ui-pair` for states reached by clicks and keys.+- Commits follow [Conventional Commits](https://www.conventionalcommits.org): `fix(titlebar): draw disabled Go Back in disabledForeground`.+- Markdown: one paragraph per source line, no hard wrapping. UI labels use title-style capitalization, as upstream's.++## License++Contributions are licensed under the [MIT License](LICENSE.txt) of the project.diff --git a/README.md b/README.mdindex 41aaff04f89..415c5d6a768 100644--- a/README.md+++ b/README.md@@ -1,13 +1,48 @@-# VSRustium+<p align="center">+ <img src="port/assets/icon.png" alt="" width="128" height="128">+</p>-VS Code rebuilt as a native macOS and Linux app in Rust on [GPUI](https://www.gpui.rs). The workbench, editor and services are Rust; extensions run unchanged in VS Code's own extension host, on Bun. The target is 1:1 with VS Code 1.147.0: same look, keyboard, mouse, settings and extension API, checked row by row against the upstream source.+<h1 align="center">VSRustium</h1>-Not a fork of VS Code's TypeScript: this repository holds the port only. Upstream VS Code is a plain checkout of its release tag in `upstream/`, read by the build and never edited; the few edits the extension host needs are `port/patches/*.patch`, applied to a build copy.+<p align="center">+ VS Code, rebuilt in Rust.+</p>++<p align="center">+ <a href="https://github.com/rokartur/vsrustium/releases/latest"><b>Download</b></a>+ · + <a href="#benchmark">Benchmark</a>+ · + <a href="#coverage">Coverage</a>+ · + <a href="#build">Build</a>+</p>++++VS Code 1.147.0 rebuilt as a native app in Rust on [GPUI](https://www.gpui.rs). The workbench, editor and services are Rust; extensions run unchanged in VS Code's own extension host, on Bun. Same look, keyboard, mouse, settings and extension API, checked part by part against the upstream source. Not a fork: this repository holds the port only, and VS Code is a plain checkout of its release tag that the build reads and never edits.++Builds for macOS and Linux; Windows is in progress.++## Benchmark++Opening the VS Code 1.147.0 source (21,462 files) with warm caches, median of 5 runs:++| | VSRustium | VS Code 1.147.0 |+|---|---|---|+| Window with the folder | **0.79 s** | 0.99 s |+| Ready (CPU settled) | **2.5 s** | 12.1 s |+| Memory (footprint, all processes) | **218 MB** | 975 MB |+| CPU time until ready | **2.5 s** | 10.1 s |+| Idle CPU | 1.9 % of a core | **0.2 %** of a core |+| Quit | **0.14 s** | 0.23 s |++Release builds of both with default settings and the same built-in extensions, AI features off in VS Code (VSRustium leaves them out), on a Mac Studio (M1 Max, 32 GB, macOS 27). Both are measured from outside the same way: [`port/tools/bench`](port/tools/bench) runs it, and [port/results/benchmark.md](port/results/benchmark.md) has the method, the raw samples and the command.## Coverage<!-- coverage:start -->-**434 of the 435 parts of VS Code 1.147.0 the port covers match upstream 1:1 (99%).** The other 1 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).+**434 of the 435 parts of VS Code 1.147.0 the port covers match upstream 1:1 (99%).** The other 1 works, 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%%{init: {"theme": "base", "themeVariables": {"pie1": "#2da44e", "pie2": "#d4a72c", "pie3": "#8c959f", "pieStrokeColor": "#ffffff", "pieOuterStrokeColor": "#ffffff", "pieSectionTextColor": "#ffffff", "pieLegendTextColor": "#8c959f", "pieTitleTextColor": "#8c959f"}}}%%@@ -17,6 +52,8 @@ pie showData"Left out on purpose" : 154```+<details><summary>By area</summary>+| What | Matches 1:1 | With gaps | Left out | Done ||---|---:|---:|---:|---|| Platform services: files, configuration, keybindings, windows, updates | 69 | 0 | 43 | `████████████████████` 100% |@@ -36,6 +73,8 @@ pie showData"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/testing` 1.++</details><!-- coverage:end -->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.@@ -47,6 +86,22 @@ Left out on purpose: AI features, Microsoft services, telemetry, remote and tunn- macOS: `darwin-arm64` for Apple silicon, `darwin-x64` for Intel. Signed, notarized, updates itself.- Linux: `linux-x64` and `linux-arm64` archives (`.tar.gz`, glibc 2.39 or newer: Ubuntu 24.04, Debian 13). A preview: webviews in X11 sessions only (WebKitGTK 4.1), no self-update, the rest in the "M23 Linux" rows of [port/ledger.md](port/ledger.md).+## Build++Rust (stable), [Bun](https://bun.sh) 1.4.5 and Node.js 24:++```sh+git clone --branch 1.147.0 --depth 1 https://github.com/microsoft/vscode upstream+(cd upstream && npx -y [email protected] install && npx -y [email protected] run compile)+bun port/tools/build-exthost+(cd native && cargo build --release -p app)+native/target/release/vsrustium+```++`port/tools/package-app` (macOS) and `port/tools/package-linux` make the release app. How the work is tracked and checked: [CONTRIBUTING.md](CONTRIBUTING.md). Security issues: [SECURITY.md](SECURITY.md).+## License[MIT](LICENSE.txt): the port by Artur Rok, derived from VS Code by Microsoft, whose notice it keeps. Third-party notices: VS Code's `ThirdPartyNotices.txt` in `upstream/`, which the packaged app ships with the licenses of the packages it adds.++<sub>Not affiliated with Microsoft. Visual Studio Code is a trademark of Microsoft.</sub>diff --git a/SECURITY.md b/SECURITY.mdnew file mode 100644index 00000000000..19d74ad1b92--- /dev/null+++ b/SECURITY.md@@ -0,0 +1,24 @@+# Security policy++## Supported versions++Only the latest release and the current pre-release get security fixes. Update before you report: the app updates itself on macOS, and the newest builds are on the [releases page](https://github.com/rokartur/vsrustium/releases).++## Report a vulnerability++Report it privately through GitHub: [Report a vulnerability](https://github.com/rokartur/vsrustium/security/advisories/new). Do not open a public issue, pull request or discussion about it.++Include:++- the VSRustium version (Help > About) and the operating system;+- what an attacker can do, and what they need first (a file or folder the user opens, an extension, a network position);+- the steps to reproduce it, with a minimal file, folder or extension if one is needed;+- the logs or crash report, if there is one.++You get an answer in the advisory. A fix is published with the advisory after a release contains it.++## Scope++In scope: the port's code in `native/` and `port/`, its patches to VS Code in `port/patches/`, the packaged app and its update feed, and problems in the extension host that the port's changes cause.++Out of scope: vulnerabilities in VS Code itself, which also affect VS Code 1.147.0. Report those to Microsoft: [VS Code security policy](https://github.com/microsoft/vscode/security/policy). Vulnerabilities in a third-party extension go to its author.diff --git a/port/assets/icon.png b/port/assets/icon.pngnew file mode 100644index 00000000000..c74a57b9ed6Binary files /dev/null and b/port/assets/icon.png differdiff --git a/port/assets/screenshot.png b/port/assets/screenshot.pngnew file mode 100644index 00000000000..5e92d83763cBinary files /dev/null and b/port/assets/screenshot.png differdiff --git a/port/tools/readme-coverage.ts b/port/tools/readme-coverage.tsindex fef5f1bd72e..fa5eed37f71 100755--- a/port/tools/readme-coverage.ts+++ b/port/tools/readme-coverage.ts@@ -59,7 +59,7 @@ const bar = (c: typeof total) => {};const lines = [- `**${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).`,+ `**${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} ${inScope(total) - total.verified === 1 ? 'works' : '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',`%%{init: {"theme": "base", "themeVariables": {"pie1": "#2da44e", "pie2": "#d4a72c", "pie3": "#8c959f", "pieStrokeColor": "#ffffff", "pieOuterStrokeColor": "#ffffff", "pieSectionTextColor": "#ffffff", "pieLegendTextColor": "#8c959f", "pieTitleTextColor": "#8c959f"}}}%%`,@@ -69,6 +69,8 @@ const lines = [` "Left out on purpose" : ${leftOut(total)}`,'```','',+ '<details><summary>By area</summary>',+ '','| What | Matches 1:1 | With gaps | Left out | Done |','|---|---:|---:|---:|---|',];@@ -78,7 +80,7 @@ for (const [area, c] of [...areas].sort((a, b) => inScope(b[1]) + leftOut(b[1])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(', ') + '.');+lines.push(openRows.map(row => `\`${row.id}\` ${row.gaps}`).join(', ') + '.', '', '</details>');const readmePath = join(root, 'README.md');const readme = readFileSync(readmePath, 'utf8');