Visual Studio Code, rebuilt in Rust
Rust
fix(suggest): follow the focused row's source for focus highlights
rokarturbc226e5215a8
diff --git a/native/crates/app/src/symbol_icons.rs b/native/crates/app/src/symbol_icons.rsindex ae2fae656ef..dded65c9134 100644--- a/native/crates/app/src/symbol_icons.rs+++ b/native/crates/app/src/symbol_icons.rs@@ -1,7 +1,7 @@//! symbolIcons.ts and symbolIcons.css: the codicon and color of each `CompletionItemKind` and `SymbolKind`, and//! the registry defaults of the suggest widget's colors (suggestWidget.ts).-use crate::theme::ColorValue::{self, Hex, Key, Transparent};+use crate::theme::ColorValue::{self, Hex, IfDefinedThenElse, Key, Transparent};/// `CompletionItemKinds.toIcon`: the codicon's SVG of a completion kind and the color key its CSS class takes.pub fn completion_kind_icon(kind: u64) -> (&'static str, Option<&'static str>) {@@ -170,6 +170,7 @@ pub(crate) fn color_default(key: &str) -> Option<[ColorValue; 4]> {const PURPLE: [ColorValue; 4] = [Hex("#B180D7"), Hex("#652D90"), Hex("#B180D7"), Hex("#652D90")];const BLUE: [ColorValue; 4] = [Hex("#75BEFF"), Hex("#007ACC"), Hex("#75BEFF"), Hex("#007ACC")];const SUGGEST_FOREGROUND: ColorValue = Key("editorSuggestWidget.foreground");+ const FOCUS_HIGHLIGHT: ColorValue = IfDefinedThenElse("editorSuggestWidget.selectedBackground", &Key("list.focusHighlightForeground"), &Key("quickInputList.focusHighlightForeground"));let same = |value: ColorValue| Some([value, value, value, value]);match key {"symbolIcon.classForeground" | "symbolIcon.enumeratorForeground" | "symbolIcon.eventForeground" => Some(ORANGE),@@ -191,7 +192,7 @@ pub(crate) fn color_default(key: &str) -> Option<[ColorValue; 4]> {"editorSuggestWidget.selectedBackground" => Some([Key("quickInputList.focusBackground"), Key("quickInputList.focusBackground"), Key("editorSuggestWidget.foreground"), Key("editorSuggestWidget.foreground")]),"editorSuggestWidget.focusOutline" => same(Key("contrastActiveBorder")),"editorSuggestWidget.highlightForeground" => same(Key("list.highlightForeground")),- "editorSuggestWidget.focusHighlightForeground" => Some([Key("list.focusHighlightForeground"), Key("list.focusHighlightForeground"), Key("editorSuggestWidget.selectedForeground"), Key("editorSuggestWidget.selectedForeground")]),+ "editorSuggestWidget.focusHighlightForeground" => Some([FOCUS_HIGHLIGHT, FOCUS_HIGHLIGHT, Key("editorSuggestWidget.selectedForeground"), Key("editorSuggestWidget.selectedForeground")]),"editorSuggestWidgetStatus.foreground" => same(Transparent(&SUGGEST_FOREGROUND, 0.5)),"quickInputList.focusIconForeground" => same(Key("list.activeSelectionIconForeground")),// editorColors.ts, for snippetSession.css.diff --git a/native/crates/app/src/theme.rs b/native/crates/app/src/theme.rsindex 848dc1251c8..030f60a129f 100644--- a/native/crates/app/src/theme.rs+++ b/native/crates/app/src/theme.rs@@ -406,6 +406,7 @@ impl Theme {};Some(less_prominent(color, background, *factor, *transparency))}+ ColorValue::IfDefinedThenElse(key, then, otherwise) => self.evaluate(if self.defines(key) { then } else { otherwise }),}}}@@ -561,6 +562,8 @@ pub(crate) enum ColorValue {Opaque(&'static ColorValue, &'static ColorValue),/// The color, the background, the factor and the transparency.LessProminent(&'static ColorValue, &'static ColorValue, f32, f32),+ /// `ifDefinedThenElse`: the first color when the theme defines the key, else the second.+ IfDefinedThenElse(&'static str, &'static ColorValue, &'static ColorValue),}const MINIMAP_FIND_MATCH: ColorValue = ColorValue::Opacity(&ColorValue::Key("editorOverviewRuler.findMatchForeground"), 0.8);@@ -1392,7 +1395,6 @@ fn quick_input_default(key: &str) -> (ColorValue, ColorValue, ColorValue) {"editorSuggestWidget.selectedForeground" => (Key("quickInputList.focusForeground"), Key("quickInputList.focusForeground"), Key("editorSuggestWidget.background")),"editorSuggestWidget.selectedBackground" => (Key("quickInputList.focusBackground"), Key("quickInputList.focusBackground"), Key("editorSuggestWidget.foreground")),"editorSuggestWidget.highlightForeground" => (Key("list.highlightForeground"), Key("list.highlightForeground"), Key("list.highlightForeground")),- "editorSuggestWidget.focusHighlightForeground" => (Key("list.focusHighlightForeground"), Key("list.focusHighlightForeground"), Key("editorSuggestWidget.selectedForeground")),"editorSuggestWidgetStatus.foreground" => (SUGGEST_STATUS_FOREGROUND, SUGGEST_STATUS_FOREGROUND, SUGGEST_STATUS_FOREGROUND),_ => (None, None, None),}@@ -1511,7 +1513,6 @@ fn quick_input_default_hc_light(key: &str) -> ColorValue {"editorSuggestWidget.selectedForeground" => Key("editorSuggestWidget.background"),"editorSuggestWidget.selectedBackground" => Key("editorSuggestWidget.foreground"),"editorSuggestWidget.highlightForeground" => Key("list.highlightForeground"),- "editorSuggestWidget.focusHighlightForeground" => Key("editorSuggestWidget.selectedForeground"),"editorSuggestWidgetStatus.foreground" => SUGGEST_STATUS_FOREGROUND,"settings.focusedRowBorder" => Key("focusBorder"),"settings.checkboxBackground" => Key("checkbox.background"),@@ -1905,6 +1906,15 @@ mod tests {assert_eq!(resolve(json!({ "tab.border": "#ff0000", "tab.divider": "#00ff00" })), ["#00ff00ff", "#00ff00ff"]);}+ /// suggestWidgetColors.test.ts "focused match highlights follow the source of the focused row background".+ #[test]+ fn focused_match_highlights_follow_the_source_of_the_focused_row_background() {+ let mut theme = builtin_theme("Light Modern");+ assert_eq!(theme.color("editorSuggestWidget.focusHighlightForeground").map(hex).as_deref(), Some("#ffffffff"));+ theme.set_customizations(&json!({ "editorSuggestWidget.selectedBackground": "#00000025" }), &json!({}));+ assert_eq!(theme.color("editorSuggestWidget.focusHighlightForeground").map(hex).as_deref(), Some("#0066bfff"));+ }+/// modernTabColorCustomizations.ts `--modern-ui-editor-tab-custom-border`: `tab.border`, else/// `editorGroupHeader.tabsBorder`, only when the user customizes them.#[test]diff --git a/port/ledger.md b/port/ledger.mdindex bc41585e39c..9123cec6c56 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -112,7 +112,7 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,| M21 uplift | extension/* grammars | done | M7. New upstream grammar commits for cpp, csharp, dart, dotenv, go, java, latex, log, php, razor, rust and scss (1,265 lines of data) arrive with the reference's extensions; the colorize fixtures `test-80644_cpp`, `test_env` and `test_tex` change (712 lines). No port code: the test reads grammars, fixtures and results from the 1.148.0 tree. | `cargo test -p app syntax` on the 1.148.0 tree: 17 passed, `colorize_fixtures_match_the_reference` ok (2026-12-01) || M21 uplift | extension/theme-defaults | done | M7, 8 lines. Light 2026: `editorGroupHeader.connectedTabsBackground` #EAEAEA to #F0F0F3, `tab.divider` #CECECE, `activityBarTop.inactiveForeground` #606060. Light Modern: the quick pick's focused row is #005FB8 with #FFFFFF foreground, icon and highlight. | The themes are read from the 1.148.0 extension, no code: `cargo test -p app -- theme::` on the 1.148.0 tree, `light_modern_quick_pick_focus_is_distinct_from_idle_and_hovered_rows_with_readable_content` and `light_2026_connected_tabs_have_a_light_strip_visible_dividers_and_readable_labels` pass (both fail on 1.147.0's themes), `resolved_colors_match_the_reference_workbench_variables` against the 1.148.0 `ref-dom` dump; ui-pair not run (2026-12-01) || M21 uplift | workbench/services/themes | done | M7, 26 lines (`modernTabColorCustomizations.ts`, `tabDividerColor.ts`): modern tabs fall back to `editorGroupHeader.tabsBorder` for the tab border, and `tab.divider` follows a customized `tab.border` unless `tab.divider` is customized itself. `Theme::tab_divider` and `Theme::custom_tab_border` (theme.rs) paint the editor and panel tab dividers and the connected-tab border. | `cargo test -p app -- theme::` on the 1.148.0 tree: `light_2026_dividers_follow_a_customized_tab_border_unless_tab_divider_is_customized` (the 3 cases) and `the_custom_tab_border_is_a_customized_tab_border_then_tabs_border` pass; full `cargo gc test -p app` 3709 passed (2026-12-01) |-| M21 uplift | editor/contrib/suggest | later | M13, 6 lines (`suggestWidget.ts`): the default of `editorSuggestWidget.focusHighlightForeground` becomes `quickInputList.focusHighlightForeground`; when the theme sets `editorSuggestWidget.selectedBackground` it is `list.focusHighlightForeground` (`ifDefinedThenElse`). | `cargo test -p app theme` color defaults |+| M21 uplift | editor/contrib/suggest | done | M13, 6 lines (`suggestWidget.ts`): the default of `editorSuggestWidget.focusHighlightForeground` becomes `quickInputList.focusHighlightForeground`; when the theme sets `editorSuggestWidget.selectedBackground` it is `list.focusHighlightForeground` (`ifDefinedThenElse`, the new `ColorValue::IfDefinedThenElse` in theme.rs). | `cargo test -p app -- theme::` on the 1.148.0 tree: `focused_match_highlights_follow_the_source_of_the_focused_row_background` (suggestWidgetColors.test.ts) passes, and `resolved_colors_match_the_reference_workbench_variables`, which failed on Light Modern `editorSuggestWidget.focusHighlightForeground` (port #0066bf, reference #ffffff) before the fix, passes; full `cargo gc test -p app` 3709 passed (2026-12-01) || M21 uplift | editor/browser and editor/contrib/folding | later | M8, 71 lines (`mouseHandler`, `mouseTarget`, `view`, `viewLine`, `folding.css`): a click in the empty gutter places the caret; a click in the line-decorations lane with no decoration goes to the line start; only the 0.625em folding chevron toggles; with `editor.mouseStyle: text` the I-beam shows over the empty gutter; a click right of an empty line gives column 1; an empty line with injected text on both sides puts the caret before the after-decoration. | `cargo test -p app editor::view` mouse-target cases; ui-pair of the gutter hover || M21 uplift | editor/common | later | M8, 24 lines (`editorOptions`, `defaultDocumentColorsComputer`): `tabFocusMode` is computed from the global Ctrl+M toggle, so `editorTabMovesFocus` follows it; hex colors count only before whitespace, a quote, `;`, `,`, `)` or the end of the line. | `cargo test -p app tab_focus document_colors` || M21 uplift | editor/contrib/contextmenu | later | M8, 6 lines: a right click on injected text (inlay hints, ghost text) opens no menu and keeps the selection. | `cargo test -p app editor_menus` |