fix(workbench): main toolbar, tool window stripe and status bar metrics (#7829)

Main toolbar items get a 10px pitch and the dropdowns 10/6px insets with a 16px chevron; stripe buttons get 5px padding on both sides; the status bar is 34px with 4px widget hover insets, its breadcrumbs lifted 5px, and the islands keep a 3px inset above it. Language Services moves after the caret position in the status bar. Compact mode keeps its previous metrics.

Fixed-viewport e2e layouts (commit checks, project tree second click, main toolbar label compression next to the New Agent Task button) get room for the wider gaps and the taller status bar.

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-12-04 00:29:29 +08:00
1 джерело 4f2d85007b
коміт e666bb2e33
23 files changed
+115 -53

No files matched your search

+1 -1
Переглянути файл
@@ -782,7 +782,7 @@ test("Commit Options applies a named TODO filter independently of the TODO windo
test("commit check text scrolls independently of its status icon and retry action", async ({ workbench: page }) => {
await stubRepository(page);
await page.setViewportSize({ width: 850, height: 650 });
await page.setViewportSize({ width: 850, height: 670 });
await page.evaluate(async () => {
const registryPath = "/src/features/vcs/commitCheckRegistry.ts";
const layoutPath = "/src/workbench/toolwindows/store.ts";
+1 -1
Переглянути файл
@@ -2,7 +2,7 @@ import { expect, test } from "./fixtures";
/** Heights IDEA's Islands theme uses in compact mode (`*.compact` keys), against the defaults. */
const SIZES = {
normal: { titleBar: 40, treeRow: 24, stripeIcon: 20, statusBar: 30, runButton: 30 },
normal: { titleBar: 40, treeRow: 24, stripeIcon: 20, statusBar: 34, runButton: 30 },
compact: { titleBar: 32, treeRow: 22, stripeIcon: 16, statusBar: 24, runButton: 26 },
};
+10 -1
Переглянути файл
@@ -53,7 +53,9 @@ test("the main toolbar compresses long labels before a short branch name", async
await page.setViewportSize({ width: 1150, height: 620 });
const expanded = await Promise.all(labels.map(width));
await page.setViewportSize({ width: 820, height: 620 });
// 868: IDEA's 10px item gaps (MainToolbar.Icon.insets 6,5,4,5) take 48px more than 4px gaps
// would, so the bar needs that much more for the two long labels to shrink while the branch stays whole.
await page.setViewportSize({ width: 868, height: 620 });
// The label cap is applied in a ResizeObserver's animation frame, so wait until both long labels shrank.
await expect
.poll(async () => (await Promise.all([width(project), width(run)])).every((w) => w.shown < w.preferred))
@@ -66,6 +68,13 @@ test("the main toolbar compresses long labels before a short branch name", async
}
expect(Math.abs(narrowed[0]!.shown - narrowed[1]!.shown)).toBeLessThanOrEqual(2);
// The old 690px width: too narrow for every label, so the branch shrinks as well, but never below the long
// labels' equal share.
await page.setViewportSize({ width: 690, height: 620 });
await expect.poll(async () => (await width(branch)).shown).toBeLessThan((await width(branch)).preferred);
const squeezed = await Promise.all(labels.map(width));
expect(squeezed[1]!.shown).toBeGreaterThanOrEqual(Math.min(squeezed[0]!.shown, squeezed[2]!.shown) - 1);
await page.setViewportSize({ width: 400, height: 550 });
const buttons = toolbar.locator("button:visible");
await expect
+1 -1
Переглянути файл
@@ -47,7 +47,7 @@ test("a single click shows the file in the preview tab, which the next one reuse
});
test("Always Select Opened File keeps the clicked row in place for the second click", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1200, height: 420 });
await page.setViewportSize({ width: 1200, height: 440 });
const tree = page.getByRole("tree", { name: "Project" });
const tabs = page.getByRole("tablist", { name: "Editor tabs" });
await page.evaluate(async () => {
+1 -1
Переглянути файл
@@ -43,7 +43,7 @@ test("status bar uses its row height and widget insets in both densities", async
const encoding = bar.locator('[data-status-item="editor.encoding"]');
await expect(lineEnding.getByRole("button")).toBeVisible();
await expect(encoding.getByRole("button")).toBeVisible();
await expect(bar).toHaveCSS("height", "30px");
await expect(bar).toHaveCSS("height", "34px");
await expect(encoding.getByRole("button")).toHaveCSS("font-size", "13px");
const widgetGap = async () => {
+15 -1
Переглянути файл
@@ -96,7 +96,9 @@ test("the Center group is centred in the main toolbar", async ({ workbench: page
});
const group = bar.locator("[data-toolbar-center]");
await expect(group).toContainText("acme-api");
for (const width of [1400, 900]) {
// 932: the narrow case where the group still fits between the fixed groups, which keep IDEA's
// 10px item gaps (MainToolbar.Icon.insets 6,5,4,5) and so need 6px more per gap than the old 4px.
for (const width of [1400, 932]) {
await page.setViewportSize({ width, height: 700 });
await expect(async () => {
const [barBox, groupBox] = await Promise.all([bar.boundingBox(), group.boundingBox()]);
@@ -104,6 +106,18 @@ test("the Center group is centred in the main toolbar", async ({ workbench: page
expect(Math.abs(middle - (barBox!.x + barBox!.width / 2))).toBeLessThanOrEqual(1);
}).toPass({ timeout: 3000 });
}
// The old 900px width: no room to centre, so the group is pushed left of the right group, never over it.
await page.setViewportSize({ width: 900, height: 700 });
const rightGroup = bar.locator("[data-toolbar-center] ~ :not([data-toolbar-spacer])").first();
await expect(async () => {
const [barBox, groupBox, rightBox] = await Promise.all([
bar.boundingBox(),
group.boundingBox(),
rightGroup.boundingBox(),
]);
expect(groupBox!.x + groupBox!.width / 2).toBeLessThan(barBox!.x + barBox!.width / 2);
expect(groupBox!.x + groupBox!.width).toBeLessThanOrEqual(rightBox!.x);
}).toPass({ timeout: 3000 });
await page.screenshot({ path: "test-results/toolbar-center.png", animations: "disabled" });
});
+3
Переглянути файл
@@ -399,6 +399,9 @@
min-width: 0;
overflow: hidden;
}
.statusCrumbs {
margin-block-end: var(--statusbar-crumbs-lift);
}
.crumbStrip {
display: flex;
align-items: center;
+2 -2
Переглянути файл
@@ -266,7 +266,7 @@ function CrumbNav({
return (
// oxlint-disable-next-line react/no-array-index-key -- the `…` crumb and the last directory crumb can share a title; position disambiguates them
<Fragment key={`${i}:${s.title}`}>
{i > 0 && <Icon name="chevron-right" size={12} className={styles.statusSep} />}
{i > 0 && <Icon name="chevron-right" size={16} className={styles.statusSep} />}
<BarButton
className={styles.crumbButton}
tooltip={s.title}
@@ -354,7 +354,7 @@ export function Breadcrumbs({ className, inStatusBar = false }: { className?: st
/** The status bar instance of the navigation bar; renders only for `statusBar`. */
export function StatusBarBreadcrumbs() {
return <Breadcrumbs inStatusBar />;
return <Breadcrumbs className={`${styles.status} ${styles.statusCrumbs}`} inStatusBar />;
}
/**
+2 -1
Переглянути файл
@@ -135,7 +135,8 @@ export function activate(): () => void {
registerStatusItem({
id: "code-insight.servers",
align: "right",
priority: 5,
// IDEA: after Position, before LineSeparator.
priority: 25,
component: ServerStatus,
title: "Language Services",
}),
+1 -1
Переглянути файл
@@ -91,7 +91,7 @@ function Chooser({ active }: { active: string }) {
<span className={styles.widgetName} data-toolbar-label="">
{active}
</span>
<Icon name="chevron-down" size={14} className={styles.widgetChevron} />
<Icon name="chevron-down" size={16} className={styles.widgetChevron} />
</BarButton>
<Menu
open={open}
+1 -1
Переглянути файл
@@ -97,7 +97,7 @@ function Chooser({ root }: { root: string }) {
<span className={styles.widgetName} data-toolbar-label="">
{label}
</span>
<Icon name="chevron-down" size={14} className={styles.widgetChevron} />
<Icon name="chevron-down" size={16} className={styles.widgetChevron} />
</BarButton>
<Menu
open={chooserOpen}
+1 -1
Переглянути файл
@@ -99,7 +99,7 @@ function Chooser() {
<span className={styles.widgetName} data-toolbar-label="">
{busy && busy === current?.udid ? `${label}…` : label}
</span>
<Icon name="chevron-down" size={14} className={styles.widgetChevron} />
<Icon name="chevron-down" size={16} className={styles.widgetChevron} />
</BarButton>
<Menu open={open} anchor={anchor} items={items} placement="bottom-end" onClose={() => setOpen(false)} />
</>
+3 -2
Переглянути файл
@@ -379,7 +379,6 @@
min-width: 0;
display: inline-flex;
align-items: center;
gap: var(--space-1);
max-width: 260px;
height: var(--h-toolbar-widget);
border-radius: var(--radius-toolbar-dropdown);
@@ -451,6 +450,7 @@
flex: none;
}
.widgetChevron {
margin-inline-start: calc(var(--toolbar-dropdown-chevron-gap) - var(--toolbar-dropdown-gap));
color: var(--fg-subtle);
flex: none;
}
@@ -458,7 +458,8 @@
flex: none;
display: flex;
align-items: center;
gap: var(--space-0-5);
/* Run, Debug and More keep the main toolbar's 40px button pitch (MainToolbar.Icon.insets 6,5,4,5). */
gap: var(--toolbar-item-gap);
}
.widgetRun:not(:disabled) {
color: var(--success);
+1 -1
Переглянути файл
@@ -94,7 +94,7 @@ export function RunWidget() {
<span className={styles.widgetName} data-toolbar-label="">
{selected ? label(selected) : tx(currentFile ? "Current File" : "Select Configuration")}
</span>
<Icon name="chevron-down" size={14} className={styles.widgetChevron} />
<Icon name="chevron-down" size={16} className={styles.widgetChevron} />
</BarButton>
<span className={styles.widgetButtons}>
{showLoading ? (
+2 -2
Переглянути файл
@@ -1,7 +1,6 @@
.widget {
display: inline-flex;
align-items: center;
gap: var(--space-1);
max-width: 280px;
height: var(--h-toolbar-widget);
border-radius: var(--radius-toolbar-dropdown);
@@ -19,8 +18,9 @@
flex: none;
color: var(--fg-muted);
}
.chevron {
.widgetChevron {
flex: none;
margin-inline-start: calc(var(--toolbar-dropdown-chevron-gap) - var(--toolbar-dropdown-gap));
color: var(--fg-subtle);
}
.name {
+1 -1
Переглянути файл
@@ -181,7 +181,7 @@ export function BranchWidget({ place = "toolbar" }: { place?: BranchWidgetPlace
)}
{/* Like IDEA's widget: icons only; counts are in the tooltip. */}
<BranchSync behind={branch.behind} ahead={ahead} unfetched={!!pending} showCounts={false} onSelect={openSync} />
{toolbar && <Icon name="chevron-down" size={14} className={styles.chevron} />}
{toolbar && <Icon name="chevron-down" size={16} className={styles.widgetChevron} />}
</BarButton>
</>
);
+2
Переглянути файл
@@ -12,7 +12,9 @@
.status[data-mode="replace"] {
color: var(--warning);
}
/* Off, it reads "Vim" like any other text widget: no room kept for the mode names. */
.off {
min-width: 0;
color: var(--fg-subtle);
font-weight: normal;
}
+26 -2
Переглянути файл
@@ -345,11 +345,24 @@ html[data-os="windows"] {
/* Dialog window title bar (Settings): WebStorm's traffic lights centre 16px from the top. */
--h-dialog-titlebar: 32px;
--titlebar-tool-button: 30px;
/* MainToolbar.Icon.insets 6,5,4,5 (Islands): 5 + 5 between toolbar items, and the
buttons sit 1px below the bar's centre (top 6, bottom 4). */
--toolbar-item-gap: 10px;
--titlebar-pad-top: 2px;
/* main toolbar dropdowns: project, VCS branch, run configuration */
--h-toolbar-widget: 30px;
/* MainToolbar.Dropdown.borderInsets 5,10,5,6; AbstractToolbarCombo.iconTextGap 6 and
ToolbarComboButtonUI BEFORE_CHEVRON_GAP 2 before the 16px chevron. */
--toolbar-dropdown-pad-start: 10px;
--toolbar-dropdown-pad-end: 6px;
--toolbar-dropdown-gap: var(--space-1-5);
--toolbar-dropdown-chevron-gap: 2px;
/* tool window stripe button, icons only */
--stripe-icon-button: 30px;
--stripe-outer-padding: 4px;
/* StripeToolbar.Button.leftStripeIcon.padding 5,5,5,2: 5 to the window edge; on the island
side 2 plus the island's own border inset (Island.borderWidth 6 / 2 = 3). */
--stripe-outer-padding: 5px;
--stripe-inner-padding: 5px;
--h-header: 40px;
/* JBUI.CurrentTheme.ToolWindow.defaultHeaderHeight(): 41, no Islands override. */
--h-toolwindow-header: 41px;
@@ -357,7 +370,13 @@ html[data-os="windows"] {
--h-tab: 28px;
--h-row: 24px;
--h-list-row: 24px;
--h-statusbar: 30px;
/* WebStorm 2026.3 Islands with the navigation bar in the status bar: 34px, and the islands
end 3px above it (Island.borderWidth 6 / 2), the same inset they keep below the toolbar. */
--h-statusbar: 34px;
/* Status bar breadcrumbs sit 2.5px above the bar's middle in WebStorm 2026.3; compact mode's
StatusBar.Breadcrumbs.navBarInsets.compact 1,0,1,4 centres them. */
--statusbar-crumbs-lift: 5px;
--island-edge: 3px;
--h-navigationbar: 26px;
--h-field: 28px;
--h-button: 28px;
@@ -1599,7 +1618,12 @@ html[data-os="windows"] {
--h-row: 22px;
--h-list-row: 22px;
--h-statusbar: 24px;
--statusbar-crumbs-lift: 0px;
--island-edge: 2px;
--stripe-icon-button: 24px;
--stripe-outer-padding: 4px;
--stripe-inner-padding: 4px;
--titlebar-pad-top: 0px;
--h-field: 24px;
--h-button: 24px;
--fs-chrome: calc(var(--fs-ui) - 1px);
+9 -6
Переглянути файл
@@ -23,17 +23,20 @@
}
/* Status bar widget (StatusBar.Widget): UI font, secondary text, rounded hover. */
.status {
height: max(var(--h-statusbar) - 8px, var(--h-control-small));
margin: 0 -2px;
padding: 0 6px;
/* StatusBar.Widget.hoverInsets 3,4,1,4: the hover is 4px shorter than the bar. */
height: max(var(--h-statusbar) - 4px, var(--h-control-small));
margin: 0;
padding: 0 4px;
color: var(--fg-secondary);
font-size: var(--fs-chrome);
}
/* Main toolbar widget (project / VCS / run configuration). */
/* Main toolbar widget (project / VCS / run configuration): MainToolbar.Dropdown.borderInsets
and the combo's icon-text gap. */
.title {
gap: var(--toolbar-dropdown-gap);
height: var(--h-toolbar-widget);
margin: 0 -4px;
padding: 0 8px;
margin: 0;
padding: 0 var(--toolbar-dropdown-pad-end) 0 var(--toolbar-dropdown-pad-start);
border-radius: var(--radius-toolbar-dropdown);
color: var(--fg-strong);
}
+2
Переглянути файл
@@ -21,6 +21,8 @@
font-size: inherit;
color: inherit;
}
/* StatusBar.Widget.widgetInsets 6,8 with hoverInsets 3,4,1,4: the hover fills all but 4px of
each side, so the item keeps 4px and its button the other 4px around the text. */
.item {
flex: none;
display: flex;
+19 -20
Переглянути файл
@@ -3,17 +3,18 @@
flex: none;
display: flex;
align-items: center;
gap: var(--space-1);
padding: 0 8px 0 10px;
gap: var(--toolbar-item-gap);
padding: var(--titlebar-pad-top) 8px 0 10px;
white-space: nowrap;
-webkit-user-select: none;
user-select: none;
color: var(--fg-strong);
font-size: var(--fs-chrome);
}
/* Room for the native macOS traffic lights, including in full screen (#4746). */
/* Room for the native macOS traffic lights, including in full screen (#4746). WebStorm 2026.3's first
toolbar widget starts 83px in, its project badge at 93px. */
.overlay {
padding-left: max(82px, calc(82px / var(--titlebar-zoom, 1)));
padding-left: max(83px, calc(83px / var(--titlebar-zoom, 1)));
/* Keep the gear on the icon-only right stripe's centre line, including compact mode. */
padding-right: calc(var(--stripe-outer-padding) + (var(--stripe-icon-button) - var(--titlebar-tool-button)) / 2);
}
@@ -70,6 +71,10 @@
gap: var(--space-1);
min-width: 0;
}
/* A contribution that renders nothing takes no toolbar gap, as a hidden component in IDEA's toolbar. */
.item:empty {
display: none;
}
.bar > .widget,
.item:has([data-toolbar-label]) {
flex: none;
@@ -78,19 +83,10 @@
min-inline-size: 0;
max-inline-size: min(var(--toolbar-label-width, 100vw), var(--toolbar-label-max, 100vw));
}
/* Main toolbar dropdown widgets. */
/* Main toolbar dropdown widgets: BarButton's `title` variant gives the insets and gaps. */
.widget {
min-width: 0;
height: var(--h-toolbar-widget);
margin: 0;
padding: 0 8px;
border-radius: var(--radius-toolbar-dropdown);
color: var(--fg-strong);
font-size: var(--fs-chrome);
}
.widget {
gap: var(--space-1-5);
}
.widget:hover,
.widget[aria-expanded="true"] {
background: var(--bg-toolbar-hover);
@@ -102,6 +98,7 @@
}
.chevron {
flex: none;
margin-inline-start: calc(var(--toolbar-dropdown-chevron-gap) - var(--toolbar-dropdown-gap));
color: var(--fg-muted);
}
.avatar {
@@ -115,9 +112,10 @@
background: linear-gradient(135deg, var(--project-color), var(--project-color-end));
color: var(--fg-button-primary);
--icon-color: currentColor;
font-size: var(--fs-tiny);
font-weight: 600;
letter-spacing: 0.02em;
/* WebStorm 2026.3 draws the initials in JetBrains Mono at the label size (cap height 9.5px). */
font-family: var(--font-mono);
font-size: var(--fs-ui);
font-weight: 400;
}
/* IDEA compact: the avatar follows MainToolbar.Button.iconSize (20 → 16). */
.avatar:has(> img) {
@@ -126,7 +124,7 @@
:global(:root[data-compact]) .avatar {
width: 16px;
height: 16px;
font-size: 9px;
font-size: 10px;
}
.drag {
flex: 1;
@@ -143,8 +141,7 @@
.tools {
display: flex;
align-items: center;
gap: var(--space-1);
margin-left: 12px;
gap: var(--toolbar-item-gap);
}
.tool {
width: var(--titlebar-tool-button);
@@ -253,6 +250,8 @@
flex: none;
align-self: stretch;
display: flex;
/* Flush with the window's top edge, above the toolbar's top inset. */
margin-top: calc(-1 * var(--titlebar-pad-top));
margin-left: 8px;
}
.captionsLeft {
+2 -2
Переглянути файл
@@ -96,7 +96,7 @@ function ProjectButton() {
<span className={styles.widgetText} data-toolbar-label="">
{label}
</span>
<Icon name="chevron-down" size={12} className={styles.chevron} />
<Icon name="chevron-down" size={16} className={styles.chevron} />
</BarButton>
{Popup ? (
open && <Slot component={Popup} anchor={ref} onClose={() => setOpen(false)} />
@@ -134,7 +134,7 @@ function VcsFallback() {
<span className={styles.widgetText} data-toolbar-label="">
<T>Version Control</T>
</span>
<Icon name="chevron-down" size={12} className={styles.chevron} />
<Icon name="chevron-down" size={16} className={styles.chevron} />
</BarButton>
<Menu open={open} onClose={() => setOpen(false)} anchor={ref} items={items} aria-label="Version Control" />
</>
+9 -5
Переглянути файл
@@ -44,6 +44,9 @@
/* Undocked tool windows are positioned against the grid. */
position: relative;
flex: 1;
/* IDEA paints each island inside its bounds (Island.borderWidth / 2), so the editor and tool
windows keep that gap below the main toolbar and above the status bar. */
margin-block: var(--island-edge);
display: grid;
min-width: 0;
min-height: 0;
@@ -247,16 +250,17 @@
--stripe-button: var(--stripe-drag, var(--stripe-icon-button));
/* Outer padding: narrower than the island gap so the side frame stays close to the status bar's height, as in IDEA. */
--stripe-pad: var(--stripe-outer-padding);
width: calc(var(--stripe-button) + var(--stripe-pad) + var(--island-gap));
width: calc(var(--stripe-button) + var(--stripe-pad) + var(--stripe-inner-padding));
container-type: inline-size;
flex: none;
display: flex;
flex-direction: column;
align-items: center;
/* Icon buttons repeat at the title bar's height, so the title bar's Settings button reads as the right stripe's first one, as in IDEA. */
/* Icon buttons repeat at the title bar's height, so the title bar's Settings button reads as the right stripe's first one, as in IDEA.
The first button sits one pitch below the toolbar buttons, which keep --titlebar-pad-top above the bar's centre line. */
--stripe-gap: calc(var(--h-titlebar) - var(--stripe-icon-button));
gap: var(--stripe-gap);
padding: calc(var(--stripe-gap) / 2) 0 6px;
padding: calc((var(--stripe-gap) + var(--titlebar-pad-top)) / 2) 0 calc(var(--stripe-gap) / 2);
/* Transparent: stripes sit on the window frame so the project-colour wash flows from the title bar. */
background: transparent;
/* Short windows: scroll the buttons instead of clipping the last ones. */
@@ -274,10 +278,10 @@
}
.stripeSideLeft {
padding-left: var(--stripe-pad);
padding-right: var(--island-gap);
padding-right: var(--stripe-inner-padding);
}
.stripeSideRight {
padding-left: var(--island-gap);
padding-left: var(--stripe-inner-padding);
padding-right: var(--stripe-pad);
}
/* Drag the stripe's inner edge: wider shows names, narrow shows icons only. Hit area covers the stripe's gap. */