Visual Studio Code, rebuilt in Rust
Rust
docs(port): record the move of GPUI to gpui-fast
rokartur10aaf8fb19bd
diff --git a/port/ledger.md b/port/ledger.mdindex f5ecca5703a..869c54b845e 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -45,6 +45,7 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,| Milestones | M23 Linux build | in progress | Branch `port-linux` (a Linux build container on the Studio). The app is macOS-only today: 24 files of `native/crates` call AppKit, Foundation, WebKit, Security or Core Foundation directly (objc2, core-foundation, security-framework); GPUI (`native/vendor/wu`) already has its Linux platform (Wayland and X11). Artur: Wayland is required, not a preview: every feature X11 has works in a Wayland session too, webviews included. Every macOS call goes behind `cfg(target_os = "macos")` with the Linux counterpart VS Code uses there, in the same function where the two are a few lines, in a `platform/linux.rs` beside a `platform/macos.rs` where they are not: webview (WebKitGTK through wry), file dialogs (xdg-desktop-portal, rfd), the application menu (drawn in the window: `window.titleBarStyle`, `window.menuBarVisibility`), clipboard and the find pasteboard (GPUI's), proxy (`http.proxy` and the system proxy via reqwest instead of NSURLSession), secrets (Secret Service, keyring), `code` CLI install (`~/.local/bin`), file watching (inotify, notify), the updater (a download link, as `update.mode` on a tar.gz), and the settings import paths (`~/.config/Code`, `~/.config/Cursor`, `~/.config/VSCodium`). Packaging: `port/tools/package-linux` writes `VSRustium-<version>-linux-<arch>.tar.gz`, the same folder as `VSRustium-<version>-linux-<arch>.AppImage` (`port/tools/linux/appimage`) and the `linux-<arch>.json` and `linux-<arch>-prerelease.json` feed entries (port/notes.md milestone 23); deb after it. Builds in a Linux container on the Studio (`docker`, linux/arm64) for the build and the unit tests; linux-x64 on a GitHub Actions `ubuntu` runner once arm64 is green. | `cargo build --release -p app` and the area tests pass on Linux arm64 and x64; the app opens a folder, edits, saves, runs an extension (the exthost handshake, emmet and git activate) and shows a webview under Xvfb and in a Wayland session (a headless compositor in the container); `v1.147.0-insider` carries `VSRustium-1.147.0-insider-linux-arm64.tar.gz` and `VSRustium-1.147.0-insider-linux-x64.tar.gz`; the macOS build is unchanged (its area tests and api-tests as before). || Milestones | M24 Windows build | in progress | Branch `worktree-m24-windows`, beside milestone 23 on the same seams: macOS and Linux code stays as it is, each Windows counterpart sits behind `cfg(target_os = "windows")` in the function where it is a few lines, in a `windows.rs` beside `macos.rs` and `linux.rs` where it is not. Scope: WebView2, the Win32 file dialogs and message boxes, the in-window menu bar and custom title bar, Credential Manager (keyring), named pipes for the extension host and single instance, ConPTY for the terminal (terminal/pty/conpty.rs, the VT backend libghostty-vt is platform-neutral), drive-letter paths and file URIs, the user-setup install path with `bin` on the user PATH (code.iss `addtopath`), `%APPDATA%\Code` settings import, an x64 and arm64 zip and a user installer, no Authenticode signing (the Windows signing decision). Cross build on the Studio (cargo-xwin, `x86_64-pc-windows-msvc` and `aarch64-pc-windows-msvc`) for compile checks and host-run unit tests; real runs on GitHub Actions `windows` runners (`.github/workflows/windows.yml`, by hand). Seams: the "M24 Windows" rows. | `cargo build --release -p app` and the area tests pass on win32-x64 and win32-arm64 runners; the app opens a folder, edits, saves, runs an extension (the exthost handshake, emmet and git activate) and shows a webview on the runner; `v1.147.0-insider` carries `VSRustium-win32-x64-1.147.0-insider.zip`, `VSRustium-win32-arm64-1.147.0-insider.zip` and both user setups; the macOS and Linux builds are unchanged (their area tests as before). || Milestones | M25 virtual workspaces | later | Artur: its own milestone after M20, not part of the gap audits. A folder of a non-file scheme (`.code-workspace` `uri` folders, `--folder-uri`, `vscode.openFolder` with an extension file system provider scheme) kept as a URI; every reader of workspace folders (173 `.folders` uses in 70 files: explorer, search, quick open, terminal cwd, tasks, git, watcher, settings layers, trust) goes through the file system providers; the workspace marked virtual, `virtualWorkspaces: false` extensions disabled with the `notSupportedInWorkspace` message (config/workspace.rs:101, port/notes.md provider entries deferred until virtual workspaces). | not started |+| Milestones | M26 GPUI on gpui-fast | in progress | Artur, 2026-12-01: the port's GPUI moves from Wu (dstrml/wu a3ced28, vendored in `native/vendor/wu`) to gpui-fast (longbridge/gpui-fast f0a91cf952678e4d205da1ec189b6d134e975bcd, base zed a36d485), a Zed GPUI fork whose Retained Mode redraws only the views that changed. Integration branch `worktree-gpui-fast`, in phases; `main` stays on Wu until the gate below is green. Reason, risks, sync and rollback: port/notes.md "GPUI on gpui-fast". | All area tests and `port/tools/api-tests` green; `cargo test -p app corner_lab` within today's thresholds; a Retained Mode on/off differential test without differences; GUI: open a folder, edit, save, an extension (exthost handshake, emmet, git), a webview, a long list scroll, the terminal; `port/tools/bench` not worse than Wu in any column; `bun port/tools/ledger-check.ts` passes. || M23 Linux | app/src/webview/linux.rs:66 | done | [linux L] webviews through WebKitGTK: webview panels and views, editor insets, notebook outputs, extension details, release notes. | `FIXTURE=webview-tests port/tools/linux/smoke` on X11 (Xvfb): 10/10 ok; `cargo gc test -p app webview` on Linux: 19 passed || M23 Linux | app/src/webview/linux.rs:47 | open | [linux L] webviews in a Wayland session. Linux shows now: no webview under Wayland: GPUI has no X window there to hold the GTK window, so `supported()` is false and each webview surface stays empty. Needs a route that does not embed: GTK opens its own Wayland connection, and a `wl_subsurface` cannot take a surface of another client, so the reparenting X11 uses has no Wayland form; WPE WebKit rendering offscreen into a GPUI texture, with input forwarded, is the route left (not started). | || M23 Linux | app/src/webview/linux.rs:370 | open | [linux S] a webview in a Wayland desktop with `WAYLAND_DISPLAY` unset panics ("GTK on X11"): GPUI falls back to X11, GTK still connects to `wayland-0`, and `embedded_window` expects an X11 display. `GDK_BACKEND=x11` avoids it (found in PR #15's NixOS test, the same with the plain archive). GTK has to take the backend GPUI took. | |diff --git a/port/notes.md b/port/notes.mdindex b9d86e752e4..1ecc9aaa566 100644--- a/port/notes.md+++ b/port/notes.md@@ -1099,3 +1099,56 @@ Work the port does at another time than 1.147.0, accepted with a measured same r- Section headers (sectionHeaders.ts) and unicode highlights (unicodeHighlighter.ts `DocumentUnicodeHighlighter`) are found on the UI thread for each model version (minimap_view.rs `minimap_section_labels`, unicode_highlight.rs `unicode_highlights`), where upstream asks the editor worker 250 ms after the last edit and moves the old decorations with the text meanwhile. Same result once upstream's 250 ms pass: the same finders run on the same text, and the section headers read the tokens the lines have (`getLineTokens`, `stored_token_type_at`), found again at most once a second while new tokens arrive (`onDidChangeModelTokens`). Both run inside each edit of the typing check.- Smart select's bracket ranges (bracketSelections.ts) scan to the document's ends in one go (smart_select.rs `bracket_ranges`), where upstream yields after `_maxDuration` (30 ms) and stops the right scan after 2 rounds. The scan takes 7.22 to 7.76 ms on the 52k-line file, so upstream's scan ends in its first round with the same ranges; upstream's smartSelect.test.ts raises `_maxDuration` to 5 s for that full scan. The typing check gates the scan under 30 ms.- Ported instead (they changed the result): the minimap's sticky sampling (`MinimapSampling::compute` with the last state, `on_lines_deleted`, `on_lines_inserted`, replayed from the model's edit log while view lines are model lines; with word wrap or folds the state is not moved through the edits, an open class 3 gap on the editor/browser row), and `tokenizeIfCheap` and `hasAccurateTokensForLine` in the comment commands and trim trailing whitespace (the action and the save participant). Trim on a file just opened took 6.8 s and comment at line 49000 5.3 s, tokenizing the file; now 3.70 and 13.53 ms, gated under 16 ms by the typing check.++## GPUI on gpui-fast (milestone 26, branch worktree-gpui-fast)++- Decision (Artur, 2026-12-01): the port's GPUI moves from Wu (dstrml/wu `a3ced28`, `native/vendor/wu`) to gpui-fast (longbridge/gpui-fast `f0a91cf952678e4d205da1ec189b6d134e975bcd`, `UPSTREAM` zed `a36d4850f3c087bfef8a3552e2e15d72d97efdf4`, import commit `d8c5342`). Reason: its Retained Mode (`fast/retained.rs`) redraws only views that called `cx.notify()`, and its layout caches (`fast/layout.rs`, `fast/layout_key.rs`) skip unchanged subtrees, the frame cost the port's long lists and editors pay on Wu. `main` stays on Wu until the M26 "done when" gate is green.+- Vendored like Wu: `native/vendor/gpui-fast` holds `crates/gpui`, `gpui_apple`, `gpui_windows`, `assets/fonts` and the licenses at `f0a91cf` (commit `903a3944bae`, unchanged, so later commits show only the port's patches); `native/Cargo.toml` takes `gpui` and `gpui_platform` from the git rev and `[patch."https://github.com/longbridge/gpui-fast"]` points the three crates at the copies. `native/vendor/wu` stays until `main` switches: `main` builds from it and the Wu-era results (`port/results/corners.md`) cite it; nothing on this branch builds from it.+- Toolchain: `native/rust-toolchain.toml` pins 1.100.0, gpui-fast's pin (`gpui_macros` uses `str::trim_prefix`, unstable in 1.99.1). The lockfile moves cocoa 0.26 to 0.25 and cocoa-foundation 0.2.1 to 0.1.2, gpui-fast's versions.+- Licenses: every gpui-fast crate in the graph is Apache-2.0 on every target, so `port/tools/check-licenses` checks all platforms (Wu's `gpui_linux` and `gpui_windows` pulled a GPL i18n crate, which is why it filtered to aarch64-apple-darwin).+- Risks: one company's experimental fork; Retained Mode shows a stale view wherever the port changes state without `cx.notify()` (Wu repainted everything each frame, so a missing notify went unseen); gpui-fast's `view.rs` drops upstream's cache-by-bounds for `fast::retained` (its docs/upstream-sync.md), and `workbench/part_view.rs` (`AnyView::cached`) is the port's one cached view; the Chromium-fidelity patches below land in files gpui-fast rewrote (`taffy.rs` is a dead file behind `#[path = "fast/taffy.rs"]`, text and list layout go through `fast/`), so they are re-ports, not cherry-picks; the README's benchmark baseline changes with the GPUI. Retained Mode off for a comparison: `GPUI_VIEW_RETENTION=0`, or `Window::set_view_retention(false)` in tests.+- Sync: read gpui-fast's `UPSTREAM` and `script/check-upstream`, bump the rev in `native/Cargo.toml` and the vendored copy in one commit, reapply the port's vendor commits, rerun the M26 gate. Rollback: `main` is on Wu; dropping the branch undoes everything.+- Forced API changes (the build had 11 errors in `app` and 18 more in its tests, 0 on Wu; now 0 and 0):+ - Missing from gpui-fast, so the call sites fall back to plain paint, each with a `shortcut:` comment, until the patch is ported: `Window::paint_backdrop_blur` (Wu's own; `quick_input_view.rs` `frosted_glass` paints the tint without blur, `corner_lab.rs` too), `Window::layout_subpixel_x` and `TextStyleRefinement::strut_size` (189efc4c454; the `file_icons.rs` glyph at x 0, `icon_label.rs` without the 13px strut), `ListState::with_whole_pixel_item_heights` (40f47558cba; `settings_editor_view.rs`), `Menu::window_menu` (gpui-fast's gpui_macos makes the menu titled "Window" the windows menu; a translated title loses it).+ - `chromium_baseline` (189efc4c454) is pure math: now a local function in `file_icons.rs`.+ - `Window::paint_drop_shadows` lost Wu's `opaque_background` argument; the terminal passed `false`, which is what gpui-fast always does.+ - `Keystroke::parse` and `KeyBinding::new` take `&'static str`, `Keystroke::unparse` an `OperatingSystem`: runtime strings go through `crate::parse_keystroke` (`parse_with_os` with `crate::host_os()`, Wu's `secondary-` rule) and the menu bar's key equivalents through `KeyBinding::load` with the `App`, so `native_menus` takes `cx`.+ - `ScrollEvent` has a `source` (the scroll frame-time test sends `ScrollSource::Pointer`); `ScrollWheelEvent` and `on_scroll_wheel` are deprecated aliases, left as they are (warnings only).+ - `Glyph` lost its `IntoElement` impl: gpui-fast implements it for every `Element`.+ - `VisualTestContext::all_debug_bounds` and `read_rendered_frame` (59891335621) are ported into the vendored `test_context.rs` (d3d45145b57): the hover, breadcrumbs and themes tests read the frame.+- Baseline on `b867659888d` (`cargo gc test -p app`, the bin target): 3721 passed, 21 failed, 20 ignored. Layout and text snapping without the Chromium patches (16: tab, outline, quick open, search message, editor type picker and icon label widths; settings checkbox and row heights; welcome view wraps; debug toolbar, decoration outline and icon picker half pixels); rounded corners and blur (`corner_lab`); hover dropped on a key press (65696abd52a); a test's app not freed (836ad8f1b9e); Retained Mode (2: `webview_views` showing a view after a context key changed without a notify, the markdown hover's size; both pass with `GPUI_VIEW_RETENTION=0`, which leaves the other 19).+- The 31 Wu commits (`git log -- native/vendor/wu`, newest first). Hunks: the commit's Rust and Metal hunks under `crates/`; failed: the hunks `patch --dry-run` rejects on the gpui-fast copy, each commit tried alone (a commit that builds on an earlier one also fails where that one is missing). Merge commits carry no change of their own.++| Commit | Subject | Area | In gpui-fast | gpui-fast files | Hunks, failed |+|---|---|---|---|---|---|+| 836ad8f1b9e | fix(gpui): free each test's app when its gpui::test iteration ends | test harness | no | `app/test_context.rs`, `test.rs` | 5, 2 |+| 79733748cce | feat(windows): show webviews through WebView2 | gpui_windows | yes: `CreateTargetForHwnd(hwnd, false)` already | `gpui_windows/src/directx_renderer.rs` | none needed |+| 33795cc2da5 | Merge branch 'port-integrate' into port-audit-platform | merge | | | |+| 65696abd52a | fix(statusbar): keep hover styles while typing under a still pointer | hover | no: `fast/layers/hover_freeze.rs` `hides_hover` still drops hover on keyboard input | `window.rs`, `fast/layers/hover_freeze.rs` | 3, 3 |+| ec8a6221aa8 | perf(workbench): update the menu bar 200 ms after a frame, as menuUpdater does | view cache | not applicable: the `view.rs` cache is replaced by `fast/retained.rs` | `fast/retained.rs`, `fast/tracked_entities.rs` | 1, 1 |+| 59891335621 | test(gpui): read every debug bound, the scene and hitboxes of a frame | test harness | ported (d3d45145b57) | `app/test_context.rs` | 1, 0 |+| 40f47558cba | fix(app): settings rows advance by their rounded heights | list | no | `elements/list.rs`, `fast/list_measure.rs` | 11, 10 |+| 189efc4c454 | fix(gpui): place text and icon glyphs where Blink paints them | text, layout | no | `elements/text.rs`, `style.rs`, `fast/taffy.rs`, `text_system.rs`, `text_system/line.rs`, `window.rs`, `fast/text.rs`, `fast/glyphs.rs` | 14, 6 |+| ea6b1b2e09c | Merge branch 'port-integrate' into port-compare-fix | merge | | | |+| 7a43dfd6dad | fix(gpui): keep lengths in 1/64px layout units as Chromium does | layout | no | `fast/taffy.rs`, `fast/layout.rs`, `elements/text.rs` | 7, 2 |+| 2735a3cd43a | Merge branch 'port-icons' into port-integrate | merge | | | |+| f2549c84eef | fix(gpui): round measured leaves up to a LayoutUnit, not a device px | layout | no | `fast/taffy.rs`, `util.rs` | 5, 1 |+| ef6dd4ac5b2 | Merge branch 'port-corners' into port-integrate | merge | | | |+| 471caaf3f25 | fix(gpui): keep shadow on partly covered edges, downscale blur as Skia | shadows, blur | no (no backdrop blur at all) | `style.rs`, `window.rs`, `gpui_apple/src/metal_renderer.rs`, `shaders.metal`, `fast/layers/paint.rs` | 15, 11 |+| 16c8b74b593 | Merge branch 'port-icons' into port-integrate | merge | | | |+| 8edf95f801c | fix(gpui): hang trailing spaces and keep fractional text widths | text | no | `elements/text.rs`, `text_system/line_layout.rs`, `fast/text.rs` | 2, 1 |+| 5c804b6e82f | Merge branch 'port-corners' into port-integrate | merge | | | |+| cc9caa16123 | fix(gpui_apple): blur frosted glass as Chromium's mirrored backdrop-filter | blur | no (no backdrop blur at all) | `scene.rs`, `window.rs`, `gpui_apple/src/metal_renderer.rs`, `shaders.metal` | 23, 19 |+| b99f7c5012a | Merge branch 'port-integrate' into port-m11-auxwin | merge | | | |+| 58653bf4f54 | Merge branch 'port-corners' into port-integrate | merge | | | |+| d3b6af42c4e | fix(gpui): round text width up to a layout unit, not a pixel | text | no (`fast/text.rs` ceils to a pixel) | `elements/text.rs`, `fast/text.rs` | 2, 1 |+| d066288ea59 | fix(gpui): keep fractional line heights in wrapped text | text | no | `elements/text.rs`, `fast/text.rs` | 1, 1 |+| 37dc1a5b3fb | fix(gpui_apple): draw rounded corners as Skia Graphite's AnalyticRRect | rounded corners | no | `gpui_apple/src/shaders.metal` | 3, 3 |+| 939cd641393 | fix(gpui_apple): cover the inner border corner with Skia's conic chords | rounded corners | no | `gpui_apple/src/shaders.metal` | 2, 2 |+| b3b8cbb7e58 | test(gpui): vendor the test fonts and expect half-up snapping | test fonts | no (gpui-fast's fonts: ibm-plex-sans, lilex) | `assets/fonts`, `elements/div.rs`, `window.rs` | 2, 0 |+| 3a8eab1e210 | fix(gpui_apple): quantize only translucent fills to 8-bit premultiplied | rounded corners | no | `gpui_apple/src/shaders.metal` | 1, 1 |+| a4e7ebb6289 | fix(gpui): keep half-toward-zero snap for layout bounds | layout | no | `fast/taffy.rs`, `fast/layout_bounds.rs` | 2, 2 |+| 1ad325a647a | fix(gpui_apple): draw rounded quads the way Chromium rasterizes them | rounded corners | no | `gpui_apple/src/shaders.metal` | 7, 1 |+| 78a79751093 | fix(gpui): round .5 device px up when snapping layout, as Chromium | layout | no (its hunks apply only to the dead `taffy.rs`) | `fast/taffy.rs`, `util.rs` | 5, 0 |+| 6c3b7094c6f | fix(gpui): shrink the background behind an opaque rounded border | quads | no | `style.rs`, `fast/layers/paint.rs` | 2, 0 |+| 2a560ca76e0 | build(port): vendor wu's gpui and gpui_apple through [patch] | vendor | | | |