From 18cd2ef63b123827f3764c403be156d873f51430 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 20:51:55 +0800 Subject: [PATCH] fix(debugger): keep controls visible in narrow tool windows (#4507) Debug controls and view tabs wrap onto separate rows as the tool window narrows, and the action buttons use the standard control size, so every action and view stays reachable in a side pane. --- e2e/debugToolbarLayout.spec.ts | 27 +++++++ .../debugger/ui/DebugToolWindow.module.css | 26 +++++-- src/features/debugger/ui/DebugToolWindow.tsx | 75 ++++++++++--------- 3 files changed, 84 insertions(+), 44 deletions(-) create mode 100644 e2e/debugToolbarLayout.spec.ts diff --git a/e2e/debugToolbarLayout.spec.ts b/e2e/debugToolbarLayout.spec.ts new file mode 100644 index 000000000..50cc806df --- /dev/null +++ b/e2e/debugToolbarLayout.spec.ts @@ -0,0 +1,27 @@ +import { expect, test } from "./fixtures"; + +test("keeps debug actions and views accessible when the Debug window is docked at the side", async ({ + workbench: page, +}) => { + await page.setViewportSize({ width: 900, height: 760 }); + await page.evaluate(async () => { + const debugModule = "/src/features/debugger/state.ts"; + const layoutModule = "/src/workbench/toolwindows/store.ts"; + const servicesModule = "/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 */ servicesModule); + adoptSession(91, { name: "Checkout service", adapter: "java-debug", status: "starting" }); + moveToolWindow("debug", "right"); + setToolWindowSize("right", 300); + toolWindowService().show("debug", true); + }); + + const pane = page.getByRole("region", { name: "Debug", exact: true }); + const toolbar = pane.getByRole("toolbar", { name: "Debugger actions" }); + const views = pane.getByRole("tablist", { name: "Debug views" }); + await expect(toolbar.getByRole("button", { name: "More", exact: true })).toBeInViewport(); + await expect(views.getByRole("tab", { name: "Console", exact: true })).toBeInViewport(); + await views.getByRole("tab", { name: "Memory", exact: true }).click(); + await expect(views.getByRole("tab", { name: "Memory", exact: true })).toHaveAttribute("aria-selected", "true"); +}); diff --git a/src/features/debugger/ui/DebugToolWindow.module.css b/src/features/debugger/ui/DebugToolWindow.module.css index 4c5e5cddb..d94270b22 100644 --- a/src/features/debugger/ui/DebugToolWindow.module.css +++ b/src/features/debugger/ui/DebugToolWindow.module.css @@ -19,20 +19,28 @@ } .toolbar { - height: 32px; + min-height: 32px; flex: none; display: flex; + flex-wrap: wrap; align-items: center; - gap: var(--space-0-5); - padding: 0 8px 0 4px; + gap: var(--space-0-5) var(--space-2); + padding: var(--space-0-5) var(--space-2) var(--space-0-5) var(--space-1); border-bottom: 1px solid var(--border); min-width: 0; - overflow: hidden; +} + +.actions { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: var(--space-0-5); + min-width: 0; } .tool { - width: 26px; - height: 26px; + width: var(--h-control); + height: var(--h-control); flex: none; } @@ -46,17 +54,21 @@ .tabs { display: flex; + flex-wrap: wrap; align-items: center; gap: var(--space-0-5); - flex: none; + min-width: 0; } .tab { height: 24px; + max-inline-size: 100%; padding: 0 8px; border-radius: var(--radius-small); color: var(--fg); font-size: var(--fs-ui); + overflow: hidden; + text-overflow: ellipsis; white-space: nowrap; } .tab:hover { diff --git a/src/features/debugger/ui/DebugToolWindow.tsx b/src/features/debugger/ui/DebugToolWindow.tsx index f180cf1d3..21c16c433 100644 --- a/src/features/debugger/ui/DebugToolWindow.tsx +++ b/src/features/debugger/ui/DebugToolWindow.tsx @@ -16,6 +16,7 @@ import { SplitHandle, SplitPanel, Tabs, + Toolbar, showContextMenu, type MenuItem, type TabItem, @@ -218,43 +219,43 @@ export function DebugToolWindow() { return (
-
- {/* IDEA's XDebugger.ToolWindow.TopToolbar3 (+ its "More" group), then the views. */} - - - - - - - - - - {rootOf(active).adapter === "dart" && ( - <> - - - {rootOf(active).vmServiceUri && } - - - )} - - setMuted(!muted)} - /> - - +
+ + + + + + + + + + + {rootOf(active).adapter === "dart" && ( + <> + + + {rootOf(active).vmServiceUri && } + + + )} + + setMuted(!muted)} + /> + +
{( [