Visual Studio Code, rebuilt in Rust
Rust
fix(quickInput): a hovered row index past a list narrowed by typing no longer panics
rokartur1398eed800c9
diff --git a/README.md b/README.mdindex 90d08d63c09..e188c0b0f3e 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) (587 rows). V```mermaidpie showData- "verified" : 413- "ported" : 20+ "verified" : 414+ "ported" : 19"removed" : 126"n/a" : 28```@@ -20,7 +20,7 @@ pie showData| area | verified | ported | removed | n/a | verified of in scope ||---|---:|---:|---:|---:|---|| workbench contribution | 61 | 9 | 30 | 3 | `█████████████████░░░ 87%` |-| src/vs/platform | 68 | 1 | 30 | 13 | `████████████████████ 99%` |+| src/vs/platform | 69 | 0 | 30 | 13 | `████████████████████ 100%` || built-in extension | 88 | 1 | 6 | 0 | `████████████████████ 99%` || MainThread* shape (Rust side) | 59 | 0 | 30 | 0 | `████████████████████ 100%` || workbench service | 63 | 2 | 23 | 7 | `███████████████████░ 97%` |@@ -31,7 +31,7 @@ pie showData| src/vs/editor | 0 | 2 | 1 | 1 | `░░░░░░░░░░░░░░░░░░░░ 0%` || src/vs/base | 0 | 0 | 2 | 3 | `████████████████████ 100%` || port feature | 1 | 0 | 0 | 0 | `████████████████████ 100%` |-| **all** | **413** | **20** | **126** | **28** | `███████████████████░ 95%` |+| **all** | **414** | **19** | **126** | **28** | `███████████████████░ 96%` |<!-- 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/quick_input_view.rs b/native/crates/app/src/workbench/quick_input_view.rsindex e9d5bd9b902..127eef25df4 100644--- a/native/crates/app/src/workbench/quick_input_view.rs+++ b/native/crates/app/src/workbench/quick_input_view.rs@@ -943,7 +943,7 @@ impl Workbench {};let header = row.header.clone();// quickInputList.ts `focusInsideSeparator`: the separator's buttons also show while an item of its section is active or under the pointer.- let focus_inside = [input.focused, self.quick_inputs.hovered].into_iter().flatten().any(|other| input.rows[other].section == row.section);+ let focus_inside = [input.focused, self.quick_inputs.hovered].into_iter().flatten().any(|other| input.rows.get(other).is_some_and(|other| other.section == row.section));let row_element = div().id(("quick-input-row", row_index)).relative()diff --git a/native/crates/app/src/workbench/quick_input_view/tests.rs b/native/crates/app/src/workbench/quick_input_view/tests.rsindex 046fe029327..b4a5a726d88 100644--- a/native/crates/app/src/workbench/quick_input_view/tests.rs+++ b/native/crates/app/src/workbench/quick_input_view/tests.rs@@ -287,6 +287,31 @@ fn a_separator_s_buttons_show_while_an_item_of_its_section_is_active(cx: &mut Teassert!(cx.debug_bounds("quick-input-header-button").is_some(), "an item of the separator's section is active");}+/// A row hovered before the user types keeps its index while the list narrows under the pointer.+#[gpui::test]+fn a_hovered_row_index_past_a_narrowed_list_draws(cx: &mut TestAppContext) {+ use crate::main_thread_quick_open::Owner;+ use crate::quick_input::{Entry, Item, Kind, QuickInput};++ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();+ let theme = load_theme(&[themes], "Dark Modern").unwrap();+ let (workbench, cx) = cx.add_window_view(|_, cx| Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx));+ let item = |handle: i64| Entry::Item(Item { handle, label: format!("item {handle}"), pickable: true, ..Item::default() });+ workbench.update_in(cx, |workbench, window, cx| {+ let id = workbench.quick_inputs.add(QuickInput::new(0, Kind::QuickPick), Owner::Session(1));+ workbench.show_quick_input(id, window, cx);+ workbench.quick_inputs.get_mut(id).unwrap().set_items((0..8).map(item).collect());+ workbench.quick_inputs.hovered = Some(7);+ let input = workbench.quick_inputs.get_mut(id).unwrap();+ input.set_items(vec![item(0)]);+ input.focused = None;+ cx.notify();+ });+ cx.run_until_parked();+ assert!(cx.debug_bounds("quick-input-label").is_some(), "the narrowed list draws");+}+/// quickInputList.ts `showHover` and `QuickInputHoverDelegate`: an item's tooltip shows right of its row after the/// hover delay and stays while the user types; an item without one has its description's hover.#[gpui::test]diff --git a/port/ledger.md b/port/ledger.mdindex 6cf2cc423cd..e42c45eb987 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -252,7 +252,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| platform/profiling | src/vs/platform | M19 | n/a | | V8 inspector CPU profiles of the Electron renderer (windowProfiling.ts, rendererAutoProfiler.ts) and their analysis worker, which feeds only telemetry (profilingTelemetrySpec.ts); the workbench is a native process, profiled with Instruments, and no telemetry by decision; the extension host profile commands belong to workbench/contrib/extensions || platform/progress | src/vs/platform | M11 | verified | | ProgressLocation values and the step shape, in main_thread_progress.rs; verified: ui-pair messages.json `progress` vs the reference (port/results/windows.md, milestone 11 verification) || platform/protocol | src/vs/platform | | n/a | | Electron process, IPC or DOM layer; replaced by the single-process Rust/GPUI architecture (port/notes.md) |-| platform/quickinput | src/vs/platform | M9 | ported | [3 S] quick_input_view.rs:946: `input.rows[other]` panics (index out of bounds: the len is 4 but the index is 7) when a hovered or focused row index outlives a narrowed list, seen typing "compare active file with saved" into the command palette after a click | createQuickWidget as `Kind::Widget` (quick_input_view.rs: title, no input header, the icon picker as content) for its one workbench caller, iconPicker.ts `IconPicker` of Terminal: Change Icon: cargo test -p app the_icon_picker_search_is_a_bare_input_box a_quick_pick_shown_over_the_icon_picker_drops_its_content (quickinput.test.ts "custom content is exclusive to QuickWidget"); quickPickPin.ts pins match a terminal session command by its timestamp `id`, store label, description and detail, and stay for the session after the picker hides: cargo test -p app a_pinned_session_command_stays_pinned_until_the_session_ends; cargo test -p app quick_input, filters, tf_idf (`\p{Letter}` words: tf_idf::tests::words_follow_the_javascript_regex), command_palette: the model cases of quickinput.test.ts (pick, input, active and selected items, section navigation, keepScrollPosition, title bar visibility, close animation and reopening); api-tests quick input 11/11; ad-hoc palette screenshot 0.28% pixels differ at 2% fuzz; a row's description at the highlighted name's exact width (cargo test -p app the_description_follows_the_highlighted_name_s_exact_width; Cmd+P `ts` pair: `src` within 0.3 device px of the reference); a separator's buttons show while an item of its section is active (a_separator_s_buttons_show_while_an_item_of_its_section_is_active); an item's tooltip is its hover, 6px wider from the list's padding, kept on key down and hidden on a value change (an_item_s_tooltip_is_its_row_s_hover_until_the_value_changes; port/fixtures/ui-pair/quick-input-item-hover.json: the command palette hover falls back below the row as the reference's) |+| platform/quickinput | src/vs/platform | M9 | verified | | createQuickWidget as `Kind::Widget` (quick_input_view.rs: title, no input header, the icon picker as content) for its one workbench caller, iconPicker.ts `IconPicker` of Terminal: Change Icon: cargo test -p app the_icon_picker_search_is_a_bare_input_box a_quick_pick_shown_over_the_icon_picker_drops_its_content (quickinput.test.ts "custom content is exclusive to QuickWidget"); quickPickPin.ts pins match a terminal session command by its timestamp `id`, store label, description and detail, and stay for the session after the picker hides: cargo test -p app a_pinned_session_command_stays_pinned_until_the_session_ends; cargo test -p app quick_input, filters, tf_idf (`\p{Letter}` words: tf_idf::tests::words_follow_the_javascript_regex), command_palette: the model cases of quickinput.test.ts (pick, input, active and selected items, section navigation, keepScrollPosition, title bar visibility, close animation and reopening); api-tests quick input 11/11; ad-hoc palette screenshot 0.28% pixels differ at 2% fuzz; a row's description at the highlighted name's exact width (cargo test -p app the_description_follows_the_highlighted_name_s_exact_width; Cmd+P `ts` pair: `src` within 0.3 device px of the reference); a separator's buttons show while an item of its section is active (a_separator_s_buttons_show_while_an_item_of_its_section_is_active); an item's tooltip is its hover, 6px wider from the list's padding, kept on key down and hidden on a value change (an_item_s_tooltip_is_its_row_s_hover_until_the_value_changes; port/fixtures/ui-pair/quick-input-item-hover.json: the command palette hover falls back below the row as the reference's); a hovered row index past a list narrowed by typing draws instead of panicking (a_hovered_row_index_past_a_narrowed_list_draws) || platform/registry | src/vs/platform | M9 | n/a | | Registry.add/as, a string-keyed registry of registries for the JS module graph; the port passes its typed registries directly (config::registry::Registry, Commands, the menus and keybindings modules), so there is no lookup by id to port || platform/remote | src/vs/platform | | removed | | no remote or tunnels by decision (port/notes.md); one local extension host || platform/remoteTunnel | src/vs/platform | | removed | | no sign-in/AI by decision (port/notes.md); not ported |