Skip to content

Visual Studio Code, rebuilt in Rust

Rust

feat(modern-ui): port the remaining 1.147.0 modern UI styles (#7)

Artur Rok4caa27a59046
diff --git a/native/crates/app/src/theme.rs b/native/crates/app/src/theme.rs
index 97defbdc7d6..d303611f818 100644
--- a/native/crates/app/src/theme.rs
+++ b/native/crates/app/src/theme.rs
@@ -436,6 +436,12 @@ fn less_prominent(color: Rgba, background: Rgba, factor: f32, transparency: f32)
from_hsla(h, s, l, round3(a * transparency as f64))
}
+/// CSS `color-mix(in srgb, color amount, background)`.
+pub(crate) fn color_mix(color: Rgba, amount: f32, background: Rgba) -> Rgba {
+ let mix = |c: f32, b: f32| c * amount + b * (1. - amount);
+ Rgba { r: mix(color.r, background.r), g: mix(color.g, background.g), b: mix(color.b, background.b), a: mix(color.a, background.a) }
+}
+
/// `Color.makeOpaque`: RGBA's `_clampUint8` truncates each blended byte (`| 0`). The alpha is RGBA's, rounded to 3
/// decimals; the math is JS doubles.
fn make_opaque(color: Rgba, background: Rgba) -> Rgba {
@@ -652,6 +658,9 @@ fn registry_default(key: &str, kind: ThemeKind) -> ColorValue {
"modernPanel.border" => (Key("surface.border"), Key("surface.border"), Key("surface.border")),
"editor.border" => (Key("surface.border"), Key("surface.border"), Key("surface.border")),
"modernActivityBarItem.activeForeground" => (Key("modernTab.activeForeground"), Key("modernTab.activeForeground"), Key("modernTab.activeForeground")),
+ "modernEditorTab.hoverForeground" => (Key("modernTab.hoverForeground"), Key("modernTab.hoverForeground"), Key("modernTab.hoverForeground")),
+ "modernActivityBarItem.hoverBackground" => (Key("modernTab.hoverBackground"), Key("modernTab.hoverBackground"), Key("modernTab.hoverBackground")),
+ "modernActivityBarItem.hoverForeground" => (Key("modernTab.hoverForeground"), Key("modernTab.hoverForeground"), Key("modernTab.hoverForeground")),
"editor.foreground" => (Hex("#BBBBBB"), Hex("#333333"), Hex("#FFFFFF")),
"editorLineNumber.foreground" => (Hex("#858585"), Hex("#237893"), Hex("#FFFFFF")),
"editorActiveLineNumber.foreground" => (Hex("#c6c6c6"), Hex("#0B216F"), Key("contrastActiveBorder")),
@@ -764,6 +773,7 @@ fn registry_default(key: &str, kind: ThemeKind) -> ColorValue {
Key("editorGroupHeader.tabsBackground"),
),
"tab.border" => (Hex("#252526"), Hex("#F3F3F3"), Key("contrastBorder")),
+ "tab.divider" => (Key("tab.border"), Key("tab.border"), Key("tab.border")),
"tab.activeForeground" => (Hex("#FFFFFF"), Hex("#333333"), Hex("#FFFFFF")),
"tab.inactiveForeground" => (Transparent(&Key("tab.activeForeground"), 0.5), Transparent(&Key("tab.activeForeground"), 0.7), Hex("#FFFFFF")),
"editorBracketMatch.background" => (Hex("#0064001A"), Hex("#0064001A"), Hex("#0064001A")),
@@ -1077,6 +1087,9 @@ fn hc_light_default(key: &str) -> ColorValue {
"modernPanel.border" => Key("surface.border"),
"editor.border" => Key("surface.border"),
"modernActivityBarItem.activeForeground" => Key("modernTab.activeForeground"),
+ "modernEditorTab.hoverForeground" => Key("modernTab.hoverForeground"),
+ "modernActivityBarItem.hoverBackground" => Key("modernTab.hoverBackground"),
+ "modernActivityBarItem.hoverForeground" => Key("modernTab.hoverForeground"),
"editor.foreground" => Key("foreground"),
"editorLineNumber.foreground" => Hex("#292929"),
"editorActiveLineNumber.foreground" => Key("contrastActiveBorder"),
@@ -1113,6 +1126,7 @@ fn hc_light_default(key: &str) -> ColorValue {
"breadcrumb.focusForeground" | "breadcrumb.activeSelectionForeground" => Lighten(&Key("foreground"), 0.1),
"breadcrumbPicker.background" => Key("editorWidget.background"),
"tab.border" => Key("contrastBorder"),
+ "tab.divider" => Key("tab.border"),
"tab.activeForeground" | "tab.inactiveForeground" => Hex("#292929"),
"textLink.foreground" => Hex("#0F4A85"),
"textLink.activeForeground" => Hex("#0F4A85"),
@@ -1544,6 +1558,23 @@ mod tests {
load_theme(&[scan_extension(&folder, true).unwrap()], id).unwrap()
}
+ /// The reference's hovered inactive tab under Dark Modern: `color(srgb 0.20651 ...)`, foreground 6% over #2B2B2B.
+ #[test]
+ fn color_mix_matches_the_reference_tab_hover_fill() {
+ let mixed = color_mix(parse_hex("#CCCCCC").unwrap(), 0.06, parse_hex("#2B2B2B").unwrap());
+ assert!((mixed.r - 0.20651).abs() < 0.0001, "{mixed:?}");
+ assert_eq!(mixed.a, 1.);
+ }
+
+ #[test]
+ fn activity_bar_hover_colors_fall_back_to_modern_tab_ones() {
+ let theme = builtin_theme("Default High Contrast");
+ assert!(theme.color("modernTab.hoverBackground").is_some());
+ assert_eq!(theme.color("modernActivityBarItem.hoverBackground"), theme.color("modernTab.hoverBackground"));
+ assert_eq!(theme.color("modernActivityBarItem.hoverForeground"), theme.color("modernTab.hoverForeground"));
+ assert_eq!(theme.color("modernEditorTab.hoverForeground"), theme.color("modernTab.hoverForeground"));
+ }
+
/// colorThemeData.ts `_loadSyntaxTokens`: a JSON theme's `tokenColors` path and a theme that is a .tmTheme file.
#[test]
fn tm_theme_settings_give_token_rules_and_editor_colors() {
diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rs
index 84748a0073f..1901c4b26e0 100644
--- a/native/crates/app/src/workbench.rs
+++ b/native/crates/app/src/workbench.rs
@@ -309,6 +309,7 @@ use crate::theme::{ColorThemeEntry, Theme, ThemeKind};
const COMMAND_CENTER: &str = "title-command-center";
/// titlebarPart.ts `actionToolBar`: the editor, layout and global actions.
const TITLE_ACTIONS: &str = "title-actions";
+const ACTIVITY_ITEM_GROUP: &str = "activity-item";
const TITLE_BAR_TOOLBARS: [&str; 3] = [COMMAND_CENTER, update_title_bar::TOOLBAR, TITLE_ACTIONS];
pub struct Workbench {
@@ -1292,9 +1293,10 @@ impl Workbench {
}
/// The command center's Go Back and Go Forward (`MenuId.CommandCenter` orders 1 and 2): enabled by their
- /// `canNavigateBack`/`canNavigateForward` precondition, pointer only then (actionbar.css `.disabled`).
- fn navigation_button(&self, icon: &'static str, title: &'static str, command: &'static str, enabled: bool, foreground: Rgba, disabled: Rgba, cx: &mut Context<Self>) -> Stateful<Div> {
- self.icon(icon, 22., 16., if enabled { foreground } else { disabled })
+ /// `canNavigateBack`/`canNavigateForward` precondition, pointer only then (actionbar.css `.disabled`). modernUI
+ /// commandCenter.css keeps both states in `commandCenter.foreground`.
+ fn navigation_button(&self, icon: &'static str, title: &'static str, command: &'static str, enabled: bool, cx: &mut Context<Self>) -> Stateful<Div> {
+ self.icon(icon, 22., 16., self.color("commandCenter.foreground"))
.id(command)
.rounded(px(4.))
.when(enabled, |button| {
@@ -1331,7 +1333,6 @@ impl Workbench {
let opacity = if active { 1. } else { 0.6 };
let command_center_visible = !compact && self.setting("window.commandCenter") != Value::Bool(false);
let layout_control_enabled = self.setting("workbench.layoutControl.enabled") != Value::Bool(false);
- // Disabled codicon actions take disabledForeground (actionbar.css .disabled .action-label:not(.icon)).
let disabled = self.color("disabledForeground");
let command_center = div()
.id("command-center-center")
@@ -1383,8 +1384,8 @@ impl Workbench {
true => {
let mut items = Vec::new();
if contextkey::truthy(Some(&self.setting("workbench.navigationControl.enabled"))) {
- let back = self.navigation_button("arrow-left", "Go Back", "workbench.action.navigateBack", self.can_navigate(true), foreground, disabled, cx);
- let forward = self.navigation_button("arrow-right", "Go Forward", "workbench.action.navigateForward", self.can_navigate(false), foreground, disabled, cx).ml(px(4.)).mr(px(10.));
+ let back = self.navigation_button("arrow-left", "Go Back", "workbench.action.navigateBack", self.can_navigate(true), cx);
+ let forward = self.navigation_button("arrow-right", "Go Forward", "workbench.action.navigateForward", self.can_navigate(false), cx).ml(px(4.)).mr(px(10.));
items.push(title_item(command_center_bar, "back", back, cx));
items.push(title_item(command_center_bar, "forward", forward, cx));
}
@@ -1596,7 +1597,7 @@ impl Workbench {
let mut items: Vec<_> = containers.map(|(icon, _, title, command, view)| {
let active = view.is_some_and(|view| self.side_bar_view == view) && self.side_bar_visible();
let drag_icon = self.codicon_svg(icon);
- let icon = if active { self.active_view_icon(icon) } else { self.icon(icon, 36., 24., inactive) };
+ let icon = if active { self.active_view_icon(icon) } else { self.inactive_view_icon(icon, inactive) };
let item = self.activity_composite_item(self.action_bar_item("activity", command, icon.id(command), cx), "activity", command, title, drag_icon, active, cx)
.debug_selector(move || command.to_owned())
.cursor_pointer()
@@ -1696,7 +1697,7 @@ impl Workbench {
return None;
}
let active = self.side_bar_view == SideBarView::Testing && self.side_bar_visible();
- let icon = if active { self.active_view_icon("beaker") } else { self.icon("beaker", 36., 24., inactive) };
+ let icon = if active { self.active_view_icon("beaker") } else { self.inactive_view_icon("beaker", inactive) };
let command = "workbench.view.testing";
Some(self.activity_composite_item(self.action_bar_item("activity", command, icon.id(command), cx), "activity", command, "Testing", self.codicon_svg("beaker"), active, cx).debug_selector(move || command.to_owned()).cursor_pointer().child(self.action_hover("Testing", command, hover)).on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| workbench.activity_item_clicked(active, command, event, window, cx))))
}
@@ -1713,6 +1714,16 @@ impl Workbench {
div().relative().child(indicator).child(self.icon(name, 36., 24., self.color("modernActivityBarItem.activeForeground")))
}
+ /// modernUI activityBar.css `.action-item:not(.checked):hover`: the same 32px indicator in
+ /// modernActivityBarItem.hoverBackground, and the icon in hoverForeground.
+ fn inactive_view_icon(&self, name: &str, inactive: Rgba) -> Div {
+ let hover_background = self.color("modernActivityBarItem.hoverBackground");
+ let hover_foreground = self.foreground_or("modernActivityBarItem.hoverForeground");
+ let indicator = div().absolute().top(px(2.)).left(px(2.)).size(px(32.)).rounded(px(4.)).group_hover(ACTIVITY_ITEM_GROUP, |indicator| indicator.bg(hover_background));
+ let icon = self.styled_icon(name, 36., 24., |icon| icon.text_color(inactive).group_hover(ACTIVITY_ITEM_GROUP, |icon| icon.text_color(hover_foreground)));
+ div().relative().child(indicator).child(icon)
+ }
+
/// style.css `.hc-black .monaco-list:not(.element-focused):focus:before`: in high contrast a focused list
/// without a focused row is outlined in focusBorder, above its sticky rows.
fn high_contrast_list_outline(&self, list_focused: bool, has_focused_row: bool) -> Option<Div> {
@@ -2032,7 +2043,7 @@ impl Workbench {
/// The composite title bar: the view's name and its actions.
fn side_bar_title_text(&self, name: String) -> Div {
- self.side_bar_title_shared(name, false)
+ self.side_bar_title_shared(self.view_header_text(&name, false), false)
}
/// modernUI padding.css `.title-label`: beside the launch picker (`has-start-debug-action-item`) the label takes
@@ -2053,7 +2064,13 @@ impl Workbench {
// label and actions (part.css), so nothing in the title moves when a theme defines it.
.when_some(self.theme.color("sideBarTitle.border"), |title, border| title.child(div().absolute().left_0().right_0().bottom_0().h(px(1.)).bg(border)))
// part.css `.title-label h2`: ellipsis where `.title-actions` (8px padding-left) takes the room.
- .child(div().debug_selector(|| "side-bar-title-label".into()).self_start().min_w_0().when(has_start_debug, |label| label.flex_grow(1.).flex_basis(px(0.))).truncate().pl(px(8.)).line_height(px(32.)).text_size(px(12.)).font_weight(FontWeight::SEMIBOLD).text_color(self.foreground_or("sideBarTitle.foreground")).child(capitalize_words(&name)))
+ .child(div().debug_selector(|| "side-bar-title-label".into()).self_start().min_w_0().when(has_start_debug, |label| label.flex_grow(1.).flex_basis(px(0.))).truncate().pl(px(8.)).line_height(px(32.)).text_size(px(12.)).font_weight(FontWeight::SEMIBOLD).text_color(self.foreground_or("sideBarTitle.foreground")).child(name))
+ }
+
+ /// modernUI fontRamp.css: view, part and panel tab headers capitalize their words, all caps with
+ /// `workbench.experimental.modernUIUppercaseViewHeaders`; a workspace name the user chose keeps its case.
+ fn view_header_text(&self, text: &str, preserve_case: bool) -> String {
+ header_case(text, self.setting("workbench.experimental.modernUIUppercaseViewHeaders") == true, preserve_case)
}
/// The letterpress of an empty group, `size` wide (256px, 200px in a part of several groups): the VSRustium logo
@@ -2078,12 +2095,23 @@ impl Workbench {
let window_id = window.window_handle().window_id();
self.status_entry_bounds.borrow_mut().retain(|(drawn_in, ..)| *drawn_in != window_id);
// statusbarpart.css: pointer only on items with a command; status.message has none.
- let restricted_mode = self.restricted_mode_status_item(foreground, cx).and_then(|item| self.status_bar_entry("status.workspaceTrust", "Workspace Trust", None, item, cx));
- let left_bell = self.notifications_status_item(true, foreground, cx).and_then(|item| self.status_bar_entry("status.notifications", "Notifications", None, item, cx));
+ let restricted_mode = self.restricted_mode_status_item(foreground, cx).and_then(|item| self.status_bar_entry("status.workspaceTrust", "Workspace Trust", None, true, item, cx));
+ let left_bell = self.notifications_status_item(true, foreground, cx).and_then(|item| self.status_bar_entry("status.notifications", "Notifications", None, false, item, cx));
let hidden_entries = self.hidden_status_entries();
let problems_first = restricted_mode.is_none() && left_bell.is_none() && !self.status_entries.iter().any(|entry| entry.align_left && entry.priority > PROBLEMS_PRIORITY && !hidden_entries.contains(&entry.id));
let problems = self.problems_status_item(problems_first, foreground, cx);
- let problems = self.status_bar_entry("status.problems", "Problems", None, problems, cx);
+ let problems = self.status_bar_entry("status.problems", "Problems", None, false, problems, cx);
+ let mut left = Vec::from_iter(restricted_mode.into_iter().chain(left_bell));
+ left.extend(self.extension_status_items(true, |priority| priority > PROBLEMS_PRIORITY, foreground, cx));
+ left.extend(problems);
+ left.extend(self.extension_status_items(true, |priority| priority <= PROBLEMS_PRIORITY, foreground, cx));
+ left.extend(self.status_bar_message().and_then(|message| self.status_bar_entry("status.message", "Status Message", None, false, message, cx)));
+ left.extend(self.window_progress_entry(cx.background_executor().now()).and_then(|entry| self.status_bar_extension_entry(&entry, foreground, cx)));
+ left.extend(self.terminal_recording_status_entry().and_then(|entry| self.status_bar_extension_entry(&entry, foreground, cx)));
+ let mut right = self.extension_status_items(false, |priority| priority > EDITOR_STATUS_PRIORITY, foreground, cx);
+ right.extend(self.editor_status_items(foreground, window, cx));
+ right.extend(self.extension_status_items(false, |priority| priority <= EDITOR_STATUS_PRIORITY, foreground, cx));
+ right.extend(self.notifications_status_item(false, foreground, cx).and_then(|item| self.status_bar_entry("status.notifications", "Notifications", None, false, item, cx)));
let height = self.status_bar_height();
div()
.relative()
@@ -2105,8 +2133,8 @@ impl Workbench {
let radius = px(if is_tahoe_or_newer() { 16. } else { 10. });
bar.child(div().absolute().inset_0().border_1().rounded_bl(radius).rounded_br(radius).border_color(border))
})
- .child(div().h(px(height - 4.)).flex().children(restricted_mode).children(left_bell).child(self.extension_status_items(true, |priority| priority > PROBLEMS_PRIORITY, foreground, cx)).children(problems).child(self.extension_status_items(true, |priority| priority <= PROBLEMS_PRIORITY, foreground, cx)).children(self.status_bar_message().and_then(|message| self.status_bar_entry("status.message", "Status Message", None, message, cx))).children(self.window_progress_entry(cx.background_executor().now()).and_then(|entry| self.status_bar_extension_entry(&entry, foreground, cx))).children(self.terminal_recording_status_entry().and_then(|entry| self.status_bar_extension_entry(&entry, foreground, cx))))
- .child(div().h(px(height - 4.)).flex().child(self.extension_status_items(false, |priority| priority > EDITOR_STATUS_PRIORITY, foreground, cx)).child(self.editor_status_items(foreground, window, cx)).child(self.extension_status_items(false, |priority| priority <= EDITOR_STATUS_PRIORITY, foreground, cx)).children(self.notifications_status_item(false, foreground, cx).and_then(|item| self.status_bar_entry("status.notifications", "Notifications", None, item, cx))))
+ .child(self.status_bar_side(left).h(px(height - 4.)))
+ .child(self.status_bar_side(right).h(px(height - 4.)))
}
/// The `status.message` entry: multi-chord mode, else the latest status message (notificationsStatus.ts).
@@ -2182,6 +2210,12 @@ fn letterpress_path() -> String {
fn capitalize_words(text: &str) -> String {
text.split(' ').map(|word| word.chars().next().map_or_else(String::new, |first| first.to_uppercase().chain(word.chars().skip(1)).collect())).collect::<Vec<_>>().join(" ")
}
+fn header_case(text: &str, uppercase: bool, preserve_case: bool) -> String {
+ if uppercase {
+ return text.to_uppercase();
+ }
+ if preserve_case { text.to_string() } else { capitalize_words(text) }
+}
#[cfg(test)]
mod scroll_frame_time;
#[cfg(test)]
@@ -2204,6 +2238,13 @@ mod tests {
assert_eq!(super::capitalize_words("Run and debug x"), "Run And Debug X");
}
+ #[test]
+ fn view_headers_capitalize_keep_the_workspace_name_or_go_all_caps() {
+ assert_eq!(super::header_case("npm scripts", false, false), "Npm Scripts");
+ assert_eq!(super::header_case("Explorer: my folder", false, true), "Explorer: my folder");
+ assert_eq!(super::header_case("Explorer: my folder", true, true), "EXPLORER: MY FOLDER");
+ }
+
#[gpui::test]
fn clicking_a_folder_row_toggles_it(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
diff --git a/native/crates/app/src/workbench/activity_bar_menu.rs b/native/crates/app/src/workbench/activity_bar_menu.rs
index 26602d49b72..8a0d79eb230 100644
--- a/native/crates/app/src/workbench/activity_bar_menu.rs
+++ b/native/crates/app/src/workbench/activity_bar_menu.rs
@@ -359,7 +359,7 @@ impl Workbench {
let dragged = DraggedComposite { id: composite_container(id), label: title.into(), icon: Some(icon), foreground, background: self.color("modernActivityBar.background") };
let item = item.when(bar == "activity", |item| item.child(self.activity_item_focus_indicator(id, active, cx)));
let item = self.with_composite_menu(item, bar, id, Part::SideBar, cx).on_drag(dragged, |dragged, _, _, cx| cx.new(|_| dragged.clone()));
- self.with_composite_drop(item, bar, id, Part::SideBar, cx)
+ self.with_composite_drop(item, bar, id, Part::SideBar, cx).group(super::ACTIVITY_ITEM_GROUP)
}
/// shortcut: the drag image draws the codicon, not a product icon theme's glyph; take `styled_icon`'s lookup when a
diff --git a/native/crates/app/src/workbench/auxiliary_windows.rs b/native/crates/app/src/workbench/auxiliary_windows.rs
index 6b75eb87b4b..86ea83f1a03 100644
--- a/native/crates/app/src/workbench/auxiliary_windows.rs
+++ b/native/crates/app/src/workbench/auxiliary_windows.rs
@@ -523,7 +523,7 @@ impl Workbench {
let radius = px(if super::is_tahoe_or_newer() { 16. } else { 10. });
bar.child(div().absolute().inset_0().border_1().rounded_bl(radius).rounded_br(radius).border_color(border))
})
- .child(div().h(px(22.)).flex().child(self.editor_status_items(foreground, window, cx)))
+ .child(self.status_bar_side(self.editor_status_items(foreground, window, cx)).h(px(22.)))
}
/// The overlays of the active window (quick input, menus, dialogs, hovers): the main window's while it is the
diff --git a/native/crates/app/src/workbench/centered_layout.rs b/native/crates/app/src/workbench/centered_layout.rs
index 0c3b41ff9a6..bc23ec9e20b 100644
--- a/native/crates/app/src/workbench/centered_layout.rs
+++ b/native/crates/app/src/workbench/centered_layout.rs
@@ -168,7 +168,7 @@ impl Workbench {
.left(px(x - size / 2.))
.w(px(size))
.cursor(CursorStyle::ResizeColumn)
- .when(active, |sash| sash.child(div().absolute().top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)).bg(hover_border)))
+ .when(active, |sash| sash.child(div().absolute().top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)).rounded(px(hover / 2.)).bg(hover_border)))
.on_hover(cx.listener(move |workbench, over: &bool, window, cx| {
let layout = &mut workbench.centered_layout;
if !*over {
diff --git a/native/crates/app/src/workbench/debug_view.rs b/native/crates/app/src/workbench/debug_view.rs
index 7438490c8c6..09143971c79 100644
--- a/native/crates/app/src/workbench/debug_view.rs
+++ b/native/crates/app/src/workbench/debug_view.rs
@@ -152,7 +152,7 @@ impl Workbench {
pub(super) fn debug_side_bar(&self, window: &Window, cx: &mut Context<Self>) -> Div {
let foreground = self.foreground_or("sideBar.foreground");
let (has_start, actions) = self.debug_container_actions(window, cx);
- let title = self.side_bar_title_shared(crate::nls::localize_in(DEBUG_CONTAINER, "Run and Debug").into_owned(), has_start).child(actions);
+ let title = self.side_bar_title_shared(self.view_header_text(&crate::nls::localize_in(DEBUG_CONTAINER, "Run and Debug"), false), has_start).child(actions);
let frame = self.side_bar_frame().text_color(foreground).child(title);
let container = super::view_panes::PaneContainer::Debug;
let ids = self.panes(container).view.as_ref().expect("panes are laid out before they draw").ids().to_vec();
@@ -511,7 +511,7 @@ impl Workbench {
.flex_none()
.self_center()
.ml(px(3.))
- .rounded(px(5.))
+ .rounded(px(4.))
.hover(|button| button.bg(self.color("toolbar.hoverBackground")))
.on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {
cx.stop_propagation();
@@ -670,15 +670,18 @@ impl Workbench {
}
let label_background = self.color("debugView.stateLabelBackground");
let label_foreground = self.color("debugView.stateLabelForeground");
- let state_label = |text: String| div().ml_auto().mr(px(8.)).px(px(4.)).rounded(px(3.)).text_size(px(10.)).bg(label_background).text_color(label_foreground).child(text.to_uppercase());
+ // callStackView.ts: the state labels are `.monaco-count-badge.long`, which modernUI padding.css and
+ // roundedCorners.css pad 2px 4px to an 18px minimum height with 4px corners.
+ let state_label = |text: String| div().ml_auto().mr(px(8.)).px(px(4.)).py(px(2.)).min_h(px(18.)).flex().items_center().rounded(px(4.)).text_size(px(10.)).bg(label_background).text_color(label_foreground).child(text.to_uppercase());
for (session, session_depth) in shown {
let depth = session_depth + usize::from(several);
if several {
// `SessionsRenderer`: the state of the session's first stopped thread.
let state = session.threads.iter().find(|thread| thread.stopped).map_or_else(|| "Running".to_owned(), |thread| thread.state_label());
- // modernUI fontRamp.css: session state labels are `text-transform: capitalize` at `fontSize.label1`.
+ // modernUI fontRamp.css: session state labels are `text-transform: capitalize` at `fontSize.label2`, and
+ // padding.css drops their right margin.
let state = super::capitalize_words(&state);
- let state = div().flex_none().ml_auto().mr(px(8.)).px(px(4.)).rounded(px(3.)).text_size(px(12.)).bg(label_background).text_color(label_foreground).child(state);
+ let state = div().flex_none().ml_auto().px(px(4.)).py(px(2.)).min_h(px(18.)).flex().items_center().rounded(px(4.)).text_size(px(11.)).bg(label_background).text_color(label_foreground).child(state);
let item = CallStackItem::Session(session.id.clone());
rows.push(self.debug_row(format!("session/{}", session.id), session_depth, Some(true), false, list_focused, cx).child(self.icon("bug", 16., 16., self.foreground_or("icon.foreground"))).child(div().min_w_0().truncate().child(session.name.clone())).child(state).on_mouse_down(MouseButton::Right, call_stack_menu(item)).into_any_element());
}
diff --git a/native/crates/app/src/workbench/dialog_view.rs b/native/crates/app/src/workbench/dialog_view.rs
index 0894451e937..96df0677c36 100644
--- a/native/crates/app/src/workbench/dialog_view.rs
+++ b/native/crates/app/src/workbench/dialog_view.rs
@@ -301,7 +301,7 @@ impl Workbench {
.rounded(px(8.))
.border_1()
.border_color(self.color("widget.border"))
- .bg(self.color("editorWidget.background"))
+ .child(self.frosted_glass("editorWidget.background", 8.))
.text_color(foreground)
.text_size(px(13.))
.line_height(px(18.2))
diff --git a/native/crates/app/src/workbench/editor_groups.rs b/native/crates/app/src/workbench/editor_groups.rs
index a4295634620..0879eef43de 100644
--- a/native/crates/app/src/workbench/editor_groups.rs
+++ b/native/crates/app/src/workbench/editor_groups.rs
@@ -793,7 +793,7 @@ impl Workbench {
.when(floating, |card| match self.compact_density() {
// editorBorder.css: a compact editor has no left border unless it meets the window's left edge.
true => card.border_t_1().border_r_1().border_b_1().when(self.part_at_left_edge(super::layout::Part::Editor), |card| card.border_l_1()).border_color(gpui::transparent_black()),
- false => card.border_1().rounded(px(8.)).border_color(self.color("surface.border")),
+ false => card.border_1().rounded(px(8.)).border_color(self.editor_part_border()),
})
.pl(px(left))
.pr(px(right))
@@ -1151,7 +1151,8 @@ impl Workbench {
.when(active, |element| {
// `--vscode-sash-hover-size`, centered in the sash.
let (size, hover) = (self.sash_size(), self.sash_hover_size());
- let highlight = div().absolute().bg(hover_border);
+ // modernUI roundedCorners.css: the highlight's ends are rounded by half its size.
+ let highlight = div().absolute().rounded(px(hover / 2.)).bg(hover_border);
element.child(match vertical {
true => highlight.top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)),
false => highlight.left_0().right_0().top(px((size - hover) / 2.)).h(px(hover)),
diff --git a/native/crates/app/src/workbench/editor_groups/tests.rs b/native/crates/app/src/workbench/editor_groups/tests.rs
index b83160e54c6..872c22850a7 100644
--- a/native/crates/app/src/workbench/editor_groups/tests.rs
+++ b/native/crates/app/src/workbench/editor_groups/tests.rs
@@ -49,6 +49,21 @@ fn groups(workbench: &gpui::Entity<Workbench>, cx: &mut VisualTestContext) -> (V
})
}
+#[gpui::test]
+fn a_divider_separates_two_inactive_tabs_only(cx: &mut TestAppContext) {
+ let (_dir, workbench, cx) = workbench_with("divider", &["a.txt", "b.txt", "c.txt"], cx);
+ workbench.update(cx, |workbench, cx| {
+ workbench.editors.activate(0);
+ workbench.editors_changed(cx);
+ });
+ cx.run_until_parked();
+ assert!(cx.debug_bounds("tab-divider-1").is_none(), "the tab after the active one has no divider");
+ let divider = cx.debug_bounds("tab-divider-2").expect("a divider between two inactive tabs");
+ let tab = cx.debug_bounds("tab-name-2").expect("the third tab's name");
+ assert_eq!((divider.size.width, divider.size.height), (gpui::px(1.), gpui::px(16.)));
+ assert!((divider.center().y - tab.center().y).abs() < gpui::px(1.), "centered on the tab: {divider:?} {tab:?}");
+}
+
#[gpui::test]
fn split_editor_shows_the_same_model_in_a_new_group_to_the_right(cx: &mut TestAppContext) {
let (_dir, workbench, cx) = workbench_with("split", &["a.txt"], cx);
diff --git a/native/crates/app/src/workbench/editor_menus.rs b/native/crates/app/src/workbench/editor_menus.rs
index 10b549c78e7..f5f31d3c641 100644
--- a/native/crates/app/src/workbench/editor_menus.rs
+++ b/native/crates/app/src/workbench/editor_menus.rs
@@ -64,7 +64,7 @@ impl Workbench {
self.icon("ellipsis", 22., 16., color)
.id(if in_title_bar { "title-bar-more" } else { "editor-title-more" })
.debug_selector(move || if in_title_bar { "title-bar-more" } else { "editor-title-more" }.into())
- .rounded(px(5.))
+ .rounded(px(4.))
.when(open, |icon| icon.bg(self.color("toolbar.activeBackground")))
.cursor_pointer()
.hover(|icon| icon.bg(self.color("toolbar.hoverBackground")))
diff --git a/native/crates/app/src/workbench/editor_view.rs b/native/crates/app/src/workbench/editor_view.rs
index 37d70a73756..685634305de 100644
--- a/native/crates/app/src/workbench/editor_view.rs
+++ b/native/crates/app/src/workbench/editor_view.rs
@@ -166,7 +166,16 @@ impl Workbench {
let outer_left = self.part_at_left_edge(super::layout::Part::Editor);
return self.compact_card_strokes("editor.border", [false, true, true, outer_left], outer_left);
}
- div().absolute().inset(px(-1.)).border_1().rounded(px(8.)).border_color(self.color("surface.border"))
+ div().absolute().inset(px(-1.)).border_1().rounded(px(8.)).border_color(self.editor_part_border())
+ }
+
+ /// editorBorder.css `.floating-panels .part.editor`; connectedEditorTabs.css takes `modernPanel.border` in high contrast.
+ pub(super) fn editor_part_border(&self) -> Rgba {
+ if self.theme.kind.is_high_contrast() {
+ return self.color("modernPanel.border");
+ }
+ let theme = &self.theme;
+ theme.color("editor.border").or(theme.color("surface.border")).or(theme.color("widget.border")).unwrap_or(gpui::transparent_black().into())
}
/// One strip behind every tab; the active tab is an editor-colored fill whose bottom shoulders curve
@@ -584,7 +593,15 @@ impl Workbench {
let sticky_sizing = self.sticky_tab_width(index);
let compact = sticky_sizing == Some(28.);
let readonly = self.readonly(&editor.document().scheme, &editor.document().path).is_some();
- let action_foreground = if active { self.foreground_or("modernEditorTab.activeForeground") } else { self.foreground_or("tab.inactiveForeground") };
+ let action_foreground = match active {
+ true => self.foreground_or("modernEditorTab.activeForeground"),
+ // modernUI tabs.css: high contrast keeps `color-mix(foreground 50%, transparent)`, the others tab.inactiveForeground.
+ false if self.theme.kind.is_high_contrast() => crate::theme::color_mix(self.color("foreground"), 0.5, gpui::transparent_black().into()),
+ false => self.foreground_or("tab.inactiveForeground"),
+ };
+ // modernUI tabs.css `.tab:hover:not(.active)`: the label and the action in modernEditorTab.hoverForeground.
+ let hover_foreground = self.foreground_or("modernEditorTab.hoverForeground");
+ let tab_group = gpui::SharedString::from(format!("tab-{index}"));
// tabs.css colors `.tab-label:not(.monaco-decoration-itemColor)`: a decorated label (read-only, no color of its
// own) inherits the tab's color from multieditortabscontrol.css, `tab.activeForeground` when active.
let foreground = if active && readonly { self.foreground_or("tab.activeForeground") } else { action_foreground };
@@ -657,7 +674,7 @@ impl Workbench {
_ => action_icon,
};
let action_group = gpui::SharedString::from(format!("tab-action-{index}"));
- let tab_group = gpui::SharedString::from(format!("tab-{index}"));
+ let action_icon_of = |name: &str| self.styled_icon(name, 20., 16., |icon| icon.text_color(action_foreground).when(!active, |icon| icon.group_hover(tab_group.clone(), |icon| icon.text_color(hover_foreground))));
let close = div()
.id(("close", index))
.debug_selector(move || format!("tab-action-{index}"))
@@ -665,8 +682,8 @@ impl Workbench {
.relative()
.rounded(px(4.))
.hover(|action| action.bg(self.color("toolbar.hoverBackground")))
- .child(self.icon(rest_icon, 20., 16., action_foreground).group_hover(action_group.clone(), |icon| icon.invisible()))
- .child(self.icon(action_icon, 20., 16., action_foreground).absolute().top_0().left_0().invisible().group_hover(action_group, |icon| icon.visible()))
+ .child(action_icon_of(rest_icon).group_hover(action_group.clone(), |icon| icon.invisible()))
+ .child(action_icon_of(action_icon).absolute().top_0().left_0().invisible().group_hover(action_group, |icon| icon.visible()))
// The tab's ActionBar has no hover delegate, so it makes an instant one (actionbar.ts).
.when(sticky, |close| close.child(self.hover_target(("tab-unpin-hover", index), super::hover::HoverContent::Text("Unpin Editor".into()), super::hover::HoverOptions::managed())))
.on_click(cx.listener(move |workbench, _, window, cx| {
@@ -687,6 +704,10 @@ impl Workbench {
.flex_none()
.flex()
.text_color(foreground)
+ // GPUI lays text out before group hitboxes exist, so the label's hover color is the tab's own hover style.
+ .when(!active && decoration_color.is_none() && !orphaned, |tab| tab.hover(move |tab| tab.text_color(hover_foreground)))
+ .when(!active && !upper, |tab| tab.child(self.inactive_tab_hover_fill(tab_group.clone())))
+ .when(self.shows_tab_divider(index, active, row), |tab| tab.child(self.tab_divider().debug_selector(move || format!("tab-divider-{index}"))))
.when_some(sticky_sizing, |tab, width| tab.w(px(width)))
.map(|tab| match (file_icon, compact) {
(Some(icon), true) => tab.pl(px(5.)).child(icon.mt(px(content_top))),
@@ -781,6 +802,29 @@ impl Workbench {
.child(shoulder(div().right(px(clip.right) - radius)).child(strip_corner().border_l_1().rounded_bl(radius)))
}
+ /// connectedEditorTabs.css: a hovered inactive tab's `.tab-fill` is inset 2px at the sides, reaches 1px below the
+ /// tab and takes `color-mix(foreground 6%, strip background)`.
+ fn inactive_tab_hover_fill(&self, tab_group: gpui::SharedString) -> Div {
+ let background = crate::theme::color_mix(self.color("foreground"), 0.06, self.tab_strip_background());
+ // shortcut: a theme's own tab hover colors (modernTabColorCustomizations.ts) are not read; port that module when a theme needs them.
+ div().absolute().left(px(2.)).right(px(2.)).top_0().bottom(px(-1.)).rounded(px(4.)).group_hover(tab_group, move |fill| fill.bg(background))
+ }
+
+ /// connectedEditorTabs.css `.tab:not(.active) + .tab:not(.active) > .tab-divider`: 1x16px of tab.divider at the
+ /// tab's start, vertically centered; high contrast hides it in the upper bar.
+ fn shows_tab_divider(&self, index: usize, active: bool, row: TabRow) -> bool {
+ let first = match row {
+ TabRow::Main { first, .. } => first,
+ TabRow::Upper if self.theme.kind.is_high_contrast() => return false,
+ TabRow::Upper => index == 0,
+ };
+ !active && !first && self.editors.active_index() != Some(index - 1)
+ }
+
+ 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"))
+ }
+
pub(super) fn document_icon(&self, editor: &OpenEditor, line_height: f32, foreground: Rgba) -> Option<Div> {
let document = &editor.document();
// `SearchEditorInput.getIcon`.
@@ -2808,7 +2852,7 @@ impl Workbench {
/// The column selection, tab focus and overtype mode items, then with an editor open its selection, indentation, encoding, end of line and
/// language items (editorStatus.ts), right to left before the notifications bell.
- pub(super) fn editor_status_items(&self, foreground: Rgba, window: &Window, cx: &mut Context<Self>) -> Div {
+ pub(super) fn editor_status_items(&self, foreground: Rgba, window: &Window, cx: &mut Context<Self>) -> Vec<(bool, gpui::AnyElement)> {
// editorStatus.ts `updateColumnSelectionModeElement`, `updateTabFocusModeElement` and `updateInputModeElement`: prominent entries.
let mut items = Vec::new();
if self.editors.active().is_some() && self.setting("editor.columnSelection") == true {
@@ -2913,7 +2957,8 @@ impl Workbench {
.relative()
.h_full()
.flex_none()
- .when(!compact, |item| item.mx(px(margin)).px(px(padding)))
+ .when(!compact && index >= prominent_items, |item| item.mx(px(margin)).px(px(padding)))
+ .when(index < prominent_items, |item| item.px(px(self.status_label_spacing(true, false).1)))
.when(compact, |item| item.mr(px(compact_right_margin)).px(px(compact_padding)))
.flex()
.items_center()
@@ -2934,23 +2979,22 @@ impl Workbench {
};
let name = super::status_entries::editor_status_entry_name(id);
if index >= prominent_items {
- return (id.to_owned(), name.to_owned(), item.into_any_element());
+ return (id.to_owned(), name.to_owned(), false, item.into_any_element());
}
- // `.prominent-kind` colors the container around the label's 3px margins, with modernUI statusBar.css
- // cornerRadius.small (4px).
+ // `.prominent-kind` colors the container, a `has-background-color` one with no label margins, with
+ // modernUI statusBar.css cornerRadius.small (4px).
let item = div().h_full().flex_none().rounded(px(4.)).text_color(prominent.1).when_some(prominent.0, |container, background| container.bg(background)).child(item);
- (id.to_owned(), name.to_owned(), item.into_any_element())
+ (id.to_owned(), name.to_owned(), true, item.into_any_element())
});
- let mut items: Vec<(String, String, gpui::AnyElement)> = items.collect();
+ let mut items: Vec<(String, String, bool, gpui::AnyElement)> = items.collect();
if let Some(language_index) = language_index {
- let detection = self.language_detection_status_item(foreground, cx).map(|item| ("status.languageDetectionStatus".to_owned(), "Language Detection".to_owned(), item));
+ let detection = self.language_detection_status_item(foreground, cx).map(|item| ("status.languageDetectionStatus".to_owned(), "Language Detection".to_owned(), false, item));
items.splice(language_index + 1..language_index + 1, detection.into_iter().chain(pinned));
if let Some(combined) = combined {
- items.insert(language_index, ("status.languageStatus".to_owned(), "Editor Language Status".to_owned(), combined));
+ items.insert(language_index, ("status.languageStatus".to_owned(), "Editor Language Status".to_owned(), false, combined));
}
}
- let items: Vec<_> = items.into_iter().filter_map(|(id, name, item)| self.status_bar_entry(&id, &name, None, item, cx)).collect();
- div().h_full().flex().text_color(foreground).children(items)
+ items.into_iter().filter_map(|(id, name, background, item)| self.status_bar_entry(&id, &name, None, background, item, cx)).collect()
}
/// `getCodeEditor(editorService.activeTextEditorControl)`, which the status bar and breadcrumbs follow: a diff
diff --git a/native/crates/app/src/workbench/editor_view/diff_editor_view.rs b/native/crates/app/src/workbench/editor_view/diff_editor_view.rs
index b6d78fc6797..1422aa58efa 100644
--- a/native/crates/app/src/workbench/editor_view/diff_editor_view.rs
+++ b/native/crates/app/src/workbench/editor_view/diff_editor_view.rs
@@ -542,15 +542,16 @@ impl Workbench {
}
}
let shadow = self.theme.color("scrollbar.shadow");
- let border = self.theme.color("diffEditor.border");
- // style.css `.side-by-side .editor.modified`: the shadow and border the modified editor casts on the original.
+ // style.css `.side-by-side .editor.modified`: the shadow and border the modified editor casts on the original; modernUI
+ // shadows.css draws the border in surface.border.
+ let border = self.color("surface.border");
let modified_pane = div()
.flex_1()
.min_w_0()
.relative()
.flex()
.flex_col()
- .when(!input.inline_now, |pane| pane.when_some(border, |pane, border| pane.border_l_1().border_color(border)))
+ .when(!input.inline_now, |pane| pane.border_l_1().border_color(border))
.children(self.code_editor_area(modified, window, cx))
.when(!input.inline_now, |pane| pane.when_some(shadow, |pane, shadow| pane.child(div().absolute().top_0().bottom_0().left(px(-6.)).w(px(6.)).child(side_shadow(shadow)))));
body.child(modified_pane).child(self.diff_overview(input, modified, cx).w(px(DIFF_OVERVIEW_WIDTH)).flex_none().h_full())
diff --git a/native/crates/app/src/workbench/editor_view/multi_diff_editor_view.rs b/native/crates/app/src/workbench/editor_view/multi_diff_editor_view.rs
index dfee4903a09..1bdceca28b1 100644
--- a/native/crates/app/src/workbench/editor_view/multi_diff_editor_view.rs
+++ b/native/crates/app/src/workbench/editor_view/multi_diff_editor_view.rs
@@ -932,7 +932,7 @@ impl Workbench {
.left(px(boundary - size / 2.))
.w(px(size))
.cursor(gpui::CursorStyle::ResizeColumn)
- .when(active, |sash| sash.child(div().absolute().top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)).bg(hover_border)))
+ .when(active, |sash| sash.child(div().absolute().top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)).rounded(px(hover / 2.)).bg(hover_border)))
.on_hover(cx.listener(|workbench, over: &bool, window, cx| {
workbench.multi_diff_sash.hovered = false;
workbench.multi_diff_sash.hover = None;
@@ -1010,7 +1010,7 @@ impl Workbench {
let (index, depth) = match row {
TreeRow::Folder { path, label, depth } => {
let focused = focused_row.as_ref() == Some(&FileListRow::Folder(path.clone()));
- return self.multi_diff_folder_row(input, path, label, depth, cx).when(focused, |row| row.when_some(focus_outline, |row, color| row.border_1().border_color(color)));
+ return self.multi_diff_folder_row(input, path, label, depth, cx).mx(px(4.)).rounded(px(4.)).when(focused, |row| row.when_some(focus_outline, |row, color| row.border_1().border_color(color)));
}
TreeRow::Resource { index, depth } => (index, depth),
};
@@ -1023,6 +1023,9 @@ impl Workbench {
};
div()
.id(("multi-diff-file-list-item", index))
+ // modernUI padding.css and roundedCorners.css: rows inset 4px from the list's sides, 4px corners.
+ .mx(px(4.))
+ .rounded(px(4.))
.h(px(22.))
.px(px(8.))
.when(tree, |row| row.pl(px(8. + TWISTIE + INDENT * depth as f32)))
@@ -1460,13 +1463,14 @@ impl Workbench {
own + room_after(editor, line, room)
};
let (width, gutter_width) = split;
- let border = self.theme.color("diffEditor.border");
+ // modernUI shadows.css: the modified side's left border in surface.border.
+ let border = self.color("surface.border");
let pair = |original_cell: Div, modified_cell: Div| {
div()
.flex()
.child(original_cell.w(px(width)).flex_none())
.child(div().w(px(gutter_width)).flex_none())
- .child(modified_cell.flex_1().min_w_0().when_some(border, |cell, border| cell.border_l_1().border_color(border)))
+ .child(modified_cell.flex_1().min_w_0().border_l_1().border_color(border))
};
let inline = |cell: Div| div().flex().child(div().w(px(gutter_width)).flex_none()).child(cell.flex_1().min_w_0());
match row {
diff --git a/native/crates/app/src/workbench/explorer_find.rs b/native/crates/app/src/workbench/explorer_find.rs
index 4d3e61497fe..908db2df28d 100644
--- a/native/crates/app/src/workbench/explorer_find.rs
+++ b/native/crates/app/src/workbench/explorer_find.rs
@@ -441,7 +441,7 @@ impl Workbench {
.icon("close", 20., 16., self.foreground_or("icon.foreground"))
.id("tree-find-close")
.ml(px(4.))
- .rounded(px(5.))
+ .rounded(px(4.))
.cursor_pointer()
.hover(|close| close.bg(self.color("toolbar.hoverBackground")))
.on_click(cx.listener(move |workbench, _, window, cx| close(workbench, window, cx)));
diff --git a/native/crates/app/src/workbench/extensions_list_view.rs b/native/crates/app/src/workbench/extensions_list_view.rs
index 3ee5ea7310e..23c3f0ebe02 100644
--- a/native/crates/app/src/workbench/extensions_list_view.rs
+++ b/native/crates/app/src/workbench/extensions_list_view.rs
@@ -121,7 +121,7 @@ impl Workbench {
"workbench.views.extensions.searchOutdated" if !pane.extensions.is_empty() => {
let command = "workbench.extensions.action.updateAllExtensions";
// actionbar.css `.action-label` of an action without an icon: its title, 11px, 3px padding.
- let label = div().id(command).px(px(3.)).rounded(px(5.)).text_size(px(11.)).cursor_pointer().hover(|label| label.bg(self.color("toolbar.hoverBackground"))).child("Update All Extensions").on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {
+ let label = div().id(command).px(px(3.)).rounded(px(4.)).text_size(px(11.)).cursor_pointer().hover(|label| label.bg(self.color("toolbar.hoverBackground"))).child("Update All Extensions").on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {
cx.stop_propagation();
drop(workbench.execute_command(command, Vec::new(), window, cx));
}));
diff --git a/native/crates/app/src/workbench/language_status.rs b/native/crates/app/src/workbench/language_status.rs
index b3af288bab4..793999f5cfa 100644
--- a/native/crates/app/src/workbench/language_status.rs
+++ b/native/crates/app/src/workbench/language_status.rs
@@ -11,7 +11,7 @@ use serde_json::{Value, json};
use super::Workbench;
use super::hover::{HoverContent, HoverOptions, text_width};
use super::quick_input_view::icon_at;
-use super::status_entries::EDITOR_STATUS_PRIORITY;
+use super::status_entries::{EDITOR_STATUS_PRIORITY, has_background};
use crate::commands::Outcome;
use crate::editor::marker_decorations::MAX_MARKER_DECORATIONS;
use crate::language_features::{Candidate, LanguageFeatures};
@@ -199,13 +199,14 @@ impl Workbench {
}
/// The combined entry, which goes left of the language entry, and the pinned entries, which go right of it.
- /// The pinned entries come with their status bar id and name.
- pub(super) fn language_status_items(&self, foreground: Rgba, cx: &mut Context<Self>) -> (Option<AnyElement>, Vec<(String, String, AnyElement)>) {
+ /// The pinned entries come with their status bar id and name and whether they paint a background.
+ pub(super) fn language_status_items(&self, foreground: Rgba, cx: &mut Context<Self>) -> (Option<AnyElement>, Vec<(String, String, bool, AnyElement)>) {
let view = self.language_status_view();
let dedicated = view.dedicated.iter().map(|status| {
let entry = dedicated_entry(status);
- let item = self.extension_status_item(&entry, foreground, cx).into_any_element();
- (entry.id, entry.name, item)
+ let item = self.extension_status_item(&entry, false, foreground, cx).into_any_element();
+ let background = has_background(&entry);
+ (entry.id, entry.name, background, item)
}).collect();
(self.combined_language_status_item(&view, foreground, cx), dedicated)
}
diff --git a/native/crates/app/src/workbench/notifications_view.rs b/native/crates/app/src/workbench/notifications_view.rs
index 70864a8297f..879655e07f3 100644
--- a/native/crates/app/src/workbench/notifications_view.rs
+++ b/native/crates/app/src/workbench/notifications_view.rs
@@ -36,7 +36,7 @@ const SPAM_LIMIT: usize = 3;
/// The 1.147 floating layout: the toasts end 4px above the status bar, the center 8px.
const TOASTS_OFFSET: f32 = 4.;
const CENTER_OFFSET: f32 = 8.;
-/// window.ts `DEFAULT_CUSTOM_TITLEBAR_HEIGHT`, which the top right position adds.
+/// window.ts `DEFAULT_CUSTOM_TITLEBAR_HEIGHT`.
const TITLE_BAR_HEIGHT: f32 = 35.;
const CENTER_HEADER_HEIGHT: f32 = 35.;
/// The center's 8px corners inside its 1px border, which clip its header and rows.
@@ -487,7 +487,7 @@ impl Workbench {
let position = self.notifications_position();
if self.notifications.center_visible {
let center = self.notifications_center(viewport, window, cx);
- return Some(place(center, position, CENTER_OFFSET).into_any_element());
+ return Some(place(center, position, CENTER_OFFSET, self.is_status_bar_visible()).into_any_element());
}
if self.notifications.toasts.is_empty() {
return None;
@@ -508,7 +508,8 @@ impl Workbench {
.border_1()
.border_color(self.color("notificationToast.border"))
.rounded(px(8.))
- .bg(self.color("notifications.background"))
+ .relative()
+ .child(self.frosted_glass("notifications.background", 8.))
.shadow(vec![shadow()])
.overflow_hidden()
.on_hover(cx.listener(move |workbench, hovered: &bool, _, cx| {
@@ -523,8 +524,8 @@ impl Workbench {
.child(toast),
)
}).collect::<Vec<_>>();
- let container = div().id("notification-toasts").role(gpui::Role::List).aria_label("Notification Toast").flex().flex_col().occlude().track_focus(&self.notifications.focus).children(toasts);
- Some(place(container, position, TOASTS_OFFSET).into_any_element())
+ let container = div().id("notification-toasts").debug_selector(|| "notification-toasts".into()).role(gpui::Role::List).aria_label("Notification Toast").flex().flex_col().occlude().track_focus(&self.notifications.focus).children(toasts);
+ Some(place(container, position, TOASTS_OFFSET, self.is_status_bar_visible()).into_any_element())
}
/// `getNotificationsPosition`.
@@ -583,7 +584,8 @@ impl Workbench {
.rounded(px(8.))
.overflow_hidden()
.shadow(vec![shadow()])
- .bg(self.color("notifications.background"))
+ .relative()
+ .child(self.frosted_glass("notifications.background", 8.))
.text_color(self.color("notifications.foreground"))
.occlude()
.role(gpui::Role::List)
@@ -977,12 +979,15 @@ enum Position {
}
/// The toasts and the center sit `offset` from the window corner of `position`, clear of the status or title bar.
-fn place<E: Styled>(element: E, position: Position, offset: f32) -> E {
+/// modernUI notificationsDialogs.css: the center sits 36px from the window's bottom (`.nostatusbar` 32px) or, at the
+/// top right, its top; the toasts 4px less.
+fn place<E: Styled>(element: E, position: Position, offset: f32, status_bar_visible: bool) -> E {
let element = element.absolute();
+ let bottom = px(if status_bar_visible { STATUS_BAR_HEIGHT } else { 24. } + offset);
match position {
- Position::BottomRight => element.right(px(offset)).bottom(px(STATUS_BAR_HEIGHT + offset)),
- Position::BottomLeft => element.left(px(offset)).bottom(px(STATUS_BAR_HEIGHT + offset)),
- Position::TopRight => element.right(px(offset)).top(px(TITLE_BAR_HEIGHT + offset)),
+ Position::BottomRight => element.right(px(offset)).bottom(bottom),
+ Position::BottomLeft => element.left(px(offset)).bottom(bottom),
+ Position::TopRight => element.right(px(offset)).top(px(28. + offset)),
}
}
diff --git a/native/crates/app/src/workbench/notifications_view/tests.rs b/native/crates/app/src/workbench/notifications_view/tests.rs
index 6e745b8f5e2..9d2514a9297 100644
--- a/native/crates/app/src/workbench/notifications_view/tests.rs
+++ b/native/crates/app/src/workbench/notifications_view/tests.rs
@@ -5,7 +5,7 @@ use std::sync::{Arc, Mutex};
use config::registry::Registry;
use config::service::Settings;
use exthost::scan::scan_extension;
-use gpui::{TestAppContext, VisualTestContext};
+use gpui::{TestAppContext, VisualTestContext, px};
use serde_json::{Value, json};
use crate::commands::Outcome;
@@ -113,6 +113,29 @@ fn the_position_moves_the_bell_between_status_bar_sides_and_the_title_bar(cx: &m
assert_eq!(sides(&workbench, "workbench.action.setNotificationsPosition.bottomRight", cx), (false, true, false));
}
+#[gpui::test]
+fn toasts_keep_the_modern_ui_insets_from_the_window_edges(cx: &mut TestAppContext) {
+ let (workbench, cx) = workbench(cx);
+ drop(show_message(&workbench, vec![json!(1), json!("Hello"), json!({}), json!([])], cx));
+ let window_height = workbench.update_in(cx, |_, window, _| window.viewport_size().height);
+ let bottom_inset = |cx: &mut VisualTestContext| f32::from(window_height - cx.debug_bounds("notification-toasts").unwrap().bottom());
+ assert_eq!(bottom_inset(cx), 32.);
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.toggleStatusbarVisibility", Vec::new(), window, cx)));
+ cx.run_until_parked();
+ assert_eq!(bottom_inset(cx), 28.);
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.setNotificationsPosition.topRight", Vec::new(), window, cx)));
+ cx.run_until_parked();
+ assert_eq!(f32::from(cx.debug_bounds("notification-toasts").unwrap().top()), 32.);
+}
+
+#[gpui::test]
+fn the_bell_ends_the_status_bar_at_the_right_edge(cx: &mut TestAppContext) {
+ let (workbench, cx) = workbench(cx);
+ let width = workbench.update_in(cx, |_, window, _| window.viewport_size().width);
+ let bell = cx.debug_bounds("status-bar-entry-status.notifications").unwrap();
+ assert_eq!(bell.right(), width - px(12.));
+}
+
fn progress(workbench: &gpui::Entity<Workbench>, method: &str, args: Vec<Value>, cx: &mut VisualTestContext) {
workbench.update_in(cx, |workbench, window, cx| match method {
"start" => drop(workbench.start_progress(&args, window, cx)),
diff --git a/native/crates/app/src/workbench/open_editors_view.rs b/native/crates/app/src/workbench/open_editors_view.rs
index fb1ac36e27a..e7841fe3ddb 100644
--- a/native/crates/app/src/workbench/open_editors_view.rs
+++ b/native/crates/app/src/workbench/open_editors_view.rs
@@ -243,7 +243,7 @@ impl Workbench {
.min_w(px(18.))
.px(px(4.))
.py(px(2.))
- .rounded(px(2.))
+ .rounded(px(4.))
.when_some(self.theme.color("contrastBorder"), |badge, border| badge.border_1().border_color(border))
.text_size(px(11.))
.line_height(px(13.))
diff --git a/native/crates/app/src/workbench/panel.rs b/native/crates/app/src/workbench/panel.rs
index c53b69fe1a5..0125b2d7def 100644
--- a/native/crates/app/src/workbench/panel.rs
+++ b/native/crates/app/src/workbench/panel.rs
@@ -13,6 +13,7 @@ use gpui::{
use serde_json::json;
use super::Workbench;
+use crate::theme::ThemeKind;
use super::activity::{BadgeContent, visible_badge};
use super::hover::{HoverContent, HoverOptions, HoverPosition};
use super::layout::{Alignment, Part, Position};
@@ -25,6 +26,8 @@ const ACTIVE_PANEL_KEY: &str = "workbench.panelpart.activepanelid";
const ACTIVE_AUXILIARY_BAR_KEY: &str = "workbench.auxiliarybar.activepanelid";
/// The composite title's height (`--vscode-workbench-titleHeight` of a pane composite part).
const TITLE_HEIGHT: f32 = 32.;
+/// connectedPaneTabs.css `.action-item.icon`: `spacing-size360`.
+const ICON_TAB_WIDTH: f32 = 36.;
/// views.css `.viewpane-filter-container` `max-width` in a panel title.
const FILTER_MAX_WIDTH: f32 = 200.;
const FILTER_MIN_WIDTH: f32 = 150.;
@@ -437,10 +440,14 @@ impl Workbench {
let tabs_bar = title_bars(part)[0];
let mut tabs: Vec<AnyElement> = Vec::new();
let mut overflowing = Vec::new();
+ let mut previous_inactive = false;
for tab in self.part_tabs(part) {
match shown.contains(&tab.id) {
true => {
- let item = self.action_bar_item(tabs_bar, tab.id, self.panel_tab(&tab, Some(tab.id) == active, tabs.is_empty(), background, window, cx), cx);
+ let checked = Some(tab.id) == active;
+ let divider = previous_inactive && !checked;
+ previous_inactive = !checked;
+ let item = self.action_bar_item(tabs_bar, tab.id, self.panel_tab(&tab, checked, tabs.is_empty(), divider, background, window, cx), cx);
let item = self.with_composite_menu(item, tabs_bar, tab.id, part, cx);
tabs.push(self.with_composite_drop(item, tabs_bar, tab.id, part, cx).into_any_element());
}
@@ -540,7 +547,7 @@ impl Workbench {
fn pane_composite_title(&self, part: Part, tabs: Vec<AnyElement>, view_actions: Option<(&'static str, AnyElement)>, actions: Vec<GlobalAction>, drop_feedback: bool, cx: &mut Context<Self>) -> Div {
let [tabs_bar, global_bar] = title_bars(part);
let foreground = self.color("icon.foreground");
- let bottom_line = div().absolute().bottom_0().left_0().right_0().h(px(1.)).bg(self.color("surface.border"));
+ let bottom_line = div().absolute().bottom_0().left_0().right_0().h(px(1.)).bg(self.connected_pane_tab_border());
let bar = self.composite_bar(part);
let background = if drop_feedback { self.color("editorGroup.dropBackground") } else { self.tab_strip_background() };
div()
@@ -576,9 +583,12 @@ impl Workbench {
/// A composite bar tab (`.action-item` with 16px padding); the checked one is the part's own fill, connected to
/// the content. Its width is the fractional one Chromium lays out: GPUI rounds a text element's width up, which
/// made the Problems tab with its badge 2px wider than the reference's.
- fn panel_tab(&self, view: &CompositeTab, active: bool, first: bool, background: &str, window: &Window, cx: &mut Context<Self>) -> Stateful<Div> {
+ fn panel_tab(&self, view: &CompositeTab, active: bool, first: bool, divider: bool, background: &str, window: &Window, cx: &mut Context<Self>) -> Stateful<Div> {
let foreground = if active { self.foreground_or("panelTitle.activeForeground") } else { self.foreground_or("panelTitle.inactiveForeground") };
let id = view.id;
+ let hover_group = SharedString::from(format!("panel-tab-{id}"));
+ // tabs.css `text-transform: none !important` on panel tabs; only the uppercase setting changes them.
+ let label = self.view_header_text(view.title, true);
let dragged = DraggedComposite { id, label: view.title.into(), icon: None, foreground, background: self.color(background) };
let status_badge = self.tab_status_badge(view).and_then(|content| {
let foreground = self.foreground_or("activityBarBadge.foreground");
@@ -623,11 +633,13 @@ impl Workbench {
.items_center()
.cursor_pointer()
.text_color(foreground)
- // connectedPaneTabs.css: the checked tab's indicator starts at `top: -strokeWidth`, its top stroke on the card's.
- .when(active, |tab| tab.debug_selector(|| "active-composite-tab".into()).mt(px(-1.)).h(px(TITLE_HEIGHT + 1.)).bg(self.color(background)).rounded_tr(px(7.)).border_t_1().border_r_1().border_color(self.color("surface.border")))
- // connectedPaneTabs.css: the first tab's top left corner is the part's, square in compact density.
- .when(active && !(first && self.compact_density()), |tab| tab.rounded_tl(px(7.)))
- .child(div().flex_none().w(px(text_width(view.title, 13., window))).whitespace_nowrap().line_height(px(24.)).child(view.title))
+ .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| {
+ 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))
.children(status_badge)
.children(badge)
.child(self.panel_tab_hover(view, window))
@@ -643,6 +655,60 @@ impl Workbench {
}))
}
+ /// connectedPaneTabs.css `--modern-ui-connected-tab-border`: `modernPanel.border`, `contrastBorder` in high contrast.
+ pub(super) fn connected_pane_tab_border(&self) -> Rgba {
+ match self.theme.kind {
+ ThemeKind::HighContrastDark | ThemeKind::HighContrastLight => self.color("contrastBorder"),
+ _ => self.color("modernPanel.border"),
+ }
+ }
+
+ /// modernUI tabs.css: a hovered inactive tab's `.active-item-indicator`, 24px high and inset 2px at the sides, in
+ /// modernTab.hoverBackground; a dashed contrastActiveBorder outline in high contrast. An icon tab's is 24px square
+ /// and centered (connectedPaneTabs.css).
+ pub(super) fn inactive_pane_tab_hover(&self, group: &SharedString, icon: bool) -> Div {
+ let indicator = div().absolute().top(px((TITLE_HEIGHT - 24.) / 2.)).h(px(24.)).rounded(px(4.));
+ let indicator = if icon { indicator.left(px((ICON_TAB_WIDTH - 24.) / 2.)).w(px(24.)) } else { indicator.left(px(2.)).right(px(2.)) };
+ if self.theme.kind.is_high_contrast() {
+ let border = self.color("contrastActiveBorder");
+ return indicator.border_1().border_dashed().border_color(gpui::transparent_black()).group_hover(group.clone(), move |indicator| indicator.border_color(border));
+ }
+ let background = self.color("modernTab.hoverBackground");
+ indicator.group_hover(group.clone(), move |indicator| indicator.bg(background))
+ }
+
+ /// connectedPaneTabs.css: the checked tab's `.active-item-indicator` from `top: -strokeWidth` with its
+ /// `.tab-connected-edge` and the 7px shoulders curving into the strip's bottom line. The first tab meets the part's
+ /// corner: no left edge or shoulder, its outer left corner square in compact density. A footer's tab opens upward
+ /// (`.footer`, `scaleY(-1)`).
+ pub(super) fn connected_pane_tab_fill(&self, first: bool, footer: bool, background: &str) -> Div {
+ let surface = self.color(background);
+ let border = self.connected_pane_tab_border();
+ let radius = px(7.);
+ let fill = div().absolute().left_0().right_0().bg(surface).border_r_1().border_color(border).when(!first, |fill| fill.border_l_1());
+ let round_left = !(first && self.compact_density());
+ let fill = match footer {
+ false => fill.top(px(-1.)).bottom_0().border_t_1().rounded_tr(radius).when(round_left, |fill| fill.rounded_tl(radius)),
+ true => fill.top_0().bottom(px(-1.)).border_b_1().rounded_br(radius).when(round_left, |fill| fill.rounded_bl(radius)),
+ };
+ let shoulder = |piece: Div| match footer {
+ false => piece.absolute().bottom_0().size(radius).bg(surface),
+ true => piece.absolute().top_0().size(radius).bg(surface),
+ };
+ let strip_corner = || match footer {
+ false => div().size_full().bg(self.tab_strip_background()).border_b_1().border_color(border),
+ true => div().size_full().bg(self.tab_strip_background()).border_t_1().border_color(border),
+ };
+ let left_corner = if footer { strip_corner().border_r_1().rounded_tr(radius) } else { strip_corner().border_r_1().rounded_br(radius) };
+ let right_corner = if footer { strip_corner().border_l_1().rounded_tl(radius) } else { strip_corner().border_l_1().rounded_bl(radius) };
+ div()
+ .absolute()
+ .inset_0()
+ .child(fill.debug_selector(|| "active-composite-tab".into()))
+ .when(!first, |tab| tab.child(shoulder(div().left(-radius)).child(left_corner)))
+ .child(shoulder(div().right(-radius)).child(right_corner))
+ }
+
/// compositeBarActions.ts `computeTitle`: the name and the keybinding of the open command of the container's
/// first view that has one (viewContainerModel.ts `keybindingId`), above a bottom panel, else below.
fn panel_tab_hover(&self, tab: &CompositeTab, window: &Window) -> impl IntoElement {
@@ -846,7 +912,7 @@ fn panel_tab_width(view: &CompositeTab, workbench: &Workbench, window: &Window)
Some(_) => 18.,
None => workbench.painted_tab_badge(view).map_or(0., |badge| 2. + badge_width(text_width(&badge.number.to_string(), 10., window))),
};
- 32. + text_width(view.title, 13., window) + badge
+ 32. + text_width(&workbench.view_header_text(view.title, true), 13., window) + badge
}
/// `.badge-content`: `min-width: 16px` around the text and its 5px side padding.
diff --git a/native/crates/app/src/workbench/part_grid.rs b/native/crates/app/src/workbench/part_grid.rs
index 8e6f9ec0841..22405fc7e2f 100644
--- a/native/crates/app/src/workbench/part_grid.rs
+++ b/native/crates/app/src/workbench/part_grid.rs
@@ -440,6 +440,16 @@ impl Workbench {
if self.compact_density() { (2., 4.) } else { (3., 5.) }
}
+ /// A label's (margin, padding) on each side: statusbarpart.css and modernUI statusBar.css drop the margins of the
+ /// first left or last right entry (`edge`, 6px padding) and of an entry with a background (8px); 4px in compact density.
+ pub(super) fn status_label_spacing(&self, background: bool, edge: bool) -> (f32, f32) {
+ if !edge && !background {
+ return self.status_item_spacing();
+ }
+ let padding = if self.compact_density() { 4. } else if edge { 6. } else { 8. };
+ (0., padding)
+ }
+
/// Forgets the laid out grid so the next render reads the folder's stored layout.
pub(super) fn reset_part_grid(&mut self) {
self.part_grid.grid = None;
@@ -579,13 +589,13 @@ impl Workbench {
}));
}
- /// partGrid.css `.part-grid-gap-sash::after`: three 2px dots 4px apart across the sash's middle, hidden while
- /// the sash highlights or the grippers receded.
+ /// partGrid.css `.part-grid-gap-sash::after`: three 2px dots across the sash's middle, 5px apart by modernUI
+ /// sashHandles.css's more specific `:not(.disabled)` rule, hidden while the sash highlights or the grippers receded.
fn sash_gripper(&self, vertical: bool, width: f32, height: f32) -> Div {
let color = self.color("modernSash.gripForeground");
let (cx, cy) = (width / 2., height / 2.);
let dot = |dx: f32, dy: f32| div().absolute().left(px(cx + dx - 1.)).top(px(cy + dy - 1.)).size(px(2.)).rounded_full().bg(color);
- let offsets = [-4., 0., 4.];
+ let offsets = [-5., 0., 5.];
div().absolute().inset_0().children(offsets.map(|offset| if vertical { dot(0., offset) } else { dot(offset, 0.) }))
}
@@ -611,7 +621,7 @@ impl Workbench {
.h(px(height))
// sashHandles.css: compact cards meet edge to edge, without grips.
.when(!active && !compact && !self.part_grid.grippers_hidden, |element| element.child(self.sash_gripper(vertical, width, height)))
- .when(active, |sash| sash.child(div().absolute().top_0().left_0().right_0().bottom(px(highlight_inset)).bg(hover_border)));
+ .when(active, |sash| sash.child(div().absolute().top_0().left_0().right_0().bottom(px(highlight_inset)).rounded(px(self.sash_hover_size() / 2.)).bg(hover_border)));
let cursor = match (vertical, state) {
(true, SashState::AtMinimum) => CursorStyle::ResizeRight,
(true, SashState::AtMaximum) => CursorStyle::ResizeLeft,
diff --git a/native/crates/app/src/workbench/part_view.rs b/native/crates/app/src/workbench/part_view.rs
index a3d52b4c0f5..7f22e3ae825 100644
--- a/native/crates/app/src/workbench/part_view.rs
+++ b/native/crates/app/src/workbench/part_view.rs
@@ -101,7 +101,7 @@ impl Workbench {
}
CachedPart::StatusBar => {
let main_group = self.part_active_group(super::editor_groups::MAIN_PART).expect("the main part has a group");
- self.with_group(main_group, |workbench| workbench.status_bar(window, cx))
+ self.with_group(main_group, |workbench| workbench.status_bar(window, cx)).w_full()
}
_ => unreachable!("{part:?} is drawn by the workbench"),
};
diff --git a/native/crates/app/src/workbench/quick_input_view.rs b/native/crates/app/src/workbench/quick_input_view.rs
index 127eef25df4..27a099111ee 100644
--- a/native/crates/app/src/workbench/quick_input_view.rs
+++ b/native/crates/app/src/workbench/quick_input_view.rs
@@ -431,22 +431,38 @@ impl Workbench {
}
/// The `::before` layer of frostedGlass.css: the surface color at `frosted_glass_opacity` over a 12px blur of what
- /// is behind it, inside a 1px border with `radius` corners.
+ /// is behind it, inside a 1px border with `radius` corners. Without glass the solid surface color.
pub(super) fn frosted_glass(&self, surface: &str, radius: f32) -> impl IntoElement {
let mut color = self.color(surface);
- color.a *= self.frosted_glass_opacity();
+ let glass = self.frosted_glass_enabled();
+ if glass {
+ color.a *= self.frosted_glass_opacity();
+ }
canvas(
|_, _, _| (),
move |bounds, _, window, _| {
// Inside the 1px border, so the corners follow the padding box.
let radii = gpui::Corners::all(px(radius - 1.));
- window.paint_backdrop_blur(bounds, radii, px(12.), color);
+ match glass {
+ true => window.paint_backdrop_blur(bounds, radii, px(12.), color),
+ false => window.paint_quad(gpui::fill(bounds, color).corner_radii(radii)),
+ }
},
)
.absolute()
.inset_0()
}
+ /// frostedGlass.contribution.ts `update`: `workbench.modernUIFrostedGlass` on, transparency not reduced
+ /// (`workbench.reduceTransparency` on, or the macOS setting frostedGlass.css's `prefers-reduced-transparency`
+ /// reads whatever the setting says) and no high contrast theme.
+ pub(super) fn frosted_glass_enabled(&self) -> bool {
+ self.setting("workbench.modernUIFrostedGlass") != false
+ && self.setting("workbench.reduceTransparency") != "on"
+ && !system_reduces_transparency()
+ && !self.theme.kind.is_high_contrast()
+ }
+
/// frostedGlass.contribution.ts `getOpacity`: `workbench.modernUIFrostedGlassOpacity` percent, 80 by default,
/// clamped to 50..100.
pub(super) fn frosted_glass_opacity(&self) -> f32 {
@@ -938,8 +954,8 @@ impl Workbench {
// its focused row 1px solid list.focusOutline, inside the row.
let list_focused = input.hide_input && self.quick_inputs.focus.is_focused(window);
let outline = match list_focused {
- true => self.theme.color("list.focusOutline").filter(|_| focused).map(|color| div().absolute().inset_0().rounded(px(3.)).border_1().border_color(color)),
- false => self.theme.color("contrastActiveBorder").filter(|_| focused).map(|color| div().absolute().inset_0().rounded(px(3.)).border_1().border_dashed().border_color(color)),
+ true => self.theme.color("list.focusOutline").filter(|_| focused).map(|color| div().absolute().inset_0().rounded(px(4.)).border_1().border_color(color)),
+ false => self.theme.color("contrastActiveBorder").filter(|_| focused).map(|color| div().absolute().inset_0().rounded(px(4.)).border_1().border_dashed().border_color(color)),
};
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.
@@ -948,8 +964,9 @@ impl Workbench {
.id(("quick-input-row", row_index))
.relative()
.h(px(item_height(row)))
+ // modernUI roundedCorners.css: list rows 4px, over quickInput.css's 3px.
.cursor_pointer()
- .rounded(px(3.))
+ .rounded(px(4.))
.when_some(background, |row, background| row.bg(background))
.when_some(foreground, |row, color| row.text_color(color))
.child(entry)
@@ -1202,5 +1219,14 @@ pub(super) fn icon_at(chars: &[char]) -> Option<(String, usize)> {
valid.then(|| (name.to_owned(), close + 1))
}
+/// Chromium's `prefers-reduced-transparency: reduce`: the macOS Reduce Transparency setting, read on each call.
+fn system_reduces_transparency() -> bool {
+ #[cfg(target_os = "macos")]
+ return objc2_app_kit::NSWorkspace::sharedWorkspace().accessibilityDisplayShouldReduceTransparency();
+ // shortcut: the Linux desktop's reduced transparency is not read; read it when a Linux user needs it.
+ #[cfg(target_os = "linux")]
+ return false;
+}
+
#[cfg(test)]
mod tests;
diff --git a/native/crates/app/src/workbench/scm_graph_view.rs b/native/crates/app/src/workbench/scm_graph_view.rs
index 90e8296b0de..44f25cbd0a4 100644
--- a/native/crates/app/src/workbench/scm_graph_view.rs
+++ b/native/crates/app/src/workbench/scm_graph_view.rs
@@ -174,7 +174,7 @@ impl Workbench {
.mx(px(6.))
.px(px(4.))
.py(px(2.))
- .rounded(px(2.))
+ .rounded(px(4.))
.when_some(self.theme.color("contrastBorder"), |badge, border| badge.border_1().border_color(border))
.text_size(px(11.))
.font_weight(gpui::FontWeight::NORMAL)
diff --git a/native/crates/app/src/workbench/scm_view.rs b/native/crates/app/src/workbench/scm_view.rs
index 72426a8f1b6..849d8988550 100644
--- a/native/crates/app/src/workbench/scm_view.rs
+++ b/native/crates/app/src/workbench/scm_view.rs
@@ -908,12 +908,15 @@ impl Workbench {
false if provider.input.value.is_empty() => div().whitespace_nowrap().overflow_hidden().text_color(self.color("input.placeholderForeground")).child(look.placeholder.unwrap_or_default()).into_any_element(),
false => div().whitespace_nowrap().overflow_hidden().child(provider.input.value.lines().next().unwrap_or_default().to_string()).into_any_element(),
};
+ // modernUI roundedCorners.css: 4px when the SCM view sits in the panel.
+ let container = self.movable_view(SCM_CHANGES_VIEW).map_or(PaneContainer::Scm.container_id(), |view| self.view_container(&view));
+ let in_panel = self.container_location(container) == super::layout::Part::Panel;
let field = div()
.h(px(26.))
.px(px(6.))
.flex()
.items_center()
- .rounded(px(2.))
+ .rounded(px(if in_panel { 4. } else { 2. }))
.bg(self.color("input.background"))
.text_color(self.color("input.foreground"))
.border_1()
@@ -995,7 +998,8 @@ impl Workbench {
let foreground = self.foreground_or("sideBar.foreground");
let collapsed = self.scm.collapsed.contains(&(provider.handle, group.handle));
let context = self.scm_context(provider, Some(group), None, window);
- let actions = self.inline_actions(MenuId::ScmResourceGroupContext, None, &context, vec![Self::group_arg(provider, group)], foreground, cx);
+ // modernUI padding.css: 2px between a row's inline actions.
+ let actions = self.inline_actions(MenuId::ScmResourceGroupContext, None, &context, vec![Self::group_arg(provider, group)], foreground, cx).gap(px(2.));
let key = (provider.handle, group.handle);
let selected = self.scm.selected == Some((provider.handle, group.handle, None));
// countBadge.css under fontRamp.css: 19px high and wide at least, 10px text, 6px after the actions.
@@ -1067,7 +1071,7 @@ impl Workbench {
};
let context = self.scm_context(provider, Some(group), Some(resource), window);
let args = vec![Self::resource_arg(provider, group, resource)];
- let actions = self.inline_actions(MenuId::ScmResourceStateContext, None, &context, args.clone(), foreground, cx);
+ let actions = self.inline_actions(MenuId::ScmResourceStateContext, None, &context, args.clone(), foreground, cx).gap(px(2.));
let decoration = self.file_decoration(&path, false);
// labels.ts titles the label with its path, then the decoration's tooltip.
let title = match decoration.as_ref().and_then(|decoration| decoration.tooltip.as_deref()) {
diff --git a/native/crates/app/src/workbench/settings_editor_view.rs b/native/crates/app/src/workbench/settings_editor_view.rs
index 3df632e4204..d37168e989c 100644
--- a/native/crates/app/src/workbench/settings_editor_view.rs
+++ b/native/crates/app/src/workbench/settings_editor_view.rs
@@ -964,7 +964,7 @@ impl Workbench {
.flex()
.items_center()
.when_some(count, |widgets, count| {
- widgets.child(div().mr(px(3.)).px(px(3.)).pt(px(2.)).pb(px(3.)).rounded(px(2.)).text_size(px(11.)).text_color(self.color("descriptionForeground")).child(count))
+ widgets.child(div().mr(px(3.)).px(px(3.)).pt(px(2.)).pb(px(3.)).rounded(px(4.)).text_size(px(11.)).text_color(self.color("descriptionForeground")).child(count))
})
.child(clear)
.child(filter);
@@ -1713,7 +1713,7 @@ impl Workbench {
.px(px(6.))
.flex()
.items_center()
- .rounded(px(2.))
+ .rounded(px(4.))
.border_1()
.border_color(border)
.bg(self.color(background))
diff --git a/native/crates/app/src/workbench/settings_editor_view/list_widget.rs b/native/crates/app/src/workbench/settings_editor_view/list_widget.rs
index e7f381c2340..4ece8120770 100644
--- a/native/crates/app/src/workbench/settings_editor_view/list_widget.rs
+++ b/native/crates/app/src/workbench/settings_editor_view/list_widget.rs
@@ -359,7 +359,7 @@ impl Workbench {
.px(px(4.))
.flex()
.items_center()
- .rounded(px(2.))
+ .rounded(px(4.))
.border_1()
.border_color(border)
.bg(self.color("settings.textInputBackground"))
diff --git a/native/crates/app/src/workbench/side_bar.rs b/native/crates/app/src/workbench/side_bar.rs
index aeffbfef1bf..7dfe0b42b17 100644
--- a/native/crates/app/src/workbench/side_bar.rs
+++ b/native/crates/app/src/workbench/side_bar.rs
@@ -62,22 +62,34 @@ impl Workbench {
let hover = HoverOptions::composite_bar(if footer { HoverPosition::Above } else { HoverPosition::Below });
let unpinned = self.unpinned_containers(super::layout::Part::SideBar);
let containers = self.activity_bar_containers().into_iter().filter(|(command, _)| !unpinned.iter().any(|id| id == command));
- let tabs: Vec<_> = containers.map(|(command, title)| {
+ let hover_group = SharedString::from(super::ACTIVITY_ITEM_GROUP);
+ let tabs: Vec<_> = containers.enumerate().map(|(index, (command, title))| {
let view = self.compact_activity_view(command);
let active = view == self.side_bar_view;
let color = if active { self.color("activityBarTop.foreground") } else { self.color("activityBarTop.inactiveForeground") };
- let tab = self.action_bar_item(COMPACT_ACTIVITY_BAR, command, self.compact_activity_icon(command, color).h(px(32.)).id(command), cx);
+ let hover_color = if active { color } else { self.foreground_or("modernTab.hoverForeground") };
+ let tab = div()
+ .id(command)
+ .relative()
+ .h(px(32.))
+ .when(active, |tab| tab.child(self.connected_pane_tab_fill(index == 0, footer, "sideBar.background")))
+ .when(!active, |tab| tab.child(self.inactive_pane_tab_hover(&hover_group, true)))
+ .child(self.compact_activity_icon(command, color, hover_color));
+ let tab = self.action_bar_item(COMPACT_ACTIVITY_BAR, command, tab, cx);
self.activity_composite_item(tab, COMPACT_ACTIVITY_BAR, command, title, self.compact_activity_drag_icon(command), active, cx)
.debug_selector(move || command.to_owned())
.cursor_pointer()
- .when(active, |tab| tab.bg(self.color("sideBar.background")).when(footer, |tab| tab.rounded_b(px(7.))).when(!footer, |tab| tab.rounded_t(px(7.))))
.child(self.action_hover(title, command, hover))
.on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| match view {
SideBarView::Generated(id) => workbench.generated_activity_item_clicked(active, id, event, cx),
_ => workbench.activity_item_clicked(active, command, event, window, cx),
}))
}).collect();
- self.action_bar(COMPACT_ACTIVITY_BAR, false, div().h(px(32.)).flex_none().flex().bg(self.tab_strip_background()), cx).children(tabs)
+ // connectedPaneTabs.css: the strip's line under a header, over a footer; padding.css: 2px between the tabs.
+ let line = div().absolute().left_0().right_0().h(px(1.)).bg(self.connected_pane_tab_border());
+ let line = if footer { line.top_0() } else { line.bottom_0() };
+ let strip = div().relative().h(px(32.)).flex_none().flex().gap(px(2.)).bg(self.tab_strip_background()).child(line);
+ self.action_bar(COMPACT_ACTIVITY_BAR, false, strip, cx).children(tabs)
}
/// `compact_activity_icon`'s glyph as a drag image.
@@ -108,18 +120,19 @@ impl Workbench {
}
/// An `activity_bar_containers` entry's 16px icon: the compact bar's codicon of a built-in container, else the
- /// icon its activity bar item shows.
- fn compact_activity_icon(&self, container: &'static str, color: Rgba) -> Div {
+ /// icon its activity bar item shows; `hover` while its item is hovered.
+ fn compact_activity_icon(&self, container: &'static str, color: Rgba, hover: Rgba) -> Div {
+ let style = move |icon: gpui::Svg| icon.text_color(color).group_hover(super::ACTIVITY_ITEM_GROUP, move |icon| icon.text_color(hover));
if let Some((_, icon, ..)) = VIEW_CONTAINERS.into_iter().find(|(_, _, _, command, _)| *command == container) {
- return self.icon(icon, 36., 16., color);
+ return self.styled_icon(icon, 36., 16., style);
}
match self.compact_activity_view(container) {
- SideBarView::Testing => self.icon("beaker", 36., 16., color),
+ SideBarView::Testing => self.styled_icon("beaker", 36., 16., style),
SideBarView::Contributed(id) => match &self.tree_views.containers.iter().find(|contributed| contributed.id == id).expect("a contributed container").icon {
- ContainerIcon::Codicon(name) => self.icon(name, 36., 16., color),
- ContainerIcon::File(path) => div().w(px(36.)).flex().items_center().justify_center().child(svg().external_path(path.to_string_lossy().into_owned()).size(px(16.)).text_color(color)),
+ ContainerIcon::Codicon(name) => self.styled_icon(name, 36., 16., style),
+ ContainerIcon::File(path) => div().w(px(36.)).flex().items_center().justify_center().child(style(svg().external_path(path.to_string_lossy().into_owned()).size(px(16.)))),
},
- _ => self.icon(self.generated_container_view(container).expect("a container with a view").icon, 36., 16., color),
+ _ => self.styled_icon(self.generated_container_view(container).expect("a container with a view").icon, 36., 16., style),
}
}
diff --git a/native/crates/app/src/workbench/side_by_side_editor.rs b/native/crates/app/src/workbench/side_by_side_editor.rs
index 765d52c1982..2d217c3430d 100644
--- a/native/crates/app/src/workbench/side_by_side_editor.rs
+++ b/native/crates/app/src/workbench/side_by_side_editor.rs
@@ -186,7 +186,7 @@ impl Workbench {
true => sash.left_0().right_0().top(gpui::relative(ratio)).mt(px(-size / 2.)).h(px(size)),
false => sash.top_0().bottom_0().left(gpui::relative(ratio)).ml(px(-size / 2.)).w(px(size)),
};
- let highlight = div().absolute().bg(hover_border);
+ let highlight = div().absolute().rounded(px(hover / 2.)).bg(hover_border);
let highlight = match vertical {
true => highlight.left_0().right_0().top(px((size - hover) / 2.)).h(px(hover)),
false => highlight.top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)),
diff --git a/native/crates/app/src/workbench/status_entries.rs b/native/crates/app/src/workbench/status_entries.rs
index 786ea75d593..fecece28fc8 100644
--- a/native/crates/app/src/workbench/status_entries.rs
+++ b/native/crates/app/src/workbench/status_entries.rs
@@ -37,15 +37,28 @@ pub(super) struct DrawnStatusEntry {
impl Workbench {
/// The entries of one side whose priority `keep` accepts, in statusbarModel.ts order.
- pub(super) fn extension_status_items(&self, left: bool, keep: impl Fn(f64) -> bool, foreground: Rgba, cx: &mut Context<Self>) -> Div {
- let mut items = div().h_full().flex();
- for entry in self.status_entries.iter().filter(|entry| entry.align_left == left && keep(entry.priority)) {
- items = items.children(self.status_bar_extension_entry(entry, foreground, cx));
+ pub(super) fn extension_status_items(&self, left: bool, keep: impl Fn(f64) -> bool, foreground: Rgba, cx: &mut Context<Self>) -> Vec<(bool, AnyElement)> {
+ let entries = self.status_entries.iter().filter(|entry| entry.align_left == left && keep(entry.priority));
+ entries.filter_map(|entry| self.status_bar_extension_entry(entry, foreground, cx)).collect()
+ }
+
+ /// One status bar side: statusbarPart.ts `updateVisibleBackgroundColorNeighbors` puts 4px (2px in compact density)
+ /// between two adjacent drawn entries with backgrounds.
+ pub(super) fn status_bar_side(&self, items: Vec<(bool, AnyElement)>) -> Div {
+ let gap = if self.compact_density() { 2. } else { 4. };
+ let mut side = div().h_full().flex();
+ let mut previous_background = false;
+ for (background, item) in items {
+ if background && previous_background {
+ side = side.child(div().w(px(gap)).flex_none());
+ }
+ side = side.child(item);
+ previous_background = background;
}
- items
+ side
}
- pub(super) fn extension_status_item(&self, entry: &StatusEntry, foreground: Rgba, cx: &mut Context<Self>) -> Stateful<Div> {
+ pub(super) fn extension_status_item(&self, entry: &StatusEntry, first_visible: bool, foreground: Rgba, cx: &mut Context<Self>) -> Stateful<Div> {
let own_color = entry.kind.is_none().then(|| entry.color.as_ref().and_then(|color| self.entry_color(color))).flatten();
let (color, background) = match entry.kind {
Some(kind) => (self.color(&format!("statusBarItem.{kind}Foreground")), self.theme.color(&format!("statusBarItem.{kind}Background"))),
@@ -72,7 +85,7 @@ impl Workbench {
}
let label = label.when_some(own_color, |label, color| label.text_color(color));
let command = entry.command.clone();
- let (margin, padding) = self.status_item_spacing();
+ let (margin, padding) = self.status_label_spacing(has_background(entry), first_visible);
let item = div()
.id(gpui::SharedString::from(format!("status-entry-{}", entry.entry_id)))
.relative()
@@ -143,13 +156,14 @@ impl Workbench {
label
}
- pub(super) fn status_bar_extension_entry(&self, entry: &StatusEntry, foreground: Rgba, cx: &mut Context<Self>) -> Option<AnyElement> {
- self.status_bar_entry(&entry.id, &entry.name, entry.extension_id.as_deref(), self.extension_status_item(entry, foreground, cx), cx)
+ pub(super) fn status_bar_extension_entry(&self, entry: &StatusEntry, foreground: Rgba, cx: &mut Context<Self>) -> Option<(bool, AnyElement)> {
+ let item = self.extension_status_item(entry, false, foreground, cx);
+ self.status_bar_entry(&entry.id, &entry.name, entry.extension_id.as_deref(), has_background(entry), item, cx)
}
/// statusbarModel.ts: the entry is listed in the context menu, not drawn while hidden, and its right click shows the
- /// menu with Hide.
- pub(super) fn status_bar_entry(&self, id: &str, name: &str, extension_id: Option<&str>, element: impl IntoElement, cx: &mut Context<Self>) -> Option<AnyElement> {
+ /// menu with Hide. Returns whether it paints a background (`has-background-color`) with the element.
+ pub(super) fn status_bar_entry(&self, id: &str, name: &str, extension_id: Option<&str>, background: bool, element: impl IntoElement, cx: &mut Context<Self>) -> Option<(bool, AnyElement)> {
let entry = DrawnStatusEntry { id: id.to_owned(), name: name.to_owned(), extension_id: extension_id.map(str::to_owned) };
self.drawn_status_entries.borrow_mut().push(entry.clone());
if self.hidden_status_entries().iter().any(|hidden| hidden == id) {
@@ -161,7 +175,7 @@ impl Workbench {
let focus = self.status_entry_focus.clone();
let focus_id = id.to_owned();
let status_bar_focus = self.status_bar_focus.clone();
- let label_left = px(self.status_item_spacing().0);
+ let label_left = px(self.status_label_spacing(background, false).0);
let border = self.theme.color("focusBorder");
let item = div()
.debug_selector(move || selector)
@@ -182,7 +196,7 @@ impl Workbench {
window.paint_quad(outline(label, border, BorderStyle::Solid));
}
}).absolute().size_full());
- Some(item.into_any_element())
+ Some((background, item.into_any_element()))
}
/// statusbarPart.ts `getContextMenuActions`: Hide Status Bar, one toggle per entry id, then for the entry under the
@@ -306,6 +320,11 @@ impl Workbench {
}
}
+/// statusbarItem.ts: `has-background-color` for an own background or a kind other than standard.
+pub(super) fn has_background(entry: &StatusEntry) -> bool {
+ entry.background_color.is_some() || entry.kind.is_some()
+}
+
fn status_item_hover_key(kind: Option<&str>, part: &str) -> String {
match kind {
Some(kind) => format!("statusBarItem.{kind}Hover{part}"),
@@ -417,4 +436,41 @@ mod tests {
let stored = workbench.read_with(cx, |workbench, _| workbench.profile_storage.lock().unwrap().get("workbench.statusbar.hidden").map(str::to_owned));
assert_eq!(stored, None, "showing the last hidden entry removes the key");
}
+
+ /// statusbarPart.ts `updateVisibleBackgroundColorNeighbors`: modernUI statusBar.css's 4px between two adjacent
+ /// entries with backgrounds, none after a plain one.
+ #[gpui::test]
+ fn adjacent_entries_with_backgrounds_get_a_gap(cx: &mut TestAppContext) {
+ 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 entry = |id: &str, kind, priority| StatusEntry {
+ entry_id: id.into(),
+ extension_id: Some("pub.ext".into()),
+ id: id.into(),
+ name: id.into(),
+ text: id.into(),
+ tooltip: None,
+ command: None,
+ color: None,
+ background_color: None,
+ kind,
+ align_left: true,
+ priority,
+ secondary: 0,
+ show_progress: false,
+ };
+ let (_workbench, cx) = cx.add_window_view(|_, cx| {
+ let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);
+ workbench.status_entries.extend([entry("warning", Some("warning"), 9.), entry("error", Some("error"), 8.), entry("plain", None, 7.)]);
+ workbench
+ });
+ cx.run_until_parked();
+ cx.update(|window, cx| drop(window.draw(cx)));
+ let warning = cx.debug_bounds("status-bar-entry-warning").expect("the entry is drawn");
+ let error = cx.debug_bounds("status-bar-entry-error").expect("the entry is drawn");
+ let plain = cx.debug_bounds("status-bar-entry-plain").expect("the entry is drawn");
+ assert_eq!(error.left() - warning.right(), gpui::px(4.));
+ assert_eq!(plain.left() - error.right(), gpui::px(0.));
+ }
}
diff --git a/native/crates/app/src/workbench/suggest_widget.rs b/native/crates/app/src/workbench/suggest_widget.rs
index c141a09d74f..bcef1ae54c6 100644
--- a/native/crates/app/src/workbench/suggest_widget.rs
+++ b/native/crates/app/src/workbench/suggest_widget.rs
@@ -427,7 +427,7 @@ impl Workbench {
let text = if state == State::Loading { "Loading..." } else { "No suggestions." };
widget = widget.flex_row().items_center().child(div().pl(px(22.)).child(text));
} else {
- widget = widget.child(self.suggest_rows(height - 2. - status_bar_height, cx));
+ widget = widget.child(self.suggest_rows(height - 2. - status_bar_height, status_bar_height > 0., cx));
if status_bar_height > 0. {
widget = widget.child(self.suggest_status_bar(item_height, window, cx));
}
@@ -782,7 +782,7 @@ impl Workbench {
.child(right)
}
- fn suggest_rows(&self, height: f32, cx: &mut Context<Self>) -> impl IntoElement {
+ fn suggest_rows(&self, height: f32, with_status_bar: bool, cx: &mut Context<Self>) -> impl IntoElement {
let item_height = LINE_HEIGHT;
let visible = ((height / item_height).floor() as usize).max(1);
let (top, focused) = (self.suggest.widget.top, self.suggest.widget.focused);
@@ -807,8 +807,8 @@ impl Workbench {
let index = top + offset;
let row = self.suggest_row(&item, index, focused == Some(index), frozen, cx);
// roundedCorners.css: rows are 4px; suggestWidget.css clips the list to the widget's 8px inner corners, which
- // GPUI cannot, so the first and last rows take them.
- list = list.child(row.rounded(px(4.)).when(offset == 0, |row| row.rounded_t(px(RADIUS))).when(offset + 1 == shown, |row| row.rounded_b(px(RADIUS))));
+ // GPUI cannot, so the first and last rows take them; the last row keeps 4px above the status bar.
+ list = list.child(row.rounded(px(4.)).when(offset == 0, |row| row.rounded_t(px(RADIUS))).when(offset + 1 == shown && !with_status_bar, |row| row.rounded_b(px(RADIUS))));
}
list
}
diff --git a/native/crates/app/src/workbench/terminal_find.rs b/native/crates/app/src/workbench/terminal_find.rs
index 56baa8aeaba..702fd21e257 100644
--- a/native/crates/app/src/workbench/terminal_find.rs
+++ b/native/crates/app/src/workbench/terminal_find.rs
@@ -154,7 +154,7 @@ impl Workbench {
.pl(px(4.))
.pr(px(2.))
.border_1()
- .rounded(px(2.))
+ .rounded(px(4.))
.cursor_text()
.bg(self.color("input.background"))
.border_color(border)
diff --git a/native/crates/app/src/workbench/terminal_resize_overlay.rs b/native/crates/app/src/workbench/terminal_resize_overlay.rs
index cd39da812e3..6b383d829b8 100644
--- a/native/crates/app/src/workbench/terminal_resize_overlay.rs
+++ b/native/crates/app/src/workbench/terminal_resize_overlay.rs
@@ -4,7 +4,7 @@
use std::time::Duration;
use alacritty_terminal::grid::Dimensions;
-use gpui::{BoxShadow, Context, div, hsla, point, prelude::*, px};
+use gpui::{BoxShadow, Context, div, point, prelude::*, px, rgba};
use super::Workbench;
@@ -43,7 +43,8 @@ impl Workbench {
if *shown != id {
return None;
}
- let shadow = BoxShadow { color: hsla(0., 0., 0., 0.5), offset: point(px(0.), px(2.)), blur_radius: px(8.), spread_radius: px(0.), inset: false };
+ // modernUI shadows.css: --vscode-shadow-lg, a 12px blur; GPUI's blur_radius is the sigma, half the CSS blur.
+ let shadow = BoxShadow { color: rgba(0x00000024).into(), offset: point(px(0.), px(0.)), blur_radius: px(6.), spread_radius: px(0.), inset: false };
let high_contrast = self.theme.kind.is_high_contrast();
Some(
div().absolute().inset_0().flex().items_center().justify_center().child(
@@ -51,7 +52,8 @@ impl Workbench {
.debug_selector(|| "terminal-resize-overlay".into())
.px(px(10.))
.py(px(4.))
- .rounded(px(4.))
+ // modernUI roundedCorners.css: cornerRadius-large.
+ .rounded(px(8.))
.bg(self.color("editorWidget.background"))
.text_color(self.color("editorWidget.foreground"))
.border_1()
diff --git a/native/crates/app/src/workbench/timeline_view.rs b/native/crates/app/src/workbench/timeline_view.rs
index 30ac175a785..a72fd98d0ec 100644
--- a/native/crates/app/src/workbench/timeline_view.rs
+++ b/native/crates/app/src/workbench/timeline_view.rs
@@ -756,7 +756,7 @@ impl Workbench {
let bounds = self.timeline.toolbar_bounds.clone();
let tracker = canvas(move |painted, _, _| bounds.borrow_mut().insert(index, painted), |_, _, _, _| {}).absolute().size_full();
let focused = toolbar_focused && index == self.timeline.toolbar_index;
- bar = bar.child(item.relative().child(tracker).when(focused, |item| item.child(div().absolute().inset_0().rounded(px(5.)).border_1().border_color(self.color("focusBorder")))));
+ bar = bar.child(item.relative().child(tracker).when(focused, |item| item.child(div().absolute().inset_0().rounded(px(4.)).border_1().border_color(self.color("focusBorder")))));
}
bar
}
diff --git a/native/crates/app/src/workbench/view_containers.rs b/native/crates/app/src/workbench/view_containers.rs
index 40ae3007254..9e70775d7a9 100644
--- a/native/crates/app/src/workbench/view_containers.rs
+++ b/native/crates/app/src/workbench/view_containers.rs
@@ -320,7 +320,7 @@ impl Workbench {
let active = self.side_bar_view == SideBarView::Contributed(id) && self.is_part_visible(Part::SideBar);
let icon = match (&container.icon, active) {
(ContainerIcon::Codicon(name), true) => self.active_view_icon(name),
- (ContainerIcon::Codicon(name), false) => self.icon(name, 36., 24., inactive),
+ (ContainerIcon::Codicon(name), false) => self.inactive_view_icon(name, inactive),
(ContainerIcon::File(path), _) => {
let color = if active { self.color("modernActivityBarItem.activeForeground") } else { inactive };
div().w(px(36.)).h(px(36.)).flex().items_center().justify_center().child(svg().external_path(path.to_string_lossy().into_owned()).size(px(24.)).text_color(color))
diff --git a/native/crates/app/src/workbench/view_locations.rs b/native/crates/app/src/workbench/view_locations.rs
index 96fec2ce77e..d56da95c729 100644
--- a/native/crates/app/src/workbench/view_locations.rs
+++ b/native/crates/app/src/workbench/view_locations.rs
@@ -395,7 +395,7 @@ impl Workbench {
for id in self.generated_containers_in(Part::SideBar).into_iter().filter(|id| !unpinned.iter().any(|other| other == id)) {
let view = self.generated_container_view(id).expect("a container with a view");
let active = self.side_bar_view == SideBarView::Generated(id) && self.is_part_visible(Part::SideBar);
- let icon = if active { self.active_view_icon(view.icon) } else { self.icon(view.icon, 36., 24., inactive) };
+ let icon = if active { self.active_view_icon(view.icon) } else { self.inactive_view_icon(view.icon, inactive) };
items.push((id, self.activity_composite_item(self.action_bar_item("activity", id, icon.id(id), cx), "activity", id, view.name, self.codicon_svg(view.icon), active, cx).relative().cursor_pointer().child(self.action_hover(view.name, id, hover)).on_click(cx.listener(move |workbench, event: &ClickEvent, _, cx| workbench.generated_activity_item_clicked(active, id, event, cx)))));
}
items
diff --git a/native/crates/app/src/workbench/view_panes.rs b/native/crates/app/src/workbench/view_panes.rs
index 5012a3da7f3..774db9ebef4 100644
--- a/native/crates/app/src/workbench/view_panes.rs
+++ b/native/crates/app/src/workbench/view_panes.rs
@@ -574,7 +574,8 @@ impl Workbench {
};
let more = (!pane.draws_more && self.has_view_toggle(container.key())).then(|| self.container_title_more(container, id, cx));
// paneviewlet.css: a merged view's progress bar sits 2px above its pane, over the title's bottom.
- let title = self.side_bar_title_text(title).children(self.scoped_progress_bar(id).map(|bar| bar.bottom_0())).when(id == FILE_VIEW, |title| title.child(self.explorer_title_actions(window, cx))).children(pane.actions.map(|actions| self.action_bar(id, false, div().flex().flex_none().child(actions), cx))).children(more);
+ // explorerView.ts `PRESERVE_MERGED_WORKSPACE_NAME_CASE_CLASS`: the folder's name keeps its case.
+ let title = self.side_bar_title_shared(self.view_header_text(&title, id == FILE_VIEW), false).children(self.scoped_progress_bar(id).map(|bar| bar.bottom_0())).when(id == FILE_VIEW, |title| title.child(self.explorer_title_actions(window, cx))).children(pane.actions.map(|actions| self.action_bar(id, false, div().flex().flex_none().child(actions), cx))).children(more);
let body = div().flex_1().min_h_0().flex().flex_col().child(pane.body);
return frame.child(title).child(body);
}
@@ -736,10 +737,16 @@ impl Workbench {
|| (id == OUTLINE_VIEW && self.outline_pane.focus.is_focused(window))
|| self.setting("workbench.view.alwaysShowHeaderActions") == json!(true);
let foreground = self.foreground_or("sideBarSectionHeader.foreground");
- let background = self.color("sideBar.background");
+ // modernUI paneHeaders.css: in the panel the header takes the panel's background and separator colors.
+ let in_panel = self.container_location(container.container_id()) == super::layout::Part::Panel;
+ let background = self.color(if in_panel { "panel.background" } else { "sideBar.background" });
let horizontal = self.panes(container).view.as_ref().is_some_and(PaneView::is_horizontal);
// paneview.ts `style`: side by side the border is the pane's left one, not the header's top one.
- let border = self.theme.color("sideBarSectionHeader.border").or(self.theme.color("surface.border")).filter(|_| index > 0 && !horizontal);
+ let border = match in_panel {
+ true => self.theme.color("panelSectionHeader.border").or(self.theme.color("panel.border")),
+ false => self.theme.color("sideBarSectionHeader.border"),
+ };
+ let border = border.or(self.theme.color("surface.border")).filter(|_| index > 0 && !horizontal);
let column = horizontal && !expanded;
let chevron = if expanded { "chevron-down" } else { "chevron-right" };
let dragged = DraggedPane {
@@ -778,7 +785,7 @@ impl Workbench {
// paneviewlet.css `.pane.horizontal:not(.expanded)`: the view's `containerIcon` under the chevron, no title.
.when(column, |header| header.child(self.icon(self.view_container_icon(id), 16., 16., foreground).flex_none().mt(px(4.)).debug_selector(move || format!("pane-icon-{id}"))))
// paneviewlet.css: the title ellipsizes to make room for the actions ("Gr..." beside Graph's).
- .when(!column, |header| header.child(div().min_w_0().overflow_hidden().text_ellipsis().whitespace_nowrap().text_size(px(12.)).font_weight(FontWeight::SEMIBOLD).child(title.to_string())))
+ .when(!column, |header| header.child(div().min_w_0().overflow_hidden().text_ellipsis().whitespace_nowrap().text_size(px(12.)).font_weight(FontWeight::SEMIBOLD).child(self.view_header_text(&title, id == FILE_VIEW))))
// paneviewlet.css `.pane-header .description`: 10px after the title, normal weight, only while expanded.
.when(id == OPEN_EDITORS_VIEW, |header| header.children(self.open_editors_dirty_badge(cx)))
.when(id == BREAKPOINTS_VIEW, |header| header.children(self.breakpoints_hint()))
@@ -793,7 +800,7 @@ impl Workbench {
// extensionsViews.ts `renderHeader`: the count badge after the actions, at the right end.
.when(container == PaneContainer::Extensions, |header| header.children(self.extensions_view_badge(id).map(|badge| badge.when(!has_actions, |badge| badge.ml_auto()))))
.when(id == FILE_VIEW, |header| header.child(self.explorer_title_actions(window, cx)))
- .when(focused && self.panes(container).pointer_focused != Some(id), |header| header.child(div().absolute().inset_0().rounded(px(4.)).border_1().border_color(self.color("focusBorder"))))
+ .when(focused && self.panes(container).pointer_focused != Some(id), |header| header.child(div().absolute().inset(px(1.)).rounded(px(3.)).border_1().border_color(self.color("focusBorder"))))
.on_click(cx.listener(move |workbench, event: &gpui::ClickEvent, window, cx| {
let panes = workbench.panes_mut(container);
panes.pointer_focused = (!event.is_keyboard()).then_some(id);
diff --git a/native/crates/app/src/workbench/workspace_trust_view.rs b/native/crates/app/src/workbench/workspace_trust_view.rs
index 3c63e433f4b..cfce20eee40 100644
--- a/native/crates/app/src/workbench/workspace_trust_view.rs
+++ b/native/crates/app/src/workbench/workspace_trust_view.rs
@@ -249,7 +249,8 @@ impl Workbench {
let tooltip = format!(
"Running in Restricted Mode\n\nSome [features are disabled](command:{LIST_UNSUPPORTED_EXTENSIONS_COMMAND_ID}) because this [{target} is not trusted](command:{MANAGE_TRUST_COMMAND_ID})."
);
- let item = self.extension_status_item(&entry, foreground, cx);
+ // Drawn first on the left: `first-visible-item`.
+ let item = self.extension_status_item(&entry, true, foreground, cx);
Some(item.child(self.hover_target("status.workspaceTrust", HoverContent::Markdown(json!({ "value": tooltip, "isTrusted": true, "supportThemeIcons": true })), HoverOptions::status_bar())))
}
diff --git a/port/fixtures/extensions/messages/extension.js b/port/fixtures/extensions/messages/extension.js
index 8a88b402f53..f48644dc005 100644
--- a/port/fixtures/extensions/messages/extension.js
+++ b/port/fixtures/extensions/messages/extension.js
@@ -33,6 +33,17 @@ const shows = {
right.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground');
right.show();
},
+ // Two adjacent entries with backgrounds on each side: `visible-background-color-neighbor`.
+ backgrounds: async () => {
+ const entries = [['Left warning', 'Left', 6, 'warning'], ['Left error', 'Left', 5, 'error'], ['Right warning', 'Right', 1001, 'warning'], ['Right error', 'Right', 1000, 'error']];
+ for (const [text, side, priority, kind] of entries) {
+ const entry = vscode.window.createStatusBarItem(`portMessages.${text.replace(' ', '')}`, vscode.StatusBarAlignment[side], priority);
+ entry.text = text;
+ entry.command = 'portMessages.info';
+ entry.backgroundColor = new vscode.ThemeColor(`statusBarItem.${kind}Background`);
+ entry.show();
+ }
+ },
openDialog: () => vscode.window.showOpenDialog({ canSelectMany: true, openLabel: 'Pick Files', filters: { 'JSON': ['json'] } }),
saveDialog: () => vscode.window.showSaveDialog({ saveLabel: 'Store', title: 'Save from an extension' }),
inlayHints: async () => {
diff --git a/port/fixtures/ui-pair/m11/status-backgrounds.json b/port/fixtures/ui-pair/m11/status-backgrounds.json
new file mode 100644
index 00000000000..2335ceb8716
--- /dev/null
+++ b/port/fixtures/ui-pair/m11/status-backgrounds.json
@@ -0,0 +1,4 @@
+[
+ { "wait": 6000 },
+ { "shot": "status-backgrounds" }
+]
diff --git a/port/fixtures/ui-pair/m11/tab-hover.json b/port/fixtures/ui-pair/m11/tab-hover.json
new file mode 100644
index 00000000000..80c9046b13b
--- /dev/null
+++ b/port/fixtures/ui-pair/m11/tab-hover.json
@@ -0,0 +1,27 @@
+[
+ { "wait": 8000 },
+ { "hotkey": ["cmd", "p"], "foreground": true },
+ { "wait": 800 },
+ { "type": "notes.txt" },
+ { "wait": 800 },
+ { "key": "return" },
+ { "wait": 1000 },
+ { "hotkey": ["cmd", "p"] },
+ { "wait": 800 },
+ { "type": "package.json" },
+ { "wait": 800 },
+ { "key": "return" },
+ { "wait": 1000 },
+ { "hotkey": ["cmd", "p"] },
+ { "wait": 800 },
+ { "type": "README.md" },
+ { "wait": 800 },
+ { "key": "return" },
+ { "wait": 1500 },
+ { "hover": [490, 52] },
+ { "wait": 500 },
+ { "shot": "tab-hover" },
+ { "hover": [26, 101] },
+ { "wait": 500 },
+ { "shot": "activity-hover" }
+]
diff --git a/port/ledger.md b/port/ledger.md
index e99a84f6429..9f00ca127ec 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -565,7 +565,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| workbench/contrib/mediaPreview | workbench contribution | M17 | verified | | workbench/media_preview.rs, media_preview/codecs.rs: cargo test -p app media_preview media_preview::codecs answers_the_player_page_with_the_file_s_codecs lists_the_editor_types opens_a_startup_image previews_read_git_resources_and_show_git_lfs_pointers_as_a_message an_image_previewed_in_another_group_gets_a_preview_in_the_active_one; `FIXTURE=media-preview-tests port/tools/webview-check` 6/6; ui-pair image, video, audio, editor-type-reopen.json (port/results/webviews.md), media-preview-focus.json. Not done: Copy image, legacy `media-preview` editor migration |
| workbench/contrib/mergeEditor | workbench contribution | M14 | verified | | merge_editor.rs model (mapping, conflict states, accept/combine) and workbench/editor_view/merge_editor_view.rs (input 1/2, result, base view, layouts, gutter checkboxes behind `mergeEditor.showCheckboxes`, base-to-result diff backgrounds, "Comparing with" in base, the result's breadcrumbs, git's Complete Merge in the result's floating menu, `_open.mergeEditor`, dev commands, the inputs as read-only code editors of the group, Toggle Between Inputs, the active range in the last focused input or the result, scroll synchronization): cargo test -p app merge; the result title's `mergeEditor/result/title` toolbar (Reset sorted among the contributed `primary` items, the other groups behind "..."): ui-pair menus/merge-result-title.json, `FOLDER` a repository mid-merge with a conflicted `a.txt`, `FILE=a.txt`, `ARGS=--extensionDevelopmentPath=<repo>/port/fixtures/extensions/menus`; verified: cargo test -p app open_merge_editor_resets_the_conflict_and_accepts_incoming ("..." active while its menu shows, cursor Ln 1, Col 1, no encoding entry), ui-pair menus/merge-result-title.json with FOLDER a repository mid-merge: shots `merge` and `more` match the reference (counter width, input titles with "·" at the same height, tab decoration, "Text Editor" switch, status bar) |
| workbench/contrib/meteredConnection | workbench contribution | M19 | verified | | the metered warning status entry and Configure Metered Connection (workbench/power.rs); port/tools/shell-check (port/fixtures/extensions/shell-tests, 6/6); cargo test -p app metered_connection |
-| workbench/contrib/modernUI | workbench contribution | M11 | verified | | the modern layout only: the classic layout (`workbench.experimental.modernUI: false`) is removed by Artur's decision (port/notes.md Modern UI); `window.density.layout` compact and the Manage menu's Layout Density (cargo test -p app -- compact_density layout_density; ui-pair m11/layout-density.json in both densities with SETTINGS `{"window.density.layout": "compact"}`, port/results/layout-density.md) |
+| workbench/contrib/modernUI | workbench contribution | M11 | verified | | the modern layout only: the classic layout (`workbench.experimental.modernUI: false`) is removed by Artur's decision (port/notes.md Modern UI); `window.density.layout` compact and the Manage menu's Layout Density (cargo test -p app -- compact_density layout_density; ui-pair m11/layout-density.json and m11/status-backgrounds.json in both densities with SETTINGS `{"window.density.layout": "compact"}`, port/results/layout-density.md); the 1.147.0 modernUI CSS audit in port/notes.md Modern UI |
| workbench/contrib/multiDiffEditor | workbench contribution | M14 | verified | | multi_diff_editor.rs, workbench/editor_view/multi_diff_editor_view.rs, workbench/code_editors.rs: cargo test -p app multi_diff unchanged_bars_drag the_content_menu_floats_over_the_diffs a_file_side_is_a_code_editor every_drawn_file_side; ui-pair port/fixtures/ui-pair/menus/multi-diff-content.json with `FILE=notes.txt`, `steps-multi-diff-edit.json` (matches but for the reference's TypeScript diagnostics; port/notes.md Comments in diff editors); verified: cargo test -p app the_content_menu_floats_over_the_diffs, ui-pair menus/multi-diff-content.json: the toolbar's rows match the reference's |
| workbench/contrib/notebook | workbench contribution | M17 | ported | [3 M] notebook_editor: no cell execute toolbar (`notebook/cell/execute`, notebookEditorWidget.ts:138 `cellExecuteToolbar`); kernel_picker.rs: no `notebook/kernelSource` actions (notebookKernelServiceImpl.ts:322); no notebookVariablesView.ts, so no `notebook/variables/context` | notebook.rs, notebook/kernels.rs, notebook/layout.rs, notebook/outline.rs, workbench/notebooks.rs, workbench/notebook_editor.rs, workbench/notebook_editor/outputs.rs, cell_actions.rs, folding.rs, dnd.rs (port/notes.md milestone 17): cargo test -p app -- notebook kernel renderer backup interactive repl outline quick_input explorer list_scroll walkthrough (288/0); cargo test -p app markdown_editor_files_offer notebook::tests::stream_compression a_dirty_notebook_backs_up the_cell_language_picker the_output_toolbar_menu renderers a_notebook_editor_comes_back the_customize_notebook_submenu the_cell_toolbar markdown_headers_fold headings_fold split_points the_toolbar_position a_cell_dragged_by_its_left_column_moves_or_copies_to_the_drop_place markdown_headers_fold_their_sections every_selected_range_moves_to_the_drop_place the_outline_header_collapses_and_expands_the_notebook_s_headers; api-tests `MOCHA_GREP="Notebook|ipynb|Interactive Window|Ensure tabs getter"` 41/10/0 three runs in a row (10 pending are upstream skips); ui-pair m17 notebook-open, -keys-outline, -output-toolbar, -kernel-picker, -restore, -cell-click, -scroll, -toolbars, -find (within 1 device px). Differences left are reference quirks not copied (port/notes.md session m17d) |
| workbench/contrib/onboarding | workbench contribution | M19 | removed | | the only registered tours are the Agents window ones (src/vs/sessions/contrib/onboardingTours): no AI by decision (port/notes.md) |
diff --git a/port/notes.md b/port/notes.md
index a31d2f86e57..28792481721 100644
--- a/port/notes.md
+++ b/port/notes.md
@@ -598,7 +598,7 @@ Scope (milestone 13): diagnostics, hover, completion, go to definition and peek,
- Modal editor group (`workbench/modal_editor_group.rs`, modalEditorPart.ts): `MODAL_GROUP` is a group outside the grid like the panel's (`EditorGroup::ensure_detached_group`; `has_several_groups` counts neither). preferencesService.ts `getEditorGroupFromOptions` sends settings.json and keybindings.json there unless `workbench.editor.useModal` is `off` or extension tests run; the modal draws the group's active editor with its breadcrumbs but without tabs or editor actions (`NoEditorTabsControl`) under a header, while the part keeps showing the group active before it with the file's icon, name and folder and the Open Settings (UI) or Open Keyboard Shortcuts action. Escape (`editorFocus && editorPartModal`), a press outside and Close Modal Editor close its editors (dirty ones ask) and the group with them. The Settings and Keyboard Shortcuts editors are editors of the group (preferencesEditorInput.ts resource `vscode-settings:/settingseditor`; keybindingsEditorInput.ts has no resource, the port's is `vscode-settings:/keybindingseditor`): a settings file opens beside them and they show again when it closes, a closed one drops its state, and an editor opened without preserveFocus (a file, an extension) closes the modal (editorGroupFinder.ts `handleModalEditorPart`). Tests: `cargo test -p app modal_editor_group`.
- Side by side editor (`workbench/side_by_side_editor.rs`; sideBySideEditor.ts, sideBySideEditorInput.ts): the group entry is the primary side; the secondary side is the one editor of a group of its own outside the grid and the group list (`EditorGroup.side_by_sides`, entry model id to group), drawn with `swapped_group_body` left of the primary (above it with `workbench.editor.splitInGroupLayout: vertical`, Toggle Layout in the editor title), the `sideBySideEditor.verticalBorder`/`horizontalBorder` line between. A press in the secondary makes its group active, so every editor command edits it; `workbench.action.*` commands (`execute_command`, `leave_side_group_for`) and `leave_panel_group` first give the active group back to the owner, so closing, splitting and moving act on the side by side editor, and the side gets the focus back after them while the side by side editor still shows it (`lastFocusedSide`); Go to Line, Go to Symbol, Quick Open, the Command Palette and Find in Files act on the focused side's code editor (`activeTextEditorControl`) and do not leave it; opening a file in the active group (`open_file_in_active_group`) leaves it; closing the entry closes the secondary group (`remove_input`). `swapped_group_body` draws the really active group as active even when it draws inside another group's swapped body. Split JSON (`useSplitJSON` or `openDefaultSettings`, `doOpenSplitJSON`): settings.json is the primary, `vscode://defaultsettings/{settings,workspaceSettings,resourceSettings}.json` the read-only secondary, its content `DefaultSettings.getContentWithoutMostCommonlyUsed` (`default_settings_content`); the modal header has no description for it (`getDescription`). `workbench.settings.openDefaultKeybindings`: openGlobalKeybindingsFile opens the default keybindings in the active main group and keybindings.json in a group added to its right. The editor title shows Open Settings (UI) on a user settings.json (`_workbench.openUserSettingsEditor`). cargo test -p app split_json open_default_keybindings; ui-pair port/fixtures/ui-pair/m11/split-settings.json with SETTINGS `{"workbench.settings.useSplitJSON": true}` (modal) and with `"workbench.editor.useModal": "off"`: the two sides, the title actions and the breadcrumbs' end as the reference. The sash between the sides (`SideBySideSplits`, sideBySideEditor.ts SplitView): a drag resizes them with each side kept at 220px wide (70px high in the vertical layout, `DEFAULT_EDITOR_MIN_DIMENSIONS`), a double click distributes them again; the ratio is kept per entry in memory (upstream keeps it in the editor's view state). The breadcrumbs' editor type control (workbench/editor_type_picker.rs; breadcrumbsControl.ts `_createEditorTypeControl`, editorTypePicker.ts): the current editor's label and a chevron at the breadcrumbs' end while the resource has more than one editor (`getAvailableEditorTypes` over `resource_editors`: the text editor, contributed custom editors by rank, the split settings editor first for `**/settings.json` while split JSON is on, minus hidden and unconfigured universal option editors); its menu reopens with each editor (Alt: open to the side), and Set Default for the glob. The EditSettingRenderer pencil (workbench/preferences/edit_setting.rs): in a user, workspace or folder settings file, the `edit` codicon in the glyph margin on the value line of the cursor's or, after a 75 ms pause, the pointer's boolean or enum setting; the pointer on it highlights the setting's lines, a press lists the values (a submenu per setting when several share the line), the value is written into the model, saved, selected, and the setting highlighted while the selection stays. The breadcrumbs of a path outside the workspace start below the user home as `~`, else below the root (`_initFilePathInfo`), and items have no gaps besides the file icon's 6px (the 16px before every item was wrong inside the workspace too). The breakpoint hint shows only where breakpoints can be set (`canSetBreakpointsIn`: never jsonc). cargo test -p app preferences editor_type_picker side_by_side; ui-pair port/fixtures/ui-pair/m11/split-settings-edit.json with SETTINGS `{"workbench.settings.useSplitJSON": true, "workbench.editor.useModal": "off"}` (port/results/layout.md Split settings editor). The pencil's glyph margin hover "Edit" (`edit_setting_glyph_hover`, glyphHoverWidget.ts placement: right of the glyph margin, top on the line, 13px, after `editor.hover.delay`) matches the reference within 1px; in this fixture the port misses the pointer's first move after the menu's Escape, a second move shows it (GlyphHoverWidget for other glyphs is not ported). The breadcrumbs' `…` item shows with Outline collapsed after the merge of port-integrate. Media previews and custom editors have breadcrumbs and with them the editor type control (ui-pair m11/editor-type-image.json: "Image Preview" as the reference). Split Editor copies a side by side editor with its secondary side (`EditorGroup::copy_side_by_side`); Reopen Closed Editor reopens both sides as a plain SideBySideEditorInput (`toUntyped`), whose editor type is the text editor, so its breadcrumbs say "Text Editor" where the split settings editor's say "Split Settings Editor" (ui-pair m11/split-settings-copy.json). The host sees the secondary side as a visible text editor without a column (mainThreadDocumentsAndEditors.ts `_updateState` lists every code editor; `SideBySideEditor.getControl` is the primary's), also while the secondary side's group is active.
- Part positions (`workbench/layout.rs`, layout.ts `arrangeMiddleSectionNodes`/`arrangeEditorNodes`, layoutService.ts floating margins): the grid is a tree of split views (row, column, row) built for the side bar's side, the panel's position and its alignment; moving a part builds it again from the parts' sizes and visibility, as `adjustPartPositions` and `setPanelPosition` move views. `Grid::bounds` places each visible part; `card_margins` gives each card the gap on its leading edge, the outer gutter on the window's sides and bottom, and joins the side bar to the activity bar (left or right); a right rail with no side bar takes the extra 4px leading gap (`needsFloatingLeadingGap`). State: `workbench.sideBar.location` (setting, `workbench.action.moveSideBarLeft`/`Right`/`toggleSidebarPosition`), `workbench.panel.position` (workspace, a `Position` number, default from `workbench.panel.defaultLocation`), `workbench.panel.alignment` (profile), `panel.lastNonMaximizedWidth`/`Height` (profile, 300), `panel.wasLastMaximized` and `editor.hidden` (workspace) with `workbench.panel.opensMaximized`. Commands `workbench.action.positionPanel{Top,Left,Right,Bottom}` and `alignPanel{Left,Right,Center,Justify}`, View > Appearance > Panel Position and Align Panel, context keys `panelPosition`, `panelAlignment`, `mainEditorAreaVisible`. Maximize needs a centered or side panel (`panelMaximizationSupportedWhen`, the warning otherwise). Tests: `cargo test -p app -- layout part_grid`.
-- Modern UI (contrib/modernUI): the classic layout with `workbench.experimental.modernUI: false` is removed by Artur's decision; the port has the modern layout only and reads the setting only where a part's metrics depend on it (the terminal's scrollbar) and for the Layout Density menu's `when`. Layout density (`window.density.layout`; layoutService.ts `isModernUICompact`, layoutDensityActions.ts, modernUI.contribution.ts): `workbench.action.setLayoutDensity.default`/`.compact` write the setting, the Manage menu's Layout Density submenu (group `2_configuration`, order 8, while the modern UI is on) checks the current one. Compact (`Workbench::compact_density`): the cards lose their margins and radii (floatingPanels.css, editorBorder.css), keep a transparent 1px border and paint 1px strokes on their right and bottom edges (`compact_card_strokes`: `surface.border` for the side bars, `modernPanel.border` for the panel, `editor.border` for the editor, `modernActivityBar.border` for the rail with its top edge, and its left edge on the left or after the side bar; a left edge also on any part at the window's left edge); the editor has no left border unless it meets the window's left edge; the rail is 40px (`COMPACT_ACTIVITY_BAR_WIDTH`, lane 4px, item gap 4px) and never takes the right rail's leading gap; the sashes are splitview's own, centered on the seams, without grips and with the full-length highlight; the status bar is 26px with 8px padding, 2px label margins and 4px label padding, 24px edge items; pane list rows sit 2px in from the edges. Tests: `cargo test -p app -- compact_density layout_density`. The Customize Layout quick pick lists the densities too (see Manage menu and Customize Layout below). Not ported: the toasts and the notification center keep their fixed insets (notificationsDialogs.css), as upstream does in both densities; `.has-background-color` and `visible-background-color-neighbor` status item margins are not ported in either density.
+- Modern UI (contrib/modernUI): the classic layout with `workbench.experimental.modernUI: false` is removed by Artur's decision; the port has the modern layout only and reads the setting only where a part's metrics depend on it (the terminal's scrollbar) and for the Layout Density menu's `when`. Layout density (`window.density.layout`; layoutService.ts `isModernUICompact`, layoutDensityActions.ts, modernUI.contribution.ts): `workbench.action.setLayoutDensity.default`/`.compact` write the setting, the Manage menu's Layout Density submenu (group `2_configuration`, order 8, while the modern UI is on) checks the current one. Compact (`Workbench::compact_density`): the cards lose their margins and radii (floatingPanels.css, editorBorder.css), keep a transparent 1px border and paint 1px strokes on their right and bottom edges (`compact_card_strokes`: `surface.border` for the side bars, `modernPanel.border` for the panel, `editor.border` for the editor, `modernActivityBar.border` for the rail with its top edge, and its left edge on the left or after the side bar; a left edge also on any part at the window's left edge); the editor has no left border unless it meets the window's left edge; the rail is 40px (`COMPACT_ACTIVITY_BAR_WIDTH`, lane 4px, item gap 4px) and never takes the right rail's leading gap; the sashes are splitview's own, centered on the seams, without grips and with the full-length highlight; the status bar is 26px with 8px padding, 2px label margins and 4px label padding, 24px edge items; pane list rows sit 2px in from the edges. Tests: `cargo test -p app -- compact_density layout_density`. The Customize Layout quick pick lists the densities too (see Manage menu and Customize Layout below). The toasts and the notification center keep their fixed insets in both densities (notificationsDialogs.css: 28px from the top right, 24px from the bottom without the status bar). Status items with a background keep a 4px gap (2px compact) from a neighbor with one (statusbarPart.ts `updateVisibleBackgroundColorNeighbors`, `status_bar_side`; ui-pair m11/status-backgrounds.json in both densities, `PORT_MESSAGES=backgrounds`). The 1.147.0 modernUI CSS audit (branch port-modernui-gaps) ported the rest: connected panel and compact activity bar tabs (connectedPaneTabs.css), inactive editor tab hover fill and `tab.divider` (tabs.css), the activity bar hover indicator, 4px radii (roundedCorners.css), the frosted glass gate on quick input, dialogs and notifications (frostedGlass.css; `workbench.modernUIFrostedGlass`, `workbench.reduceTransparency`, macOS reduced transparency), fontRamp.css header casing with `workbench.experimental.modernUIUppercaseViewHeaders` and the Explorer's workspace name case, the diff editor's `surface.border` (shadows.css) and the sash highlight radii. Not ported: modernTabColorCustomizations.ts theme-specific tab hover colors (`shortcut:` in editor_view.rs).
- Manage menu and Customize Layout (branch port-manage-menu; port/results/manage-menu.md): the layout-density pair showed the Manage menu without Settings, Extensions and Tasks, and the title bar's Customize Layout button ran a command nobody registered. The rows `workbench/parts/activitybar` and `workbench/services/layout` were `verified` without them: their evidence checked where the menu opens and the View > Appearance entries, not the menu's items or every layoutActions.ts action against the reference. Ported: every MenuId.GlobalActivity contribution of a kept feature (menus.rs; Backup and Sync Settings stays out with Settings Sync), `workbench.action.tasks.openUserTasks` with the template picker on the profile's tasks.json (`editor.insertSpaces` turns the template's tabs into spaces, for a folder's tasks.json too), the update state as the `updateState` context key with the `7_update` items and the Manage badge (workbench/update.rs; nothing shows without `updateUrl`), the title bar gear's menu, and the Customize Layout quick pick (workbench/customize_layout.rs) with `workbench.action.toggleActivityBarVisibility` and `alignQuickInputTop`/`Center`. `quickInputAlignment` is derived from the stored position: within 20px of a snap line and centered across, as `_layout` snaps. The pick's items are rebuilt each frame they differ (upstream: on a layout context key change), and the quick input takes the focus back after the frame, as the upstream `setTimeout` does after a shown panel's terminal took it.
- User tasks (manager's decision, ported after the first merge): `configured_tasks` appends the profile's tasks.json tasks parsed in the first folder (the user home without one), with the DTO source `{ label: "User" }` that `Task::is_user` reads, the `settings` recent key, the user `inputs`, and Configure Task and customizations written to that file (`task_file`). Configure Task offers the template entry while only user tasks are configured. The Run Task picker pins items as upstream (quickPickPin.ts, now workbench/quick_pick_pin.rs shared with the terminal's run recent pickers); the pin button was the visible difference in the first pair.
- Pins of terminal session commands (Artur's decision): as upstream, a run recent item of the current session carries its command's timestamp as `id` (terminalRunRecentQuickPick.ts) and pins match it by that id, while storage keeps only label, description and detail (`formatPinnedItemForStorage`). Upstream's id lives only in the open picker, so the pin of a session command vanishes once the picker hides; the port keeps the pins with their ids for the session (`Workbench::session_pins`, used while storage still holds the same pins), so such a pin stays until the window closes. Test: cargo test -p app a_pinned_session_command_stays_pinned_until_the_session_ends.
@@ -889,7 +889,7 @@ Scope as in the M19 Work row of port/ledger.md.
- Window state (`windows_state.rs`): `windowsState` in `User/globalStorage/storage.json`, the same key and shape as the reference (`lastActiveWindow`, `openedWindows`, `uiState` with `mode`, `display`, bounds). Display ids are the CGDirectDisplayID GPUI reports; bounds are points from the display's top left, so a window on a display that is gone opens centered.
- Launch (`launch.rs`): a Unix socket in the user data folder, one JSON line per second instance (`args`, `cwd`) answered with `ok` once taken. Tools that start the port with their own `--user-data-dir` get their own instance; a start from the checkout with the default `~/.vsrustium` hands its arguments to a running VSRustium.
- Inactive window (workbench.rs `title_bar`, `shell_background`; opener.rs re-renders on activation): `titleBar.inactiveBackground` and `inactiveForeground`, `commandCenter.inactiveBorder`, the title bar contents at 0.6 opacity (titlebarpart.css `.inactive > *`), and the modern UI shell in `modernUI.inactiveShellBackground`; both backgrounds are made opaque over WORKBENCH_BACKGROUND as titlebarPart.ts does.
-- Open in this list, each waiting on another owner or a decision: `workbench/contrib/limitIndicator` needs the language status item (milestone 13); `workbench/contrib/modernUI` is drawn always on, while the classic look (`workbench.experimental.modernUI: false`) and the compact density (`window.density.layout`, Layout Density menu) change the part grid (main session). Window zoom (`window.zoomLevel`) is n/a by Artur's decision: GPUI has no window-wide scale outside its test build.
+- Open in this list, each waiting on another owner or a decision: `workbench/contrib/limitIndicator` needs the language status item (milestone 13). Window zoom (`window.zoomLevel`) is n/a by Artur's decision: GPUI has no window-wide scale outside its test build.
- Editor windows (`workbench/auxiliary_windows.rs`; auxiliaryEditorPart.ts, auxiliaryWindowService.ts, editorParts.ts, editorActions.ts): Move/Copy Editor and Editor Group into New Window (Command Palette, the tab menu's Move/Copy into New Window, View > Editor Layout), New Empty Editor Window, Restore Editors into Main Window. A part is a grid of groups in the workbench's `Editors`; `EditorGroups` holds the active group's part layout in its fields and parks the others' (`PartLayout`, `switch_part`, `in_part`), so the group commands act on the active part. `groups_in_grid_order` is every part's groups, main first. The window is a GPUI window whose root `AuxiliaryWindow` asks the workbench to draw the part (no card), the title bar (command center, Turn On/Off Always on Top, `titleBar.border`) and the part's editor status items. The window that turns active makes its part's most recent group the active one (editorParts.ts `activePart`); the overlays (quick input, menus, dialogs, hovers) draw in the active window; keys reach the workbench of the window they come from (the keystroke interceptor was app-wide: every workbench window took every window's keys). Closing the window (its button, Cmd+Shift+W, Close Group on its last group) moves the editors that would ask (dirty ones) to the main part's active group and closes the others; its last editor closed closes it; the main window takes its editor windows with it. `editorparts.state` (each part's grid and editors, bounds, part MRU) is saved on every editor change and restores at start when the main part restored its state. Compact mode (auxiliaryEditorPart.ts `updateCompact`; Toggle Window Compact Mode, the title's Turn On/Off Compact Mode): the part draws no tabs and no breadcrumbs, the window no status bar, the title bar the window title and a diff's Previous/Next Change (`MenuId.CompactWindowEditorTitle`); a split from it goes to the main part (`getAddGroupLocation`); a second group in the part, or another editor shown while its group has several, ends it; `compact` is stored with the window. Not ported: zoom per window. Tests: `cargo test -p app auxiliary_windows`; ui-pair port/results/auxiliary-windows.md.
- Locked editor groups (`editor_groups/locked_groups.rs`; editorGroupModel.ts, editorCommands.ts, editorGroupFinder.ts, editorGroupView.ts): Lock, Unlock and Toggle Editor Group Lock on the active group, `activeEditorGroupLocked`; the toggled Unlock Group icon in a locked group's title and Lock Group in an editor window's, right of Split Editor; the empty group's toolbar (`MenuId.EmptyEditorGroup`: Lock or Unlock Group and Close Group, shown when the group is locked, in an editor window or one of several). An editor opened without a group picked (`leave_locked_group` at each open entry: files, untitled, diffs, notebooks, webviews, custom editors, search, settings and the other built-in editors) leaves a locked active group that does not have it open for the most recent unlocked group, else a new group beside; a drop or an explicit view column keeps the group. `workbench.editor.autoLockGroups` locks a group whose first editor's id (`mainThreadWebview-<viewType>`, a custom editor's or notebook's type, `default`) it lists, when there are several groups. `locked` is stored with the group. Not ported: Lock Group in the editor title's `...` menu and the empty group's context menu (neither menu is ported), the SIDE_GROUP case that makes a new group when the side group is locked.
- Tab drags between windows (`cross_window_drag`): AppKit sends `mouseDragged` and `mouseUp` only to the window of the `mouseDown`, so GPUI's drop targets in other windows never see a drag. While a tab drags past its window's edge, a capture listener in every workbench and editor window hit-tests the app's windows front to back against the pointer's screen point (window origin plus the event position) and dispatches the move or the release to that window as its own `PlatformInput`; GPUI's `active_drag` is app-wide, so the targets there take it (drop overlay, move, the emptied editor window closes). A release over no app window moves the tab into a new editor window at the pointer (editorTabsControl.ts `onGroupDragEnd`, `workbench.editor.dragToOpenWindow`, Option inverts); a tab dropped in another workbench window opens its file there. The port draws its drag image in the window under the pointer; Chromium's is a native drag window. The empty editor part now takes drops too (it drew the letterpress without a drop area).