Visual Studio Code, rebuilt in Rust
Rust
fix(statusbar): keep hover styles while typing under a still pointer
rokartur65696abd52a1
diff --git a/README.md b/README.mdindex 06d228e8c71..4b9f0eff3b6 100644--- a/README.md+++ b/README.md@@ -11,8 +11,8 @@ Coverage of VS Code 1.147.0, from [port/ledger.md](port/ledger.md) (584 rows). V```mermaidpie showData- "verified" : 414- "ported" : 16+ "verified" : 415+ "ported" : 15"removed" : 126"n/a" : 28```@@ -25,13 +25,13 @@ pie showData| MainThread* shape (Rust side) | 59 | 0 | 30 | 0 | `████████████████████ 100%` || workbench service | 58 | 7 | 23 | 7 | `██████████████████░░ 89%` || src/vs/editor/contrib | 54 | 0 | 2 | 1 | `████████████████████ 100%` |-| workbench part | 10 | 1 | 2 | 0 | `██████████████████░░ 91%` |+| workbench part | 11 | 0 | 2 | 0 | `████████████████████ 100%` || extension host seam | 7 | 0 | 0 | 0 | `████████████████████ 100%` || cross-cutting check | 5 | 0 | 0 | 0 | `████████████████████ 100%` || src/vs/editor | 1 | 1 | 1 | 1 | `██████████░░░░░░░░░░ 50%` || src/vs/base | 0 | 0 | 2 | 3 | `████████████████████ 100%` || port feature | 1 | 0 | 0 | 0 | `████████████████████ 100%` |-| **all** | **414** | **16** | **126** | **28** | `███████████████████░ 96%` |+| **all** | **415** | **15** | **126** | **28** | `███████████████████░ 97%` |<!-- coverage:end -->`removed` are parts left out by decision: AI features, Microsoft services, telemetry, remote and tunnels ([port/notes.md](port/notes.md)). `n/a` are upstream test infrastructure and the Electron process, IPC and DOM layers the native architecture replaces.diff --git a/native/crates/app/src/workbench/hover/tests.rs b/native/crates/app/src/workbench/hover/tests.rsindex 3dd709b1b9d..f32878fe8e6 100644--- a/native/crates/app/src/workbench/hover/tests.rs+++ b/native/crates/app/src/workbench/hover/tests.rs@@ -248,6 +248,12 @@ fn a_hovered_status_item_is_outlined_and_its_icons_take_the_hover_foreground(cx:let (outlined, icons) = painted(cx);assert!(outlined, "the hovered problems entry has the dashed outline");assert!(!icons.is_empty() && icons.iter().all(|color| *color == gpui::rgb(0xFF0000).into()), "{icons:?}");+ // CSS `:hover` follows only the pointer: typing with the pointer still keeps the whole hover.+ cx.simulate_keystrokes("a");+ cx.run_until_parked();+ let (outlined, icons) = painted(cx);+ assert!(outlined, "a key press keeps the outline");+ assert!(!icons.is_empty() && icons.iter().all(|color| *color == gpui::rgb(0xFF0000).into()), "a key press keeps the icons' hover color: {icons:?}");}#[gpui::test]diff --git a/native/vendor/wu/crates/gpui/src/window.rs b/native/vendor/wu/crates/gpui/src/window.rsindex 062424b7d85..ff025371300 100644--- a/native/vendor/wu/crates/gpui/src/window.rs+++ b/native/vendor/wu/crates/gpui/src/window.rs@@ -767,8 +767,8 @@ impl HitboxId {}impl HitboxId {- /// Checks if the hitbox with this ID is currently hovered. Returns `false` during keyboard- /// input modality so that keyboard navigation suppresses hover highlights. Except when handling+ /// Checks if the hitbox with this ID is currently hovered, also during keyboard input modality+ /// (VSRustium: CSS `:hover` follows only the pointer). Except when handling/// `ScrollWheelEvent`, this is typically what you want when determining whether to handle mouse/// events or paint hover styles.///@@ -778,9 +778,6 @@ impl HitboxId {if window.captured_hitbox == Some(self) {return true;}- if window.last_input_was_keyboard() {- return false;- }self.hit_test(window)}@@ -878,15 +875,14 @@ pub struct Hitbox {}impl Hitbox {- /// Checks if the hitbox is currently hovered. Returns `false` during keyboard input modality- /// so that keyboard navigation suppresses hover highlights. Except when handling+ /// Checks if the hitbox is currently hovered. Like CSS `:hover`, keyboard input does not+ /// suppress it (VSRustium: VS Code keeps hover styles while typing). Except when handling/// `ScrollWheelEvent`, this is typically what you want when determining whether to handle mouse/// events or paint hover styles.////// This can return `false` even when the hitbox contains the mouse, if a hitbox in front of/// this sets `HitboxBehavior::BlockMouse` (`InteractiveElement::occlude`) or- /// `HitboxBehavior::BlockMouseExceptScroll` (`InteractiveElement::block_mouse_except_scroll`),- /// or if the current input modality is keyboard (see [`Window::last_input_was_keyboard`]).+ /// `HitboxBehavior::BlockMouseExceptScroll` (`InteractiveElement::block_mouse_except_scroll`).////// Handling of `ScrollWheelEvent` should typically use `should_handle_scroll` instead./// Concretely, this is due to use-cases like overlays that cause the elements under to bediff --git a/port/ledger.md b/port/ledger.mdindex ab45aae922d..ee785530113 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -360,7 +360,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/parts/partGrid | workbench part | M11 | verified | | workbench/layout.rs grid on split_view.rs (splitview.ts priorities, snap, visibility), workbench/part_grid.rs sashes, hidden parts, sizes and visibility in LayoutStateModel storage keys: cargo test -p app layout part_grid split_view (reference geometry at 1024x768, Cmd+B for the next open, sash drag, snap); ui-pair grid steps, port/results/layout.md || workbench/parts/sessions | workbench part | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/parts/sidebar | workbench part | M11 | verified | | Explorer and Search; compact activity bar for top and bottom (side_bar.rs) with every container the activity bar shows: built-in, Testing, extensions' `viewsContainers.activitybar` from startup and after an install, and generated ones (cargo test -p app the_top_activity_bar_shows_contributed_containers; it showed the five built-in ones only until then), No Folder Opened welcome in an empty window (empty_view.rs); pixel-check (port/results/pixels.md, milestone 3): chevron and label edge pixels only; ui-pair port/results/layout.md; verified: every pair of port/results/windows.md (milestone 11 verification) and port/results/references-view.md |-| workbench/parts/statusbar | workbench part | M11 | ported | [3 S] status_entries.rs status_item_hover: the pointer resting on the problems entry while a new untitled editor opens and takes typing leaves its numbers in the hover foreground but its icons and outline unhovered, the reference keeps the whole hover (seen in a ui-pair run of port/fixtures/ui-pair/statusbar-hover.json with Cmd+N and typing after the `problems` step) | an extension entry's `$(icon)`s and progress spinner in its kind's hover foreground, an entry with its own `color` keeping it on hover (statusbarItem.ts `applyColor`; cargo test -p app a_hovered_extension_entry_s_icons_follow_its_label_color); ui-pair port/fixtures/ui-pair/statusbar-hover.json hc with `PORT_MESSAGES=status`, the messages extension and `statusBarItem.hoverForeground` #FF0000: the hovered plain, colored, bell and problems entries match the reference (dashed outline, red icons and text, the colored entry green; 223 to 403 differing pixels of 48000 at 3% fuzz); the language detection entry draws its icon with the same `status_item_icon`; no-folder and folder colors (problems, bell), no remote indicator (workbench/contrib/remote removed, port/notes.md; cargo test -p app the_status_bar_has_no_remote_indicator), a hovered label's HC dashed `contrastActiveBorder` outline and icons in `statusBarItem.hoverForeground` (a_hovered_status_item_is_outlined_and_its_icons_take_the_hover_foreground), editor items Ln/Col, indentation, encoding, EOL, language with tabular-nums at their shaped widths and their upstream hovers; each item runs its editorStatus.ts command (Go to Line, indentation, encoding, EOL and language pickers: cargo test -p app editor_status); extension entries in statusbarModel.ts order around problems and the editor items (status_entries.rs), and the `status.progress` window progress entry with its spinner; verified: ui-pair messages.json vs the reference (port/results/windows.md, milestone 11 verification): extension entries, warning background, window progress entry, bell |+| workbench/parts/statusbar | workbench part | M11 | verified | | a hovered entry keeps its outline and icon hover colors while keys are typed under the still pointer (cargo test -p app a_hovered_status_item_is_outlined_and_its_icons_take_the_hover_foreground; ui-pair with Cmd+N and typing after the `problems` step matches the reference); an extension entry's `$(icon)`s and progress spinner in its kind's hover foreground, an entry with its own `color` keeping it on hover (statusbarItem.ts `applyColor`; cargo test -p app a_hovered_extension_entry_s_icons_follow_its_label_color); ui-pair port/fixtures/ui-pair/statusbar-hover.json hc with `PORT_MESSAGES=status`, the messages extension and `statusBarItem.hoverForeground` #FF0000: the hovered plain, colored, bell and problems entries match the reference (dashed outline, red icons and text, the colored entry green; 223 to 403 differing pixels of 48000 at 3% fuzz); the language detection entry draws its icon with the same `status_item_icon`; no-folder and folder colors (problems, bell), no remote indicator (workbench/contrib/remote removed, port/notes.md; cargo test -p app the_status_bar_has_no_remote_indicator), a hovered label's HC dashed `contrastActiveBorder` outline and icons in `statusBarItem.hoverForeground` (a_hovered_status_item_is_outlined_and_its_icons_take_the_hover_foreground), editor items Ln/Col, indentation, encoding, EOL, language with tabular-nums at their shaped widths and their upstream hovers; each item runs its editorStatus.ts command (Go to Line, indentation, encoding, EOL and language pickers: cargo test -p app editor_status); extension entries in statusbarModel.ts order around problems and the editor items (status_entries.rs), and the `status.progress` window progress entry with its spinner; verified: ui-pair messages.json vs the reference (port/results/windows.md, milestone 11 verification): extension entries, warning background, window progress entry, bell || workbench/parts/titlebar | workbench part | M9 | verified | | command center with the folder name, nav and layout actions (Customize Layout runs since port/results/manage-menu.md; with the activity bar on top or bottom the title bar's Manage gear opens MenuId.GlobalActivity below it, cargo test -p app manage_menu); a click on the command center opens Quick Open with the Go to File and Show and Run Commands help picks (port/results/command-center.md); drag region as `-webkit-app-region` (empty bar drags and double-click zooms, command center and layout controls no-drag; cargo test -p app title_bar, port/results/command-center.md); context menus of the bar, the title and the command center with the Command Center, Navigation Controls and Layout Controls toggles and the path items (cargo test -p app title_bar); pixel-check file and titlebar (port/results/pixels.md): blending rounding and glyph edges only; the inactive window: `titleBar.inactiveBackground`/`inactiveForeground`, `commandCenter.inactiveBorder`, contents at 0.6 opacity, `modernUI.inactiveShellBackground` (cargo test -p app theme::tests; ui-pair `new-window.json`, port/results/windows.md) || workbench/parts/views | workbench part | M11 | verified | | Explorer views as panes (view_panes.rs): collapse by mouse and keys, sashes, header drag to reorder with drop overlay, state in workbench.explorer.views.state; no view actions, view menus or hidden views; cargo test -p app view_panes, ui-pair port/results/layout.md; pane headers drawn statically (workbench.rs section_header): no collapse, resize or view actions; verified: ui-pair port/results/references-view.md and every pair of port/results/windows.md (milestone 11 verification): the Explorer panes and contributed views as the reference; Explorer and Source Control views as panes of a ViewPaneContainer (view_panes.rs `PaneContainer`): collapse by mouse and keys, sashes, header drag to reorder with drop overlay, single view merged into the container, header actions, state in the container's storageId; cargo test -p app view_panes scm_container, ui-pair port/results/layout.md and port/fixtures/ui-pair/m11/scm-panes.json (port/notes.md View panes); verified: ui-pair port/results/references-view.md and every pair of port/results/windows.md (milestone 11 verification): the Explorer panes and contributed views as the reference; Run and Debug, Extensions and webview containers still draw section_header rows: no collapse, resize or view actions; welcome buttons draw their `$(icon)`s (cargo test -p app a_welcome_button_draws_its_label_icons; ui-pair port/fixtures/ui-pair/icons/scm-welcome.json: github's Publish to GitHub button with the github codicon as the reference); wrapped text stacks unsnapped 18.2px lines as Chromium (vendor gpui elements/text.rs; cargo test -p app wrapped_lines_keep_their_fractional_line_height): scm-welcome's Publish button 0.5pt from the reference, was 2.5pt; left: the port wraps "Git" of "To learn more about how to use Git" to the next line; a merged view's "..." puts the Views submenu, a separator and the view's own actions (panecomposite.ts `getSecondaryActions`; cargo test -p app a_merged_changes_view_shows_the_views_submenu_in_its_more_actions a_merged_view_without_actions_lists_the_view_toggles_flat) || workbench/services/accessibility | workbench service | M19 | verified | | electron-browser accessibilityService.ts over GPUI: screen reader attach follows Electron's `isAccessibilitySupportEnabled` on macOS (VoiceOver, or an assistive app setting AXManualAccessibility or AXEnhancedUserInterface, as cua-driver does; ui-pair screen-reader-detection.json with accessibility support auto shows the prompt in both), the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib; electron-browser accessibilityService.ts over GPUI: screen reader attach follows is_a11y_active, the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib |diff --git a/port/notes.md b/port/notes.mdindex 9acd686167e..819be8e3acf 100644--- a/port/notes.md+++ b/port/notes.md@@ -586,7 +586,7 @@ Scope (roadmap section 13): diagnostics, hover, completion, go to definition and- Checks: `port/tools/ref-dom` reads geometry from the running reference over CDP (`dump:<selector>`); the `port/fixtures/extensions/messages` extension shows the same messages in both apps (`PORT_MESSAGES=error,info,long`).- Split view (`split_view.rs`, splitview.ts): views with minimum, maximum, snap, layout priority and visibility; proportional layout or priority layout (`proportionalLayout: false`), Alt sash drags, snapping past half a view's minimum, `resizeView`, `setViewVisible` with the cached visible size, `updateSashEnablement` for the sash cursors. Shared by the keybindings table and the part grid. Tests mirror splitview.test.ts.- Part grid (`workbench/layout.rs` model, `workbench/part_grid.rs` drawing and state; layout.ts): the floating layout's middle row of activity bar, side bar, editor column (editor over panel, panel centered) and secondary side bar, with the 4px card margins inside the part views as the reference's grid views have them. Sizes are `LayoutStateModel` keys in profile storage (`workbench.sideBar.size`, `workbench.panel.size`, `workbench.auxiliaryBar.size`, defaults from the window size), visibility in workspace storage (`workbench.sideBar.hidden`, default hidden in an empty window, `panel.hidden` and `auxiliaryBar.hidden` default hidden). Upstream saves sizes on shutdown; the port saves after each sash drag. The activity bar follows `workbench.activityBar.location` (`default` shows it; `top`, `bottom` and `hidden` hide its grid view as upstream). Sashes: 4px in the gap after their boundary, mac cursors of sash.css, `sash.hoverBorder` after the 300 ms hover delay and while dragged; double click does nothing (the workbench grid has no sash reset). Commands: Toggle Primary Side Bar (Cmd+B), Close Primary Side Bar, Move Activity Bar to Side, Hide Activity Bar; the active activity bar icon hides the side bar unless `workbench.activityBar.iconClickBehavior` is `focus`. Tests: `cargo test -p app layout part_grid split_view`; ui-pair in `port/results/layout.md`.-- A sash shown again under a still pointer after Cmd+B highlights on the next mouse move, where the reference highlights it at once: gpui reports no hover after keyboard input (`Hitbox::is_hovered`, `last_input_was_keyboard`).+- GPUI's keyboard hover suppression is removed in the vendored wu (`HitboxId::is_hovered` no longer returns false after a key press): CSS `:hover` follows only the pointer, and the suppression also split one element's hover, as a status bar entry under a still pointer kept the hover text color of its layout pass but lost its outline and icon colors once typing started (cargo test -p app a_hovered_status_item_is_outlined_and_its_icons_take_the_hover_foreground). It was also the cause given for a sash shown again under a still pointer after Cmd+B highlighting only on the next mouse move; not rechecked since.- Panel and secondary side bar (`workbench/panel.rs`; panelPart.ts, auxiliaryBarPart.ts, paneCompositePart.ts): cards with a 32px composite title (view tabs, Maximize/Restore and Close for the panel, Toggle Maximized and Hide for the secondary side bar) over the active view or "Drag a view here to display.". Views register with `register_panel_view(PanelView { id, title, render })`; the active one is `workbench.panelpart.activepanelid` (`workbench.auxiliarybar.activepanelid` in the secondary side bar) in workspace storage. Commands: Toggle Panel (Cmd+J), Close Panel, Toggle Maximized Panel (the editor column's editor view hidden), Toggle Secondary Side Bar (Alt+Cmd+B), Close Secondary Side Bar, Maximize/Restore/Toggle Maximized Secondary Side Bar (layout.ts `setAuxiliaryBarMaximized`: side bar, panel and editor hidden and brought back as they were, the bar back at `auxiliaryBar.lastNonMaximizedSize`; showing another part or hiding the bar leaves the state first). Context keys `panelVisible`, `panelMaximized`, `panelPosition`, `panelAlignment`, `auxiliaryBarVisible`, `auxiliaryBarMaximized`. A composite tab dragged onto the other part moves its container there (`moveViewContainerToLocation`, `views.customizations` in profile storage, only moved containers kept) and opens it; the panel falls back to Terminal. While a tab is over a part without an active view, its title and message take `editorGroup.dropBackground`; over a part with one there is no feedback (the composite bar's insertion markers and reordering are not ported), and the drag shows the tab's label as GPUI's drag preview where Chromium's OS drag image is not in a window capture. Filter views (Problems, Output, Comments) put their filter at the top of the view when it is narrower than 600px and taller than 100px (viewPane.ts `shouldShowFilterInHeader`), its badge hidden below 400px. Tabs take Chromium's fractional text widths: GPUI rounds a text element's width up, which made the Problems tab with its badge 2px wider. Not ported: moving side bar containers or single views (Move View), the title's actions-grow relayout is approximated (`tabs_that_fit`).- Side bar card and compact activity bar (`workbench/side_bar.rs`): with `workbench.activityBar.location` `top` or `bottom` the view containers are 36x32 tabs in the side bar's header or footer on the tab strip's background, and the Manage gear moves to the title bar (`workbench.action.activityBarLocation.top`/`.bottom`).- Empty window Explorer (`workbench/empty_view.rs`; emptyView.ts, explorerViewlet.ts): No Folder Opened expanded with "You have not yet opened a folder." and Open Folder, plus the `noFolderButEditorsHelp` line while editors are open. `workbench.action.files.openFolder` picks a folder and relaunches the binary with this window's flags and the folder, then quits (as upstream replaces the window). shortcut: with unsaved editors this window stays open (hot exit is item 5); the git extension's Clone Repository welcome item and `workbench.action.addRootFolder` are not ported.