Visual Studio Code, rebuilt in Rust
Rust
feat(theme): let a customized tab border drive the modern tab dividers
rokartur9221a3c2355e
diff --git a/native/crates/app/src/theme.rs b/native/crates/app/src/theme.rsindex 9d576653f23..848dc1251c8 100644--- a/native/crates/app/src/theme.rs+++ b/native/crates/app/src/theme.rs@@ -290,6 +290,26 @@ impl Theme {}}+ /// `--vscode-tab-divider` under Modern UI (modernTabColorCustomizations.ts, tabDividerColor.ts): a customized+ /// `tab.border` wins over a theme's `tab.divider` unless `tab.divider` is customized too.+ pub fn tab_divider(&self) -> Option<Rgba> {+ match self.customizes("tab.border") && !self.customizes("tab.divider") {+ true => self.color("tab.border"),+ false => self.color("tab.divider"),+ }+ }++ /// `--modern-ui-editor-tab-custom-border` (modernTabColorCustomizations.ts): a customized `tab.border`, else a+ /// customized `editorGroupHeader.tabsBorder`.+ pub fn custom_tab_border(&self) -> Option<Rgba> {+ ["tab.border", "editorGroupHeader.tabsBorder"].into_iter().find(|key| self.customizes(key)).and_then(|key| self.color(key))+ }++ /// `ColorThemeData.getColorCustomization`: the user's settings set the color.+ fn customizes(&self, key: &str) -> bool {+ matches!(self.custom_colors.get(key), Some(Some(_)))+ }+/// `ColorThemeData.setCustomColors` and `setCustomTokenColors`: the settings' values, then those of every/// `[theme id]` block matching this theme, with the token rules appended after the theme's own.pub fn set_customizations(&mut self, colors: &Value, token_colors: &Value) {@@ -1871,4 +1891,29 @@ mod tests {assert_eq!(theme.color("editorGroupHeader.connectedTabsBackground").map(hex).as_deref(), Some("#123456ff"));assert_eq!(theme.color("tab.divider").map(hex).as_deref(), Some("#abcdefff"));}++ /// defaultThemeColors.test.ts "Light 2026 dividers follow a customized tab.border unless tab.divider is customized".+ #[test]+ fn light_2026_dividers_follow_a_customized_tab_border_unless_tab_divider_is_customized() {+ let mut theme = builtin_theme("Light 2026");+ let mut resolve = |colors: Value| {+ theme.set_customizations(&colors, &json!({}));+ [theme.tab_divider(), theme.color("tab.divider")].map(|color| hex(color.unwrap()))+ };+ assert_eq!(resolve(json!({})), ["#cececeff", "#cececeff"]);+ assert_eq!(resolve(json!({ "tab.border": "#ff0000" })), ["#ff0000ff", "#cececeff"]);+ assert_eq!(resolve(json!({ "tab.border": "#ff0000", "tab.divider": "#00ff00" })), ["#00ff00ff", "#00ff00ff"]);+ }++ /// modernTabColorCustomizations.ts `--modern-ui-editor-tab-custom-border`: `tab.border`, else+ /// `editorGroupHeader.tabsBorder`, only when the user customizes them.+ #[test]+ fn the_custom_tab_border_is_a_customized_tab_border_then_tabs_border() {+ let mut theme = builtin_theme("Light 2026");+ assert_eq!(theme.custom_tab_border(), None);+ theme.set_customizations(&json!({ "editorGroupHeader.tabsBorder": "#123456" }), &json!({}));+ assert_eq!(theme.custom_tab_border().map(hex).as_deref(), Some("#123456ff"));+ theme.set_customizations(&json!({ "editorGroupHeader.tabsBorder": "#123456", "tab.border": "#654321" }), &json!({}));+ assert_eq!(theme.custom_tab_border().map(hex).as_deref(), Some("#654321ff"));+ }}diff --git a/native/crates/app/src/workbench/editor_view.rs b/native/crates/app/src/workbench/editor_view.rsindex 32260c8e273..74673d8a275 100644--- a/native/crates/app/src/workbench/editor_view.rs+++ b/native/crates/app/src/workbench/editor_view.rs@@ -498,14 +498,17 @@ impl Workbench {self.theme.color("editorGroupHeader.tabsBackground").map_or(editor, |tabs| crate::theme::make_opaque(tabs, editor))}- /// `--modern-ui-connected-tab-border`: the header's tabs border; in high contrast the focus border of the active group.+ /// `--modern-ui-connected-tab-border`: a customized tab border, else the header's tabs border; in high contrast the+ /// focus border of the active group.fn connected_tab_border(&self) -> Rgba {match self.theme.kind {ThemeKind::HighContrastDark | ThemeKind::HighContrastLight => self.color("focusBorder"),- _ => ["editorGroupHeader.tabsBorder", "tab.border", "editor.background"]- .into_iter()- .find_map(|key| self.theme.color(key))- .expect("editor.background has a registry default"),+ _ => self.theme.custom_tab_border().unwrap_or_else(|| {+ ["editorGroupHeader.tabsBorder", "tab.border", "editor.background"]+ .into_iter()+ .find_map(|key| self.theme.color(key))+ .expect("editor.background has a registry default")+ }),}}@@ -903,7 +906,7 @@ impl Workbench {}fn tab_divider(&self) -> Div {- div().absolute().left_0().top(gpui::relative(0.5)).mt(px(-8.)).w(px(1.)).h(px(16.)).bg(self.color("tab.divider"))+ div().absolute().left_0().top(gpui::relative(0.5)).mt(px(-8.)).w(px(1.)).h(px(16.)).bg(self.theme.tab_divider().unwrap_or(gpui::transparent_black().into()))}pub(super) fn document_icon(&self, editor: &OpenEditor, line_height: f32, foreground: Rgba) -> Option<Div> {diff --git a/native/crates/app/src/workbench/panel.rs b/native/crates/app/src/workbench/panel.rsindex b39e9f91f6e..1589c4c0c03 100644--- a/native/crates/app/src/workbench/panel.rs+++ b/native/crates/app/src/workbench/panel.rs@@ -640,7 +640,7 @@ impl Workbench {.when(active, |tab| tab.child(self.connected_pane_tab_fill(first, false, background))).when(!active, |tab| tab.hover(|tab| tab.text_color(self.foreground_or("modernTab.hoverForeground"))).child(self.inactive_pane_tab_hover(&hover_group, false)).group(hover_group.clone()))// connectedPaneTabs.css `.tab-divider`: 1x16px between two inactive tabs, transparent without `tab.divider`.- .when_some(self.theme.color("tab.divider").filter(|_| divider), |tab, color| {+ .when_some(self.theme.tab_divider().filter(|_| divider), |tab, color| {tab.child(div().debug_selector(|| "panel-tab-divider".into()).absolute().left_0().top(px((TITLE_HEIGHT - 16.) / 2.)).w(px(1.)).h(px(16.)).bg(color))}).child(div().flex_none().w(px(text_width(&label, 13., window))).whitespace_nowrap().line_height(px(24.)).child(label))diff --git a/port/ledger.md b/port/ledger.mdindex cfa0df2db3f..bc41585e39c 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -111,7 +111,7 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,| M21 uplift | setup: diff recount | done | Run `bun port/tools/uplift-diff.ts 1.148.0 1.147.0` on the split tree and compare its group counts with section 1 of `port/plans/uplift-1.147.0-to-1.148.0.md`. Same as the plan but for the new `removed` row `mainthread/MainThreadRemoteAgentHosts` (36 lines), which moves from "new upstream unit" to "removed by decision". | to port 79 rows (10,606 lines), new unit 1 (21, `mainthread/MainThreadGitExtensionService`), removed by decision 32 (78,874), tests only 8, API typings 5, not mapped 29 folders (2026-12-01) || 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 | later | 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. | `cargo test -p app theme` with the 3 cases of the new test |+| 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/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` |