Skip to content

Visual Studio Code, rebuilt in Rust

Rust

docs: point AGENTS.md and CONTRIBUTING.md at the architecture documents

rokartur445f6f13000c
diff --git a/AGENTS.md b/AGENTS.md
index b004a67f758..affd83a7eaf 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -7,6 +7,13 @@ The port's state, about 1 MB: search it with `rg`, never read it whole.
- `port/ledger.md`, the one source of truth. Work table: decisions, milestones with their "done when" checks and status. Units table: one row per upstream unit with its milestone, status, open gaps and the narrowest check that proves it (`rg -n '^\| workbench/contrib/scm ' port/ledger.md`). A gap leaves its cell and an item turns `done` in the commit that closes it; `bun port/tools/ledger-check.ts` checks the two tables agree.
- `port/notes.md`: decisions, traps and findings per milestone, reached from the ledger rows (`rg -n '^## ' port/notes.md` lists its sections).
+How the code is built, read before the first edit in an area:
+
+- `ARCHITECTURE.md`: the crates, the processes, the path of a key and of a frame, the invariants. Read it before a change that crosses a module or adds one.
+- `docs/README.md`: the index of the area documents (workbench, editor, extension host, testing) and the list of areas that have none.
+- `docs/memory-safety.md`: read before a change to `unsafe` code, FFI, a raw pointer or a `Send`/`Sync` impl.
+- `docs/performance.md`: read before a change to a `render`, `key_context`, a list row, tokenization or startup.
+
Rules:
- Port 1:1: match upstream 1.148.0's behavior, look and tests, citing the upstream file. A difference is a decision in `port/notes.md` or a ledger row that is not `verified`.
@@ -15,3 +22,7 @@ Rules:
- UI labels use title-style capitalization, as upstream's.
- The repository is public: no credentials, personal data or internal links in code, commits or docs.
- Remove temporary files and scripts made while working.
+- `unsafe` only in `app` and `exthost`, each block under a `// SAFETY:` comment that names the fact it relies on, its file a row of the inventory in `docs/memory-safety.md`. The check: `cargo clippy -p app -p exthost --all-targets -- -A clippy::all`.
+- No I/O and no work in proportion to the whole document or tree on the main thread in a hot path. A change to a hot path reports the numbers of its gate (`docs/performance.md`) from before and after.
+- Before writing a piece that is new to the project from scratch, read how 2 or 3 open-source projects do it, and name them with the choice in `port/notes.md`.
+- Documents cite code as a path plus a symbol, never a line number. After a rename, a move or a deleted symbol: `bun port/tools/docs-check.ts`.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index fe335bc46a3..ee17da0e497 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -16,6 +16,13 @@ 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 the code is built
+
+- [ARCHITECTURE.md](ARCHITECTURE.md) is the map: the crates, the processes, the path of a key and of a frame, and the invariants. Read it first.
+- [docs/](docs/README.md) goes one level deeper per area: the [workbench](docs/workbench.md), the [editor](docs/editor.md), the [extension host](docs/extension-host.md) and [testing](docs/testing.md). Its index lists the areas that have no document yet.
+- [docs/memory-safety.md](docs/memory-safety.md) has the rules for `unsafe` code and the inventory of every file that has it.
+- [docs/performance.md](docs/performance.md) has the budgets, the rules for hot paths and the gates.
+
## 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`.
@@ -27,6 +34,8 @@ native/target/release/vsrustium
- Match upstream 1.148.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.
+- An `unsafe` block has a `// SAFETY:` comment and its file a row in the inventory of [docs/memory-safety.md](docs/memory-safety.md). `cargo clippy -p app -p exthost --all-targets -- -A clippy::all` fails without the comment, `bun port/tools/docs-check.ts` without the row.
+- A change to a hot path comes with the numbers of its gate from before and after ([docs/performance.md](docs/performance.md)).
- 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.