Visual Studio Code, rebuilt in Rust
Rust
docs(port): record scroll frame costs and the whole-workbench render gap
rokartur6be95af252cc
diff --git a/port/ledger.md b/port/ledger.mdindex 2176ac3eb72..ed679169a0a 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -407,7 +407,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/services/language | workbench service | M7 | verified | | getAssociationByPath with the full glob dialect (languages::tests::file_patterns_take_the_whole_glob_dialect) plus firstLine detection (languages.rs); cargo test -p app languages::tests || workbench/services/languageDetection | workbench service | M13 | verified | | language_detection.rs (languageDetectionWebWorker.ts `detectLanguagesImpl`, `adjustLanguageConfidence`, the 10000 char sample) and workbench/language_detection.rs (`LanguageDetectionWorkerClient`: the file name guess first, then @vscode/vscode-languagedetection 1.0.23 with its model in a Bun worker from the app's node_modules, model ids mapped as `getLanguageId`; `autoDetectLanguage` of textEditorModel.ts for untitled models and extensionless plain text files, 600 ms throttle, skipped after an explicit language and with `workbench.editor.languageDetection` off): cargo test -p app language_detection (the worker test runs the real model). The history biases only feed the regexp model, which 1.147.0 does not ship (`vscode-regexp-languagedetection` is not a dependency), so neither side has it; no telemetry || workbench/services/languageStatus | workbench service | M13 | verified | | `$setLanguageStatus` / `$removeLanguageStatus`, statuses matched by selector, ordered by severity, source, id (workbench/language_status.rs): cargo test -p app language_status |-| workbench/services/layout | workbench service | M11 | ported | [3 L] editor_status.rs:606, content_hover.rs:498: no workbench-wide Tab order (the browser's DOM order): Tab stops at the content hover's ends, and Tab on the status bar in Tab Focus Mode keeps the focus (port/notes.md Toggle Tab Key Moves Focus) | layout.ts as a split-view tree (workbench/layout.rs): panel position (bottom, top, left, right) and alignment, primary side bar left or right, maximized panel with `panelMaximizationSupportedWhen`, hidden parts, persisted sizes and positions; zen mode (zen_mode.rs) with its settings and restore; centered layout (centered_layout.rs) with its sashes and stored margins; View > Appearance entries and the Panel Position and Align Panel submenus (cargo test -p app -- layout part_grid centered_layout zen_mode); layoutActions.ts Customize Layout quick pick (workbench/customize_layout.rs) with live items, Restore Defaults and Close, Toggle Activity Bar Visibility, Align Quick Input Top/Center (cargo test -p app -- customize_layout toggling_the_activity_bar; ui-pair m11/manage-menu.json, port/results/manage-menu.md; missing until then though the title bar showed its button); ui-pair layout-positions.json and layout-zen.json against the reference (port/results/layout.md). The pairs run with `zenMode.fullScreen` off. Maximize Secondary Side Bar (`workbench.action.maximizeAuxiliaryBar`, `restoreAuxiliaryBar`, `toggleMaximizedAuxiliaryBar`, the title's toggle) hides the other parts and restores them (workbench/panel.rs; cargo test -p app -- maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back). Zen mode enforces `zenMode.showTabs` on the main editor part until it ends (layout.ts `toggleZenMode` `enforcePartOptions`; workbench/zen_mode.rs `editor_show_tabs`; cargo test -p app -- show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own); navigationActions.ts `workbench.action.focusNextPart`/`focusPreviousPart` (F6, Shift+F6) walk editor, panel, auxiliary bar, status bar, activity bar and side bar past the hidden ones with layout.ts `focusPart` (the pane container's first expanded view; workbench/part_navigation.rs; cargo test -p app f6_walks_the_visible_parts); in an editor window F6 goes between its editor and its own status bar, whose entry focus is kept per window (workbench/auxiliary_windows.rs `auxiliary_status_bar`, workbench/status_entries.rs; cargo test -p app f6_in_an_editor_window_reaches_its_own_status_bar) |+| workbench/services/layout | workbench service | M11 | ported | [3 L] editor_status.rs:606, content_hover.rs:498: no workbench-wide Tab order (the browser's DOM order): Tab stops at the content hover's ends, and Tab on the status bar in Tab Focus Mode keeps the focus (port/notes.md Toggle Tab Key Moves Focus) <br> [3 L] workbench.rs:579: the Workbench is one GPUI view, so every scroll frame of any list renders every part again, where upstream's DOM updates only the scrolled list; per frame the activity bar's Extensions badge rebuilds the extension list (extensions_view.rs:1119 `extensions_badge`), each of the 158 `key_context` callers clones every `config.*` key (keyboard.rs:400), the menubar and the timeline toolbar are rebuilt. GUI (Studio at load 33 to 57, 60 Hz display, 690 trackpad events in 7 s): main thread in `Window::draw` 86% scrolling the Explorer (800 files), 89% the Extensions @builtin list (port/notes.md Scroll frame costs) | layout.ts as a split-view tree (workbench/layout.rs): panel position (bottom, top, left, right) and alignment, primary side bar left or right, maximized panel with `panelMaximizationSupportedWhen`, hidden parts, persisted sizes and positions; zen mode (zen_mode.rs) with its settings and restore; centered layout (centered_layout.rs) with its sashes and stored margins; View > Appearance entries and the Panel Position and Align Panel submenus (cargo test -p app -- layout part_grid centered_layout zen_mode); layoutActions.ts Customize Layout quick pick (workbench/customize_layout.rs) with live items, Restore Defaults and Close, Toggle Activity Bar Visibility, Align Quick Input Top/Center (cargo test -p app -- customize_layout toggling_the_activity_bar; ui-pair m11/manage-menu.json, port/results/manage-menu.md; missing until then though the title bar showed its button); ui-pair layout-positions.json and layout-zen.json against the reference (port/results/layout.md). The pairs run with `zenMode.fullScreen` off. Maximize Secondary Side Bar (`workbench.action.maximizeAuxiliaryBar`, `restoreAuxiliaryBar`, `toggleMaximizedAuxiliaryBar`, the title's toggle) hides the other parts and restores them (workbench/panel.rs; cargo test -p app -- maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back). Zen mode enforces `zenMode.showTabs` on the main editor part until it ends (layout.ts `toggleZenMode` `enforcePartOptions`; workbench/zen_mode.rs `editor_show_tabs`; cargo test -p app -- show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own); navigationActions.ts `workbench.action.focusNextPart`/`focusPreviousPart` (F6, Shift+F6) walk editor, panel, auxiliary bar, status bar, activity bar and side bar past the hidden ones with layout.ts `focusPart` (the pane container's first expanded view; workbench/part_navigation.rs; cargo test -p app f6_walks_the_visible_parts); in an editor window F6 goes between its editor and its own status bar, whose entry focus is kept per window (workbench/auxiliary_windows.rs `auxiliary_status_bar`, workbench/status_entries.rs; cargo test -p app f6_in_an_editor_window_reaches_its_own_status_bar) || workbench/services/lifecycle | workbench service | M11 | ported | [3 L] unattendedRestart.ts: `IUnattendedRestartService` with its participants (unattendedRestartParticipants.ts, terminalUnattendedRestart.ts, testingUnattendedRestart.ts, webviewUnattendedRestart.ts, notebookUnattendedRestart.ts, debugLifecycle.ts, task.contribution.ts, workingCopyBackupTracker.ts, testingContinuousRunService.ts `testing.continuousRun`, window.ts `cli.waitingForEditorClose`), platform/update's `UnattendedRestartScheduler` (restart to update while the screen is locked, with `update.restartWhenIdle` on) and windowsStateHandler.ts `setNextExactRestore` not ported | workbench/lifecycle.rs: ShutdownReason, onBeforeShutdown vetoes on quit, close button, closeWindow, reload and load (`window.confirmBeforeClose`, backup tracker auto save, hot exit, showSaveConfirm); cargo test -p app lifecycle; no phases or onWillShutdown joiners; verified: cargo test -p app backup_tracker lifecycle (workingCopyBackupTracker.test.ts); ui-pair hot-exit.json `dirty`, `restored` vs the reference (port/results/windows.md, milestone 11 verification) || workbench/services/localTranscription | workbench service | | removed | | no AI or Microsoft services by decision (port/notes.md); API stays inert || workbench/services/localization | workbench service | M18 | verified | | ui-pair port/fixtures/extensions/ui-display-language.json: picking Deutsch installs MS-CEINTL.vscode-language-pack-de with the "Installing Deutsch language support..." progress and asks "Restart VSRustium to switch to Deutsch?"; localeService.ts: argv.json `locale` written and cleared, restart dialog, install of an MS-CEINTL pack: cargo test -p app nls localization; Command Palette titles, categories and descriptions translate by the reference call's module and key (port/tools/ref-commands with ref-nls-clone.ts; cargo test -p app a_palette_title_two_modules), menu bar items, side bar titles and pane headers by the reference's `nlsKeys` per menu, view and container (cargo test -p app menu_bar_items_and_view_titles_resolve_per_scope); other surfaces stay English (port/notes.md) |diff --git a/port/notes.md b/port/notes.mdindex ca73f193e2d..747a45cc5b8 100644--- a/port/notes.md+++ b/port/notes.md@@ -990,6 +990,7 @@ What to do (milestone 21, in order):- `port/tools/bench`: Wu's `script/memory-benchmark` method generalized to N apps (`APPS="name=cmd;..."`), plus an extension host line per app.- Wu's `.cargo/config.toml` links with Homebrew lld on aarch64-apple-darwin; the Studio has no lld, so Wu is built with `RUSTFLAGS="-C symbol-mangling-version=v0 --cfg tokio_unstable"` (same flags, Apple ld). Env `CARGO_TARGET_*_RUSTFLAGS` does not work for this: cargo appends it to the config array.+- Scroll frame costs (branch port-fix-settings-scroll): `settings_scroll_frame_time` (ignored test, `cargo test --release -p app -- --ignored settings_scroll_frame_time --nocapture`) scrolls the whole settings tree (1810 rows) in a headless 1440x900 workbench with gpui's NoopTextSystem, 600 frames of a 30px trackpad delta. Before: median 37.1 ms, p95 51.2 ms; `sample` put about 90% of the frame in `wordify_key` compiling 14 regexes per call, twice per visible row, and a third of the rest in `trim_category_for_group` compiling its group id patterns. With the regexes compiled once: median 3.3 ms, p95 3.7 ms. With the `config.*` context keys kept by `Configuration` until a layer changes (they were flattened again on every `key_context` call): median 1.7 ms, p95 2.1 ms (3 runs). The real app (Settings, search "editor", 572 rows; scratch CGEvent probe at 120 Hz on the Studio lane, main thread sampled): `Window::draw` held the main thread 93 to 97% of the time before, 56% after with the same input; what is left is the whole Workbench rendering on each frame (the layout row's gap). CoreText needs the main thread, which libtest never gives, so the headless check cannot use real text shaping.## GUI lanes (Studio)