Visual Studio Code, rebuilt in Rust
Rust
perf(editor): stop redrawing the workbench for inlay hints and the ruler's word highlights
rokartur27dd4ca0b914
diff --git a/native/crates/app/src/workbench/document_highlights.rs b/native/crates/app/src/workbench/document_highlights.rsindex 55a83072d03..478c2416ba3 100644--- a/native/crates/app/src/workbench/document_highlights.rs+++ b/native/crates/app/src/workbench/document_highlights.rs@@ -175,8 +175,14 @@ impl Workbench {/// The overview ruler lines of the word highlights by kind: Text, Read (and no kind), Write, with their colors.pub(super) fn word_highlight_ruler_lines(&self, editor: &OpenEditor) -> [(Vec<(usize, usize)>, Rgba); 3] {let mut lines = [Vec::new(), Vec::new(), Vec::new()];+ // A word on every line of a long file gives thousands of highlights: one map, not a scan per highlight.+ let mut kinds = std::collections::HashMap::new();+ for (line, range, kind) in &self.document_highlights.ranges {+ kinds.entry((*line, range)).or_insert(*kind);+ }for (line, columns) in &editor.highlights {- lines[self.word_highlight_kind(*line, columns).min(2) as usize].push((*line, *line));+ let kind = kinds.get(&(*line, columns)).copied().unwrap_or(TEXT);+ lines[kind.min(2) as usize].push((*line, *line));}let [text, read, write] = lines;[diff --git a/native/crates/app/src/workbench/inlay_hints.rs b/native/crates/app/src/workbench/inlay_hints.rsindex d2705201d13..1936fe8d2f6 100644--- a/native/crates/app/src/workbench/inlay_hints.rs+++ b/native/crates/app/src/workbench/inlay_hints.rs@@ -195,6 +195,10 @@ impl Workbench {fn schedule_inlay_hints(&mut self, delay: Duration, cx: &mut Context<Self>) {let Some(editor) = self.editors.active().filter(|editor| Some(editor.model_id) == self.inlay_hints.model_id) else { return };let handles = self.inlay_hint_handles(editor);+ // `_update` returns without a provider (inlayHintsController.ts:189), so no scroll asks.+ if handles.is_empty() {+ return;+ }let debounce_key = format!("{}{handles:?}", editor.document().uri());let model_id = editor.model_id;let ranges = hint_ranges(editor, self.editors.viewport);@@ -244,7 +248,7 @@ impl Workbench {workbench.render_inlay_hints(items);workbench.release_inlay_hint_lists(old);workbench.cache_inlay_hints();- cx.notify();+ workbench.notify_editor_view(cx);});}));}diff --git a/native/crates/app/src/workbench/inlay_hints/tests.rs b/native/crates/app/src/workbench/inlay_hints/tests.rsindex e0351cca488..952714c74b3 100644--- a/native/crates/app/src/workbench/inlay_hints/tests.rs+++ b/native/crates/app/src/workbench/inlay_hints/tests.rs@@ -111,3 +111,56 @@ fn the_delay_follows_the_providers_answer_time(cx: &mut TestAppContext) {cx.executor().advance_clock(Duration::from_millis(1));assert!(asked(cx));}++/// Without a provider a scroll asks nothing; a provider's answer draws the editor part again, not the workbench+/// (whose notify would draw every part).+#[gpui::test]+fn a_scroll_redraws_the_editor_only(cx: &mut TestAppContext) {+ let app_root = std::path::Path::new(env!("VSCODE_SRC")).to_path_buf();+ let dir = std::env::temp_dir().join(format!("code-gpui-inlay-hints-redraw-{}", std::process::id()));+ std::fs::create_dir_all(&dir).unwrap();+ std::fs::write(dir.join("a.txt"), "let x = 1;\n").unwrap();+ let workspace = config::workspace::Workspace::folder(dir.clone());+ let settings = Arc::new(Mutex::new(Settings::load(Registry::with_extensions(&[]), dir.join("User"), Some(workspace.clone()))));+ let (sender, receiver) = std::sync::mpsc::channel::<HostMessage>();+ let (workbench, cx) = cx.add_window_view(|window, cx| {+ let mut workbench = Workbench::new(dark_modern(), app_root.clone(), Some(workspace), Languages::new(&[]), settings, HostSync::new(sender), cx);+ workbench.open_file(dir.join("a.txt"), true, window, cx);+ workbench+ });+ cx.run_until_parked();+ cx.update(|window, cx| drop(window.draw(cx)));+ let scheduled = workbench.update(cx, |workbench, cx| {+ workbench.inlay_hints_scrolled(cx);+ workbench.inlay_hints.request.is_some()+ });+ assert!(!scheduled, "no provider, so the scroll asks nothing");++ workbench.update(cx, |workbench, cx| {+ workbench.language_features.register(REGISTER, vec![json!(1), json!("*"), json!(null), json!(2)]);+ workbench.inlay_hints_registrations_changed(cx);+ });+ cx.executor().advance_clock(Duration::from_secs(1));+ cx.run_until_parked();+ for message in receiver.try_iter() {+ let _ = message.reply.map(|reply| reply.send(Ok(Value::Null)));+ }+ cx.run_until_parked();+ cx.update(|window, cx| drop(window.draw(cx)));+ workbench.update(cx, |workbench, cx| workbench.inlay_hints_scrolled(cx));+ cx.executor().advance_clock(Duration::from_secs(1));+ cx.run_until_parked();+ let requests: Vec<HostMessage> = receiver.try_iter().filter(|message| message.method == "$provideInlayHints").collect();+ assert_eq!(requests.len(), 1);+ let notified = std::rc::Rc::new(std::cell::Cell::new(0));+ let _observer = {+ let notified = notified.clone();+ cx.update(|_, cx| cx.observe(&workbench, move |_, _| notified.set(notified.get() + 1)))+ };+ for request in requests {+ let _ = request.reply.expect("a call").send(Ok(Value::Null));+ }+ cx.run_until_parked();+ assert_eq!(notified.get(), 0, "the answer draws the editor part alone");+ std::fs::remove_dir_all(dir).unwrap();+}diff --git a/port/ledger.md b/port/ledger.mdindex fb1f3e949ad..d5b31bcb7f3 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -315,7 +315,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| editor/contrib/hover | src/vs/editor/contrib | M13 | verified | | workbench/content_hover.rs (contentHoverController, hoverOperation timing, markdown/marker/unicode participants, sticky, mouse-getting-closer, `editor.hover.*` settings, showHover/hideHover, Show or Focus Hover with its `focus` argument, `editorHoverVisible`, `editorHoverFocused`: Escape hides the focused hover and focuses the editor, a focused hover stays through mouse moves and leaves, a click in the text hides it; focusable parts with Tab through them and the links, verbosity actions, copy buttons and status bar actions inside them, which Enter or Space activates, `focusedHoverPartIndex` for the verbosity actions, the scroll, page and top/bottom hover actions; hoverAccessibleViews.ts in workbench/accessible_view.rs: Alt+F2 reads the focused part or the whole hover with the part's verbosity actions in the toolbar, Alt+F1 lists them before the part, the view follows the hover's contents and keeps it open, Escape focuses the part again, and a shown workbench hover is read in its place), workbench/content_hover_view.rs (widget placement as `_layoutBoxInPage`, max size, rows, copy button with its "Copied to clipboard" status, marker status bar with View Problem, resize sashes with `_lastDimensions`, the verbosity + and - of a provider's hover with Increase/Decrease Hover Verbosity Level and `verbosityRequest`): cargo test -p app content_hover; ui-pair hover on src/main.ts. The color picker part is workbench/color_picker.rs, the inlay hint tooltip comes from workbench/inlay_hints.rs || editor/contrib/inPlaceReplace | src/vs/editor/contrib | M8 | verified | | Replace with Previous/Next Value (Shift+Cmd+, and ., palette): number step and value sets of `navigateValueSet`, 350 ms outline in light themes; cargo test -p app editor::in_place_replace (upstream has no test); ui-pair light theme `x = true; y = 41; z = 1.5` from the palette || editor/contrib/indentation | src/vs/editor/contrib | M8 | verified | [scheduling L] minimap.rs:87; minimap_view.rs:432; unicode_highlight.rs:63; indentation.rs:43; comment.rs:45; smart_select.rs:292: sticky minimap sampling, worker section headers and unicode highlights, tokenizeIfCheap, the 30 ms smart select yield. Accepted as "Scheduling differences" only with a measured same result and typing on a 50k-line TS file under 16 ms per edit; otherwise class 3. Audit inputs at 5e5b1b0a915. | indentation.ts actions (indent using spaces/tabs, tab display size, detect, convert to spaces/tabs) and trimTrailingWhitespaceCommand.ts with their upstream tests, auto-indent on Enter and on type (`editor.autoIndent`), Reindent Lines and Reindent Selected Lines: cargo test -p app indentation editor_status editor::auto_indent (cursor.test.ts indent cases, Auto Indent On Type - TypeScript/JavaScript, shiftCommand.test.ts doc block cases); auto-indent on paste (`editor.autoIndentOnPaste`, `autoIndentOnPasteWithinString`, `AutoIndentOnPaste.trigger`) and the Ruby, PHP and Visual Basic suites of indentation.test.ts pass; the cases upstream skips (`test.skip`: paste 5, Ruby, Go, CPP 3, HTML, Latex, Lua) are `#[ignore]` and fail as upstream (cargo test -p app auto_indent, 115 passed, 13 ignored); indentation.ts actions (indent using spaces/tabs, tab display size, detect, convert to spaces/tabs) and trimTrailingWhitespaceCommand.ts with their upstream tests, auto-indent on Enter and on type (`editor.autoIndent`), Reindent Lines and Reindent Selected Lines: cargo test -p app indentation editor_status editor::auto_indent (cursor.test.ts indent cases, Auto Indent On Type - TypeScript/JavaScript, shiftCommand.test.ts doc block cases); no auto-indent on paste (`editor.autoIndentOnPaste`, default off), not the Ruby, PHP, Go, CPP, HTML, Visual Basic, Latex and Lua suites |-| editor/contrib/inlayHints | src/vs/editor/contrib | M13 | verified | | workbench/inlay_hints.rs over editor/injected_text.rs (the 'InlayHint' debounce: inlay_hints::tests::the_delay_follows_the_providers_answer_time; off a word a hint attaches after its token's start, `_getRangeAtPosition`: inlay_hints::tests::a_hint_off_a_word_attaches_after_the_start_of_its_token; inlayHintsController.ts: cache, fixed lengths while typing, label parts, links, tooltip resolve, double click edits, `editor.inlayHints.*`, `_executeInlayHintProvider`): cargo test -p app injected_text inlay_hints; ui-pair port/fixtures/language-features/steps-color.json (port/results/inlay-hints.md) |+| editor/contrib/inlayHints | src/vs/editor/contrib | M13 | ported | [3 S] inlay_hints.rs:136: a scroll asks the providers while `editor.inlayHints.enabled` is `off` (inlayHintsController.ts:184 returns before its scroll listener) | workbench/inlay_hints.rs over editor/injected_text.rs (the 'InlayHint' debounce: inlay_hints::tests::the_delay_follows_the_providers_answer_time; off a word a hint attaches after its token's start, `_getRangeAtPosition`: inlay_hints::tests::a_hint_off_a_word_attaches_after_the_start_of_its_token; inlayHintsController.ts: cache, fixed lengths while typing, label parts, links, tooltip resolve, double click edits, `editor.inlayHints.*`, `_executeInlayHintProvider`): cargo test -p app injected_text inlay_hints; ui-pair port/fixtures/language-features/steps-color.json (port/results/inlay-hints.md) || editor/contrib/inlineCompletions | src/vs/editor/contrib | M13 | ported | [3 M] inline_completions.rs: no inlineCompletionsHintsWidget.ts toolbar (previous/next, the count, `editor/inlineCompletions/actions` at :213) | workbench/inline_completions.rs, ghost_text.rs (computeGhostText.ts over diff::lcs_diff), the suggest widget adaptor in workbench/suggest_controller.rs and workbench/suggest_widget.rs: cargo test -p app ghost_text inline_completions (computeGhostText.test.ts cases, getSecondaryEdits.test.ts, inlineCompletions.test.ts: the "Inline Completions" suite with its Forward Stability tests, the Multi Cursor Support suite and both "Change hint" tests; suggestWidgetModel.test.ts "Ghost Text" and "offWhenInlineCompletions", the augmentation over the suggest widget's own list (only_the_answer_with_the_suggest_item_augments_it), the inline preselect of the suggest widget, Shift previewing the replace edit and handleSuggestAccepted), cargo test -p diff lcs_diff (diff.test.ts and upstream outputs); ui-pair port/fixtures/language-features/steps-ghost.json (port/results/inlay-hints.md). Not ported by design: "Emits empty response telemetry after instantiation service disposal" (the port has no telemetry), suggestWidgetModel.test.ts "Active" (test.skip upstream, microsoft/vscode#166023), ghostTextView/layout/scrollToReveal tests (DOM, the ui-pair check stands in). Inline edits, next edit suggestions and their tests (inlineEdits, editKind, longDistanceWidgetPlacement, renameSymbolProcessor, graph) are AI: removed. Items dedupe and select by `semanticId`: cargo test -p app items_with_the_same_trimmed_edit_cycle_as_one. `getDefaultRange` from the word start to the line end: cargo test -p app an_item_without_a_range_replaces_up_to_the_line_end. || editor/contrib/inlineProgress | src/vs/editor/contrib | M13 | verified | | workbench/inline_progress.rs (inlineProgress.ts): the spinner after 500 ms at the paste or drop position with 1em of room as injected text, its hover, click cancels; the paste falls back to the default paste: cargo test -p app paste_edits (the_paste_progress_makes_room_for_its_spinner); ui-pair d.md paste (no spinner once the provider answers, as in the reference) || editor/contrib/insertFinalNewLine | src/vs/editor/contrib | M8 | verified | | `OpenEditor::insert_final_new_line` in `editor/indentation.rs`, `editor.action.insertFinalNewLine` (writable): cargo test -p app insert_final_new_line; ui-pair notes.txt through the Command Palette |@@ -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 | ported | [3 S] workbench/language_detection.rs: 4 s after typing a Python snippet into a new untitled editor (Cmd+N in a ui-pair run, hc) the port's language entry shows Python, the reference's still Plain Text, also after 12 s; not yet known whether the reference build lacks the detection model or the port detects where upstream does not | 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 S] terminal_view.rs:1235: with Tab Focus Mode on, Tab in the terminal goes to the shell, where terminalInstance.ts:1204 leaves it to the browser's Tab order (port/notes.md Toggle Tab Key Moves Focus) <br> [3 S] action_bar.rs:45: an action bar item focused by Tab shows no hover, where the reference shows the command center's and Customize Layout's tooltips on focus, and the activity bar item's focus outline has square corners where the reference's are rounded (ui-pair Tab steps, port/notes.md Toggle Tab Key Moves Focus) <br> [3 L] workbench.rs:591: the Workbench is one GPUI view, so every scroll frame of any list renders and lays out every part again, where upstream's DOM updates only the scrolled list; the side bar, the editor area, the panel, the status bar, the activity bar and the title bar are cached part views (part_view.rs: a list scroll notifies only the view it was painted in, an editor scroll only the editor area's, a size measured while drawing redraws its view after the frame; the status bar gave no measurable change), the secondary side bar still renders with the Workbench; the Explorer's rows are absolutely placed 22px boxes as listView.ts's (workbench.rs Explorer rows; ~70% of the Explorer frame was the taffy layout of its rows in flow); the minimap copies unchanged rows from the last frame (minimap.rs `render_lines`) and the menu bar updates 200 ms after a frame as menubarControl.ts `menuUpdater` does; a folder with a sub-second mtime is cached 100 ms after its last change, not 2 s (explorer.rs `entries`: the Editor's first 1.5 s of frames re-read the fixture's 800-file root on each `key_context` call, port/notes.md Scroll frame costs, the Editor's slow start); `scroll_frame_time` median / p95 (two interleaved runs, the Studio shared): Explorer 2.9 / 3.2 and 2.9 / 3.6 ms (rows in flow: 10.9 / 18.6 and 11.0 / 21.4), Editor 6.9 / 7.7 and 6.9 / 7.5 ms, Settings 1.1 / 1.4 and 1.0 / 1.4 ms, Extensions 1.7 / 2.0 and 1.7 / 1.9 ms, every surface under the 8 ms gate headless (NoopTextSystem). GUI (release app on the Studio host desktop, the same folder, a scratch CGEvent probe posting 30px continuous scroll events at about 100 Hz, main thread sampled 5 s): scrolling the Editor keeps the main thread 91% in `Window::draw` (idle 5%): `text_editor_part` 38%, the Workbench root rendering again each frame 10% (headless only the editor area draws), CoreText `shape_text` 9%, taffy `compute_layout` 13%, `key_context` 14%; the Explorer, Extensions and Settings runs did not reach their lists (no screenshot over ssh to aim the probe), so they are not measured. Each `key_context` call (two per editor frame: floating_menu.rs:72 and the editor title actions, 12% of the frame) clones every `config.*` key (3%, keyboard.rs:409) and lists every Explorer row for the focused row's keys (explorer_actions.rs:311, 3%). 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/layout | workbench service | M11 | ported | [3 S] terminal_view.rs:1235: with Tab Focus Mode on, Tab in the terminal goes to the shell, where terminalInstance.ts:1204 leaves it to the browser's Tab order (port/notes.md Toggle Tab Key Moves Focus) <br> [3 S] action_bar.rs:45: an action bar item focused by Tab shows no hover, where the reference shows the command center's and Customize Layout's tooltips on focus, and the activity bar item's focus outline has square corners where the reference's are rounded (ui-pair Tab steps, port/notes.md Toggle Tab Key Moves Focus) <br> [3 L] workbench.rs:591: the Workbench is one GPUI view, so every scroll frame of any list renders and lays out every part again, where upstream's DOM updates only the scrolled list; the side bar, the editor area, the panel, the status bar, the activity bar and the title bar are cached part views (part_view.rs: a list scroll notifies only the view it was painted in, an editor scroll only the editor area's, a size measured while drawing redraws its view after the frame; the status bar gave no measurable change), the secondary side bar still renders with the Workbench; the Explorer's rows are absolutely placed 22px boxes as listView.ts's (workbench.rs Explorer rows; ~70% of the Explorer frame was the taffy layout of its rows in flow); the minimap copies unchanged rows from the last frame (minimap.rs `render_lines`) and the menu bar updates 200 ms after a frame as menubarControl.ts `menuUpdater` does; a folder with a sub-second mtime is cached 100 ms after its last change, not 2 s (explorer.rs `entries`: the Editor's first 1.5 s of frames re-read the fixture's 800-file root on each `key_context` call, port/notes.md Scroll frame costs, the Editor's slow start); `scroll_frame_time` median / p95 (two interleaved runs, the Studio shared): Explorer 2.9 / 3.2 and 2.9 / 3.6 ms (rows in flow: 10.9 / 18.6 and 11.0 / 21.4), Editor 6.9 / 7.7 and 6.9 / 7.5 ms, Settings 1.1 / 1.4 and 1.0 / 1.4 ms, Extensions 1.7 / 2.0 and 1.7 / 1.9 ms, every surface under the 8 ms gate headless (NoopTextSystem). GUI (release app on the Studio host lane with the extension host running, the same folder, a scratch CGEvent probe posting 30px continuous scroll events at about 100 Hz for 6 s, `Window::draw` timed by a scratch timer): the Editor draws 450 frames at median 10.5 / p95 11.8 ms. Before, an inlay-hint answer notified the Workbench (every part drew again, 78 of 87 frames) and the overview ruler matched each word highlight against every document highlight (80 to 120 ms a frame with the cursor on a word on each of the 20000 lines); now the answer redraws the editor view and no provider means no request (inlayHintsController.ts:189), and the ruler looks the kinds up in one map. Left in the Editor's GUI frame: taffy `layout_as_root` 24%, `key_context` 14%, `editor_lines` 10%, the map of 20000 highlights 9%, the minimap 5%; editor_view/cursor_blink.rs:145 notifies the Workbench every 500 ms, so every part draws again twice a second. Explorer in the GUI: 85 frames at median 9.5 / p95 50 ms, frames of 50 to 250 ms near the list's end with a row's hover. The Studio runs the app with "Screen Reader Optimized" on (an accessibility client is attached), which these GUI numbers include. Extensions and Settings are not measured in the GUI. Each `key_context` call (two per editor frame: floating_menu.rs:72 and the editor title actions, 12% of the frame) clones every `config.*` key (3%, keyboard.rs:409) and lists every Explorer row for the focused row's keys (explorer_actions.rs:311, 3%). 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 | verified | | `describeEditors` names the upstream input's `typeId` and differing `editorId`, and `workbench.floatingWindowNotRestorable` blocks while the process explorer, the port's one window that is no editor part, is open (upstream's is an editor in an auxiliary window): cargo test -p app blockers_name_the_editor_kind_and_the_window_that_does_not_come_back; 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; workbench/unattended_restart.rs: `canRestartUnattended` with its blocker aggregation and change log, and the participants `workbench.starting` (2.5 s after restore), dialog, quick input, transient workspace, modal editor, editors not restored or not restorable, `debug.sessionActive`, `tasks.running`, the backup tracker's `workingCopy.*` and `cli.waitingForEditorClose`, terminalUnattendedRestart.ts with childProcessMonitor.ts `hasChildProcesses` (terminal/pty.rs, background jobs included: cargo test -p app a_background_job_is_a_child_process_of_the_shell), testingUnattendedRestart.ts, `testing.continuousRun`, webviewUnattendedRestart.ts and notebookUnattendedRestart.ts: cargo test -p app unattended_restart (unattendedRestart.test.ts, terminalUnattendedRestart.test.ts, testingUnattendedRestart.test.ts); update/unattended_restart.rs: unattendedRestartScheduler.ts's decisions (keep awake from the lock, restart once locked a minute, retry every minute, veto, a newer update postponing, battery and thermal pressure, resume restarting the clock, the update not installed last time) over injected time: cargo test -p app update::unattended_restart (13 of unattendedRestartScheduler.test.ts's cases, without the telemetry outcomes the port does not send); workbench/unattended_restart.rs `UnattendedRestart`: the scheduler's host on macOS (power events, window blur, update state, timers, the `prevent-app-suspension` blocker, `quitAndInstall` from a window), `getWindowBlockers` (`window.launchArguments` and `window.launchedFromCli` from the command line that opened the window, a second instance's `VSCODE_CLI` sent with its arguments), `hasArgumentsLostOnRelaunch`, `app.launchedFromCli`, `app.dialogOpen` (dialog.rs `has_open_dialogs`: the NSAlert sheets and the open and save panels) and the failed update remembered across the restart: cargo test -p app unattended_restart (a_locked_screen_keeps_the_machine_awake, windows_that_do_not_come_back_as_they_are_block, launch_arguments_the_relaunch_drops_block, a_restart_that_came_back_on_the_same_commit_failed_to_install); windows_state.rs `setNextExactRestore`/`takeExactRestore` (minimized windows, hidden app): cargo test -p app windows_state; 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 8ad937e6b6f..ca48640f057 100644--- a/port/notes.md+++ b/port/notes.md@@ -1000,6 +1000,8 @@ What to do (milestone 21, in order):- Scroll frame costs, every surface (branch port-fix-settings-scroll): `workbench/scroll_frame_time.rs` holds one ignored test per surface (`cargo test --release -p app -- --ignored scroll_frame_time --nocapture --test-threads=1`) on one fixture: a folder of 801 files with a 20000-line `large.ts` open, every built-in extension installed and running, 1440x900, gate median and p95 under 8 ms. Median / p95 ms for Explorer, Editor, Extensions @builtin and Settings (now with a folder open, so not comparable to the paragraph above): at abfb67458da 194.0 / 281.5, 236.2 / 252.2, 4.3 / 11.0, 190.8 / 228.0; with the Explorer drawing only the rows in view (taffy laid out all 801 rows) 35.8 / 41.0, 84.5 / 89.5, 4.2 / 4.5, 37.5 / 54.4; with `FileTree` reading a folder again only when its mtime changes (`rows()` listed and stat-ed every expanded folder, several times per frame through `key_context`) and glob patterns parsed once as glob.ts `CACHE` does (`resource_editors` compiled a regex per custom editor selector per `key_context` call) 13.3 / 39.2, 22.8 / 54.0, 4.3 / 5.5, 14.6 / 16.1. The Studio is shared, so runs vary by about 30%. What is left, from `sample`: in the Explorer half the frame is taffy laying out the whole workbench tree, where a nested flex item is measured twice per level; in the Editor render is 60% of the frame, of which the minimap 20% (`minimap_runs` resolves each token's theme style on every frame, where vscode-textmate keeps it in the token's metadata) and `key_context` 16% (built in full by the menubar, the timeline toolbar three times, the editor title actions, the outline pane and the floating menu). The Extensions badge the layout gap names does not show in a sample of the harness. Cached part views (`AnyView::cached`) would skip render and layout of the parts a scroll does not touch, but in the vendored gpui a notify of a rendered entity invalidates that entity's view only and fires no observers, so a part view drawn from the Workbench's state would not redraw when that state changes: this needs the parts' state in their own entities or a gpui change.- Scroll frame costs, cheap steps (branch port-fix-settings-scroll, same harness): textmate `Theme::style` keeps a token's style per scope stack (the `Rc<ScopeStack>` address pinned by a `Weak`), the minimap parses the theme's color map once per image and highlights words only in its viewport (minimapRenderer `_getMinimapDecorationsInViewport`), the Extensions badge models only the installed non-built-in extensions (a built-in is never outdated nor counted for a restart) and the Explorer's `key_context` lists the rows only with a focused row. Median / p95 ms for Explorer, Editor, Extensions @builtin and Settings, two interleaved runs each, base 14f8ae4c49e then 42d10fe2347: 13.2 / 31.3 to 37.3 then 11.5 / 15.7; 22.6 / 30.2 to 46.5 then 18.0 to 18.3 / 19.2 to 42.0; 4.0 to 4.3 / 4.7 then 2.8 / 3.0; 14.2 to 14.3 / 16.1 to 36.7 then 12.4 to 12.7 / 16.8 to 17.0. Extensions meets the 8 ms gate. In the Explorer, `compute_layout` is now 68% of the frame: one call per frame over 395 taffy nodes, 6.6 ms, with 802 leaf computes (about two per leaf, so no nested re-measure blowup); the time is in taffy's `compute_flexbox_layout` itself and its allocations, so the next cut is fewer nodes per frame (cached part views, after the part-entity split), not fixed sizes.- Scroll frame costs, the Editor's slow start (branch port-fix-settings-scroll, same harness): the Editor's first 70 to 105 frames took 14 ms, the later ones 7, and waiting 3 s after the open removed it. An `xctrace` Time Profiler run over the editor test put half of those early frames in `key_context` > `explorer_context` > `FileTree::rows`, reading and sorting the 800-file root again (a `stat` per file, the ICU collator) on both `key_context` calls of each frame: `FileTree::entries` cached a folder only once its mtime was 2 s old (git's racy entries), and the fixture had just written it. A sub-second mtime now marks a fine-grained file system (APFS keeps nanoseconds), where 100 ms settles the folder; a whole-second mtime keeps the 2 s (cargo test -p app a_fine_grained_mtime_settles_after_100_ms). In a real window the same re-read ran on each `key_context` call for 2 s after any change to an expanded folder. Median / p95 ms, two interleaved runs, before then after: Editor 6.9 to 7.0 / 14.0 to 14.7 then 6.9 / 7.5 to 7.7; Explorer 3.0 to 3.2 / 7.2 to 7.3 then 2.9 / 3.2 to 3.6; Extensions 1.7 / 2.0 to 2.1 then 1.7 / 1.9 to 2.0; Settings 1.1 / 1.4 then 1.0 / 1.4. Every surface meets the 8 ms gate.+- Scroll frame costs in the GUI (branch port-fix-settings-scroll): the release app on the Studio host lane over the same folder, a scratch Swift CGEvent probe posting 30px continuous scroll events at about 100 Hz, and a scratch timer in `Window::draw`, give the frame times the headless harness gives; tracing `Context::notify` callers with `#[track_caller]` found who draws the Workbench. An inlay-hint answer called the Workbench's `cx.notify()`, so every part drew again on 78 of 87 scroll frames; with no provider registered a scroll still sent a request, whose answer came at once. The answer now notifies the editor view, and no provider means no request (inlayHintsController.ts:189). The overview ruler then took 80 to 120 ms a frame: with the cursor on `export`, a word on every line of the 20000, `word_highlight_ruler_lines` looked each of the 20000 highlights' kind up by a scan of the 20000 document highlights; one map per frame now. Editor in the GUI after both: median 10.5 / p95 11.8 ms (450 frames), its main thread in taffy `layout_as_root` 24%, `key_context` 14%, `editor_lines` 10%, the highlights map 9%. The Studio's accessibility client turns on "Screen Reader Optimized". On the lane `screencapture` fails ("could not create image from display"); `cua-driver call get_window_state` with `screenshot_out_file` works. A bare `wait` in a script that started the app in the background waits for the app.+- The Studio mirror of this branch had an `out-exthost` from Nov 23 that `port/tools/build-exthost` had not inlined (its `BUILD_INSERT_PRODUCT_CONFIGURATION` markers still there), so the extension host asked for `../product.json` and failed to start; `bun port/tools/build-exthost` in the mirror fixed it. The bundle is not affected: build-exthost inlines the product and package-app writes `product.json` into the app.## GUI lanes (Studio)