From e86a8530482cab6cc139f04f78a83ff7ffb9b329 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Fri, 20 Nov 2026 02:53:44 +0800 Subject: [PATCH] fix(run): keep configuration names visible in narrow sidebars (#4573) A long run target could take the whole row in the Run/Debug Configurations sidebar, leaving the configuration name at zero width and forcing horizontal scrolling. Target labels now truncate in wide panes, narrow panes (container query) hide the muted target and scope, and the row tooltip carries the full name, target, scope and command. Type headings are semibold. --- e2e/runConfigLayout.spec.ts | 28 +++++++++++++++++++++++--- src/features/run/EditConfigsDialog.tsx | 15 +++++++++----- src/features/run/Run.module.css | 18 +++++++++++++++++ 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/e2e/runConfigLayout.spec.ts b/e2e/runConfigLayout.spec.ts index 9c7ff7f70..fe6af50c8 100644 --- a/e2e/runConfigLayout.spec.ts +++ b/e2e/runConfigLayout.spec.ts @@ -1,8 +1,8 @@ import type { Page } from "@playwright/test"; import { expect, test } from "./fixtures"; -async function openConfigurations(page: Page) { - await page.evaluate(async () => { +async function openConfigurations(page: Page, target?: string) { + await page.evaluate(async (target) => { const path = "/src/features/run/store.ts"; const { useRun } = await import(/* @vite-ignore */ path); const base = { @@ -21,6 +21,7 @@ async function openConfigurations(page: Page) { ...base, id: "layout:app", name: "Payments development server", + target, beforeLaunch: [{ kind: "run", target: "layout:prepare" }], }, { ...base, id: "layout:prepare", name: "Prepare generated sources for the payments development server" }, @@ -29,10 +30,31 @@ async function openConfigurations(page: Page) { loaded: true, editorOpen: true, }); - }); + }, target); await expect(page.getByRole("dialog", { name: "Run/Debug Configurations", exact: true })).toBeVisible(); } +test("long run target names leave room for configuration names in the sidebar", async ({ workbench: page }) => { + const target = "payments-development-shared-staging-runner-west"; + await openConfigurations(page, target); + const dialog = page.getByRole("dialog", { name: "Run/Debug Configurations", exact: true }); + const tree = dialog.getByRole("tree", { name: "Run configurations", exact: true }); + const row = tree.getByRole("treeitem", { name: /^Payments development server/ }); + const name = row.getByText("Payments development server", { exact: true }); + const badge = row.getByText(`@ ${target}`, { exact: true }); + await expect(badge).toBeVisible(); + + for (const width of [1100, 520]) { + await page.setViewportSize({ width, height: 820 }); + await expect.poll(async () => (await name.boundingBox())!.width).toBeGreaterThan(width === 1100 ? 80 : 50); + await expect.poll(() => tree.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1); + } + + await expect(badge).toBeHidden(); + await expect(row).toHaveAttribute("title", new RegExp(`Payments development server @ ${target}`)); + await expect(dialog.getByRole("textbox", { name: "Name", exact: true })).toHaveValue("Payments development server"); +}); + test("run configuration sidebar resizes with mouse and keyboard and remembers the layout", async ({ workbench: page, }) => { diff --git a/src/features/run/EditConfigsDialog.tsx b/src/features/run/EditConfigsDialog.tsx index 6af849e4b..ea9b1d065 100644 --- a/src/features/run/EditConfigsDialog.tsx +++ b/src/features/run/EditConfigsDialog.tsx @@ -511,6 +511,7 @@ function EditConfigsDialog() { aria-expanded={!collapsed.has(r.key)} className={styles.editItem} style={{ paddingLeft: 6 }} + title={tx(r.label)} onClick={() => toggle(r.key)} onDragOver={(e) => e.preventDefault()} onDrop={(e) => onDrop(e, r.kind, null)} @@ -534,6 +535,7 @@ function EditConfigsDialog() { aria-expanded={!collapsed.has(r.key)} className={clsx(styles.editItem, sel && styles.editItemSelected)} style={{ paddingLeft: 22 }} + title={r.name} onClick={() => setSelection({ type: "folder", kind: r.kind, name: r.name })} onDoubleClick={() => toggle(r.key)} onDragOver={(e) => e.preventDefault()} @@ -547,6 +549,9 @@ function EditConfigsDialog() { } const c = r.config; const isTomcat = c.kind === "tomcat"; + const name = c.name || tx("Unnamed"); + const target = c.target ? targetName(c, runTargets) : null; + const scope = !c.detected && !isTomcat ? (c.local ? "local" : "user") : null; const tomcatNoArtifact = isTomcat && ((c.params?.deployment ?? "artifact") === "artifact" @@ -561,7 +566,9 @@ function EditConfigsDialog() { className={clsx(styles.editItem, current?.id === c.id && styles.editItemSelected)} style={{ paddingLeft: r.depth === 2 ? 50 : 34 }} onClick={() => setSelection({ type: "config", id: c.id })} - title={commandLine(c)} + title={[name + (target ? ` @ ${target}` : "") + (scope ? ` (${scope})` : ""), commandLine(c)] + .filter(Boolean) + .join("\n")} draggable onDragStart={(e) => { dragged.current = c.id; @@ -579,11 +586,9 @@ function EditConfigsDialog() { )} {c.name || Unnamed} - {c.target && @ {targetName(c, runTargets)}} + {target && @ {target}} {errorsById[c.id] && } - {!c.detected && !isTomcat && ( - {c.local ? "local" : "user"} - )} + {scope && {scope}} ); })} diff --git a/src/features/run/Run.module.css b/src/features/run/Run.module.css index 7a25c9a1a..b330f6e3e 100644 --- a/src/features/run/Run.module.css +++ b/src/features/run/Run.module.css @@ -553,6 +553,7 @@ flex: 1; } .editSidebar { + container: run-config-navigation / inline-size; min-height: 0; display: flex; flex-direction: column; @@ -596,6 +597,22 @@ background: var(--bg-selected-strong); color: var(--fg-strong); } +.editTarget { + flex: 0 1 auto; + min-width: 0; + max-width: 25%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.editItem .failed { + flex: none; +} +@container run-config-navigation (max-width: 220px) { + .editItem .chooserMuted { + display: none; + } +} .editForm { flex: 1; min-width: 0; @@ -701,6 +718,7 @@ } .editGroupName { color: var(--fg-strong); + font-weight: 600; } .editEmpty { flex: 1;