From b7f3df0472ac97e70cd439ccde606ad550bc849f Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Sun, 22 Nov 2026 20:32:52 +0800 Subject: [PATCH] fix(debugger): keep values readable beside long type labels (#5185) Keep debugger values readable beside long runtime types. The row reserves space for a value preview based on its length, so short values leave more room for names. A truncated type can still be read on hover, and the full type appears when the pane has room. --- e2e/debugVariablesLayout.spec.ts | 56 +++++++++++++++++++ .../debugger/ui/VariablesView.module.css | 8 +-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/e2e/debugVariablesLayout.spec.ts b/e2e/debugVariablesLayout.spec.ts index 90b6ad4ad..25bf89fb3 100644 --- a/e2e/debugVariablesLayout.spec.ts +++ b/e2e/debugVariablesLayout.spec.ts @@ -62,3 +62,59 @@ test("keeps values and their full-value action readable in a narrow debugger", a .poll(() => routing.getByText(routingValue, { exact: true }).evaluate((el) => el.scrollWidth <= el.clientWidth + 1)) .toBe(true); }); + +test("keeps a decimal value legible beside a long runtime type", async ({ workbench: page }) => { + const name = "dailySettlementTotal"; + const type = "ExactSettlementAmountForCrossBorderReconciliation"; + const value = "12486245.8067"; + const countName = "pendingInvoices"; + await page.setViewportSize({ width: 1100, height: 720 }); + await stubDesktop(page); + await page.evaluate( + async ({ name, type, value, countName }) => { + const debugModule = "/src/features/debugger/state.ts"; + const layoutModule = "/src/workbench/toolwindows/store.ts"; + const serviceModule = "/src/workbench/contributions.ts"; + const { adoptSession } = await import(/* @vite-ignore */ debugModule); + const { moveToolWindow, setToolWindowSize } = await import(/* @vite-ignore */ layoutModule); + const { toolWindowService } = await import(/* @vite-ignore */ serviceModule); + window.__ipc.handlers.debug_scopes = () => [{ name: "Locals", variablesReference: 100, expensive: false }]; + window.__ipc.handlers.debug_variables = () => [ + { name, value, typeName: type, variablesReference: 0, evaluateName: name }, + { name: countName, value: "327", typeName: "int", variablesReference: 0, evaluateName: countName }, + ]; + adoptSession(92, { + name: "Settlement", + adapter: "debugpy", + status: "paused", + selectedFrame: 11, + frames: [{ id: 11, name: "settle", path: null, line: 0, column: 0, presentationHint: null }], + }); + moveToolWindow("debug", "right"); + setToolWindowSize("right", 280); + toolWindowService().show("debug", true); + }, + { name, type, value, countName }, + ); + const debug = page.getByRole("region", { name: "Debug", exact: true }); + await debug.getByRole("tab", { name: "Threads & Variables", exact: true }).click(); + const variable = debug.getByRole("treeitem").filter({ hasText: name }); + const amount = variable.getByText(value, { exact: true }); + const annotation = variable.getByTitle(`{${type}}`, { exact: true }); + await expect(amount).toBeVisible(); + await expect.poll(() => amount.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1); + await expect(variable.getByTitle("Show", { exact: true })).toBeHidden(); + await expect(annotation).toBeVisible(); + + const shortValueName = debug.getByText(countName, { exact: true }); + await expect.poll(() => shortValueName.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1); + + await page.setViewportSize({ width: 1440, height: 760 }); + await page.evaluate(async () => { + const layoutModule = "/src/workbench/toolwindows/store.ts"; + const { moveToolWindow, setToolWindowSize } = await import(/* @vite-ignore */ layoutModule); + moveToolWindow("debug", "bottom"); + setToolWindowSize("bottom", 310); + }); + await expect.poll(() => annotation.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1); +}); diff --git a/src/features/debugger/ui/VariablesView.module.css b/src/features/debugger/ui/VariablesView.module.css index bf073dcf7..1f1ba19fe 100644 --- a/src/features/debugger/ui/VariablesView.module.css +++ b/src/features/debugger/ui/VariablesView.module.css @@ -55,7 +55,8 @@ display: flex; align-items: center; gap: var(--space-1); - min-width: min(8ch, 45%); + /* Cap the automatic flex minimum at the space needed for a short preview. */ + width: min(14ch, 50%); flex: 1 1 0; } @@ -135,9 +136,8 @@ } .type { - min-width: 0; - max-width: 25%; - flex: 0 1 auto; + min-width: min(3ch, 10%); + flex: 0 4 auto; overflow: hidden; text-overflow: ellipsis; color: var(--fg-subtle);