From 313a5f3a143c346a37d716267301df62f7900c75 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 20:53:41 +0800 Subject: [PATCH 01/11] fix(search): give Find in Files previews and scope controls room (#4510) Find in Files starts with a 33/67 results-to-preview split and remembers the user's split through the splitter's own storage, so a temporarily constrained window no longer overwrites it. Scope controls wrap below the tabs when they need more room. --- e2e/searchPopupsNarrow.spec.ts | 97 +++++++++++++------ .../search/find/FindInFiles.module.css | 8 +- src/features/search/find/FindInFiles.tsx | 12 +-- src/features/search/find/store.ts | 14 +-- 4 files changed, 78 insertions(+), 53 deletions(-) diff --git a/e2e/searchPopupsNarrow.spec.ts b/e2e/searchPopupsNarrow.spec.ts index 0a7eb31fd2..81c196c06d 100644 --- a/e2e/searchPopupsNarrow.spec.ts +++ b/e2e/searchPopupsNarrow.spec.ts @@ -13,6 +13,32 @@ async function run(page: Page, id: string) { }, id); } +async function stubFindMatches(page: Page) { + await stubDesktop(page); + await page.evaluate(() => { + window.__ipc.handlers.search_validate = () => null; + window.__ipc.handlers.search_start = (args) => { + const send = (event: unknown) => window.__ipc.send(args.onEvent, event); + const text = "base=http://localhost:8080"; + setTimeout(() => { + for (let i = 0; i < 12; i++) { + const relPath = `config/endpoint-${i}.txt`; + const matches = [{ line: 0, text, ranges: [[5, text.length]], textOffset: 0 }]; + send({ + type: "file", + file: { path: `/dev/acme-api/${relPath}`, relPath, matches }, + }); + } + send({ + type: "done", + summary: { files: 12, matches: 12, limitHit: false, cancelled: false, elapsedMs: 4 }, + }); + }, 20); + return null; + }; + }); +} + async function expectControlsFit(page: Page) { const dialog = page.getByRole("dialog"); await expect(dialog).toBeVisible(); @@ -42,35 +68,7 @@ test.describe("search popups at the minimum window width", () => { for (const id of ["find.inPath", "find.replaceInPath"]) { test(`${id} keeps its title, count and buttons visible`, async ({ workbench: page }) => { - await stubDesktop(page); - await page.evaluate(() => { - window.__ipc.handlers.search_validate = () => null; - window.__ipc.handlers.search_start = (args) => { - const send = (event: unknown) => window.__ipc.send(args.onEvent, event); - const text = "base=http://localhost:8080"; - setTimeout(() => { - for (let i = 0; i < 12; i++) { - const relPath = `config/endpoint-${i}.txt`; - const matches = [{ line: 0, text, ranges: [[5, text.length]], textOffset: 0 }]; - send({ - type: "file", - file: { path: `/dev/acme-api/${relPath}`, relPath, matches }, - }); - } - send({ - type: "done", - summary: { - files: 12, - matches: 12, - limitHit: false, - cancelled: false, - elapsedMs: 4, - }, - }); - }, 20); - return null; - }; - }); + await stubFindMatches(page); await run(page, id); await page.getByRole("dialog").getByPlaceholder("Search").fill("http://localhost:8080"); await expect(page.getByRole("dialog").locator("header [aria-live]")).toContainText(/match/); @@ -95,6 +93,19 @@ test.describe("search popups at the minimum window width", () => { }); } + test("directory scope gives the path field room at the minimum width", async ({ workbench: page }) => { + await stubDesktop(page); + await run(page, "find.inPath"); + const dialog = page.getByRole("dialog", { name: "Find in Files" }); + await dialog.getByRole("tab", { name: "Directory", exact: true }).click(); + const input = dialog.getByRole("textbox", { name: "Directory", exact: true }); + await expect(input).toBeVisible(); + const { width } = (await input.boundingBox())!; + expect(width).toBeGreaterThan(200); + await expectControlsFit(page); + await dialog.getByRole("button", { name: /Browse/ }).click({ trial: true }); + }); + for (const id of [ "navigate.searchEverywhere", "navigate.searchText", @@ -111,3 +122,31 @@ test.describe("search popups at the minimum window width", () => { }); } }); + +test("Find in Files prioritizes the preview and remembers an adjusted split", async ({ workbench: page }) => { + await stubFindMatches(page); + await run(page, "find.inPath"); + const dialog = page.getByRole("dialog", { name: "Find in Files" }); + await dialog.getByPlaceholder("Search").fill("http://localhost:8080"); + const results = dialog.locator("[data-panel][id=results]"); + const preview = dialog.locator("[data-panel][id=preview]"); + const handle = dialog.getByTestId("find-popup-split").getByRole("separator"); + const resultsShare = async () => { + const resultHeight = (await results.boundingBox())!.height; + const previewHeight = (await preview.boundingBox())!.height; + return resultHeight / (resultHeight + previewHeight); + }; + await expect(handle).toBeAttached(); + await expect.poll(resultsShare).toBeCloseTo(0.33, 2); + await handle.press("ArrowUp"); + await expect.poll(resultsShare).toBeLessThan(0.31); + const adjusted = await resultsShare(); + await page.setViewportSize({ width: 400, height: 500 }); + await expect.poll(resultsShare).toBeGreaterThan(adjusted + 0.02); + await dialog.getByPlaceholder("Search").press("Escape"); + await expect(dialog).toBeHidden(); + await page.setViewportSize({ width: 1400, height: 900 }); + await run(page, "find.inPath"); + await expect(handle).toBeAttached(); + await expect.poll(resultsShare).toBeCloseTo(adjusted, 2); +}); diff --git a/src/features/search/find/FindInFiles.module.css b/src/features/search/find/FindInFiles.module.css index 726c1f11f4..eafd00a7d2 100644 --- a/src/features/search/find/FindInFiles.module.css +++ b/src/features/search/find/FindInFiles.module.css @@ -106,18 +106,22 @@ --border-tab-selected: transparent; flex: none; display: flex; + flex-wrap: wrap; align-items: center; - gap: var(--space-3); + gap: var(--space-1) var(--space-3); padding: 8px 14px 4px 20px; } .scopeDetail { - flex: 1; + flex: 1 1 200px; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: var(--space-1); } +.scopeDetail:empty { + display: none; +} .dirInput { width: 100%; max-width: 420px; diff --git a/src/features/search/find/FindInFiles.tsx b/src/features/search/find/FindInFiles.tsx index 3c83ae6cd5..9cb96adb5d 100644 --- a/src/features/search/find/FindInFiles.tsx +++ b/src/features/search/find/FindInFiles.tsx @@ -67,6 +67,7 @@ import { import { SINGLE_FIRST, isRowSelected, selectRow, selectedRows, type RowSelection } from "./rowSelection"; import { FindSession, IDLE, matchRows, type FindState, type MatchRow } from "./session"; import { + FIND_POPUP_SPLIT_KEY, SEARCH_CONTEXTS, buildQuery, customScopeName, @@ -82,9 +83,7 @@ import { resolveFindScope, setFindPopupCommandHandler, loadFindPopupSize, - loadFindPopupSplit, saveFindPopupSize, - saveFindPopupSplit, setFindPopupNewTab, setFindPopupPinned, useFindPopup, @@ -165,11 +164,6 @@ function FindInFilesDialog() { const [previewMode, setPreviewMode] = useState(false); const [diffPreview, setDiffPreview] = useState<{ key: string; lines: PreviewLine[] } | null>(null); const [initialSize] = useState(loadFindPopupSize); - const [split, setSplit] = useState(loadFindPopupSplit); - const keepSplit = (layout: Record) => { - setSplit(layout); - saveFindPopupSplit(layout); - }; const [marks, setMarks] = useState(NO_MARKS); const [running, setRunning] = useState(null); const [progress, setProgress] = useState(null); @@ -869,8 +863,8 @@ function FindInFilesDialog() {
{rows.length ? ( - - + + {resultsBox} diff --git a/src/features/search/find/store.ts b/src/features/search/find/store.ts index afe189ffcc..300dc4bd90 100644 --- a/src/features/search/find/store.ts +++ b/src/features/search/find/store.ts @@ -98,9 +98,8 @@ export function setFindPopupNewTab(newTab: boolean) { } const SIZE_KEY = "openidea.search.findPopupSize.v1"; -const SPLIT_KEY = "openidea.search.findPopupSplit.v1"; +export const FIND_POPUP_SPLIT_KEY = "openidea.search.findPopupSplit.v1"; -/** The popup's size and its results / preview split, remembered like IDEA's. */ export function loadFindPopupSize(): { w: number; h: number } | null { const v = loadJson<{ w?: unknown; h?: unknown } | null>(SIZE_KEY, null); return typeof v?.w === "number" && typeof v.h === "number" ? { w: v.w, h: v.h } : null; @@ -110,17 +109,6 @@ export function saveFindPopupSize(size: { w: number; h: number }) { saveJson(SIZE_KEY, size); } -export function loadFindPopupSplit(): Record | undefined { - const v = loadJson(SPLIT_KEY, null); - return v && typeof v === "object" && Object.values(v).every((n) => typeof n === "number") - ? (v as Record) - : undefined; -} - -export function saveFindPopupSplit(layout: Record) { - saveJson(SPLIT_KEY, layout); -} - /** * Keys the popup handles that are also global shortcuts (⌘G / ⇧⌘G, F4 / ⌘↓, ⌥↓): * hidden actions bound later in the keymap win while the popup is open and From af281341b17c4fe4e8ac82c50cf03264f0a0265c Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 20:55:10 +0800 Subject: [PATCH 02/11] fix(run): keep console actions visible in short panes (#4511) Run session controls move above the console: Rerun, Stop, Clear All and configuration controls fit together in a short docked pane, the console gets the full width, and the toolbar wraps by action group in narrow panes. Sessions without lifecycle controls (services, debugger console) keep the vertical toolbar. --- e2e/console-ui.spec.ts | 2 +- e2e/run.spec.ts | 33 ++++++++++++++++ src/features/run/Run.module.css | 30 ++++++++++++++- src/features/run/RunView.tsx | 68 ++++++++++++++++++--------------- 4 files changed, 101 insertions(+), 32 deletions(-) diff --git a/e2e/console-ui.spec.ts b/e2e/console-ui.spec.ts index e2bb2e4b89..a7ea3aa806 100644 --- a/e2e/console-ui.spec.ts +++ b/e2e/console-ui.spec.ts @@ -30,7 +30,7 @@ for (const kind of ["run", "debug", "services-run", "services-debug", "stacktrac component = SessionPanel; props = { session: run.useRun.getState().sessions.find((s: { id: string }) => s.id === id), - ...(kind === "services-run" ? { onRerun: null, onDebug: null } : {}), + showLifecycle: kind === "run", }; } else if (kind === "debug" || kind === "services-debug") { const statePath = "/src/features/debugger/state.ts"; diff --git a/e2e/run.spec.ts b/e2e/run.spec.ts index 5369b435a4..0d6edf708d 100644 --- a/e2e/run.spec.ts +++ b/e2e/run.spec.ts @@ -81,6 +81,39 @@ test("⌘F2 stops a running process", async ({ workbench: page }) => { await expect(run.getByRole("tab", { name: "dev" })).toHaveAttribute("data-tooltip", /exit code 143$/); }); +test("a short Run pane has room for the full toolbar above the output", async ({ workbench: page }) => { + await page.setViewportSize({ width: 400, height: 500 }); + const output = "Watching for changes…"; + await stubRun(page, [{ kind: "stdout", text: `${output}\n` }], null); + await page.keyboard.press("Control+r"); + const run = page.getByRole("region", { name: "Run", exact: true }); + await expect(run.getByText(output)).toBeVisible(); + await page.evaluate(async () => { + const path = "/src/workbench/toolwindows/store.ts"; + const { setToolWindowSize } = await import(/* @vite-ignore */ path); + setToolWindowSize("bottom", 160); + }); + const toolbar = run.getByRole("toolbar", { name: "Run actions" }); + const clipped = await toolbar.evaluate((el) => { + const bar = el.getBoundingClientRect(); + return Array.from(el.querySelectorAll("button")).flatMap((button) => { + const box = button.getBoundingClientRect(); + return box.left < bar.left - 1 || box.right > bar.right + 1 || box.bottom > bar.bottom + 1 + ? [button.getAttribute("aria-label")] + : []; + }); + }); + expect(clipped).toEqual([]); + await expect(toolbar).toHaveAttribute("aria-orientation", "horizontal"); + const toolbarBox = (await toolbar.boundingBox())!; + const consoleBox = (await run.getByRole("log").boundingBox())!; + expect(consoleBox.y).toBeGreaterThanOrEqual(toolbarBox.y + toolbarBox.height - 1); + await toolbar.getByRole("button", { name: "Clear All" }).click(); + await expect(run.getByText(output)).toBeHidden(); + await toolbar.getByRole("button", { name: "Stop" }).click(); + await expect.poll(() => ipcCalls(page, "run_stop")).toEqual([{ id: RUN_ID }]); +}); + test("Go reruns keep each package's exact failures and the original configuration", async ({ workbench: page }) => { await stubDesktop(page); await page.evaluate(async () => { diff --git a/src/features/run/Run.module.css b/src/features/run/Run.module.css index 42d5408384..7a25c9a1a5 100644 --- a/src/features/run/Run.module.css +++ b/src/features/run/Run.module.css @@ -51,6 +51,10 @@ min-width: 0; } +.topToolbarSession { + flex-direction: column; +} + .toolbar { flex: none; width: 32px; @@ -69,12 +73,36 @@ .toolbar::-webkit-scrollbar { display: none; } -.toolbarSep { +.toolbarGroup { + display: flex; + flex: none; + flex-direction: inherit; + align-items: center; + gap: var(--space-0-5); + max-width: 100%; +} +.toolbarGroup + .toolbarGroup::before { + content: ""; width: 16px; height: 1px; margin: 3px 0; background: var(--border-strong); } +.topToolbarSession .toolbar { + width: auto; + flex-direction: row; + flex-wrap: wrap; + gap: var(--space-0-5) var(--space-2); + padding: var(--space-0-5) var(--space-1); + border-right: none; + border-bottom: 1px solid var(--border); +} +.topToolbarSession .toolbarGroup { + flex-wrap: wrap; +} +.topToolbarSession .toolbarGroup::before { + display: none; +} .sessionBody { flex: 1; diff --git a/src/features/run/RunView.tsx b/src/features/run/RunView.tsx index faade49bda..eb77d7a7ab 100644 --- a/src/features/run/RunView.tsx +++ b/src/features/run/RunView.tsx @@ -1,4 +1,5 @@ import { useEffect, useMemo, useRef, useState } from "react"; +import clsx from "clsx"; import type { RunConfig } from "@/platform/ipc"; import type { RunTargetValid } from "@/platform/remoteSettings"; import { useAgentRunSettings, useWorkflowSettings } from "@/platform/workflowSettings"; @@ -181,10 +182,15 @@ export function SessionPanel({ ); return ( -
-
+
+
{showLifecycle && ( - <> +
)} -
- +
)} - {!rt.terminal && ( - <> - setFindOpen((v) => !v)} - /> - setFollow((v) => !v)} - /> - - - )} - clearConsole(session.id)} /> -
- void executeAction("run.editConfigs", session.config.id)} - /> +
+ {!rt.terminal && ( + <> + setFindOpen((v) => !v)} + /> + setFollow((v) => !v)} + /> + + + )} + clearConsole(session.id)} /> +
+
+ void executeAction("run.editConfigs", session.config.id)} + /> +
{rt.tests ? ( From c7ad3459c4b5d51d49d9d4edbed2d1e6091f0433 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 20:56:31 +0800 Subject: [PATCH 03/11] fix(vcs): fit Git Log controls in narrow panes (#4512) Git Log gives the text filter its own row when the commit pane gets narrow; the other filters stay in More Filters and the action buttons wrap inside the pane, so Refresh, View Options and Go to Hash/Branch/Tag stay usable with the branch and details panes open. --- e2e/gitLogToolbarMenus.spec.ts | 27 +++ src/features/vcs/GitLog.module.css | 41 ++++- src/features/vcs/log/FilterBar.tsx | 259 +++++++++++++++-------------- 3 files changed, 195 insertions(+), 132 deletions(-) diff --git a/e2e/gitLogToolbarMenus.spec.ts b/e2e/gitLogToolbarMenus.spec.ts index 32b670e447..80f234847b 100644 --- a/e2e/gitLogToolbarMenus.spec.ts +++ b/e2e/gitLogToolbarMenus.spec.ts @@ -94,3 +94,30 @@ test("a second click on a Git Log toolbar button closes its popup", async ({ wor await expect(row).toBeHidden(); } }); + +test("Git Log keeps filters and actions inside the commit pane at the minimum window width", async ({ + workbench: page, +}) => { + await page.setViewportSize({ width: 400, height: 500 }); + const toolbar = page.getByRole("toolbar", { name: "Log filters" }); + const clippedButtons = () => + toolbar.evaluate((el) => { + const bar = el.getBoundingClientRect(); + return Array.from(el.querySelectorAll("button")) + .filter((button) => { + if (getComputedStyle(button).visibility === "hidden") return false; + const box = button.getBoundingClientRect(); + return box.width > 0 && (box.right > bar.right + 1 || box.bottom > bar.bottom + 1); + }) + .map((button) => button.getAttribute("aria-label")); + }); + await expect.poll(clippedButtons).toEqual([]); + const search = toolbar.getByRole("textbox", { name: "Filter by message" }); + await expect(search).toBeVisible(); + expect((await search.boundingBox())!.width).toBeGreaterThan(12); + await toolbar.getByRole("button", { name: "View Options" }).click(); + await expect(page.getByRole("menuitemcheckbox", { name: "Tag Names" })).toBeVisible(); + await page.keyboard.press("Escape"); + await toolbar.getByRole("button", { name: "More Filters" }).click(); + await expect(page.getByRole("menuitem", { name: "Paths" })).toBeVisible(); +}); diff --git a/src/features/vcs/GitLog.module.css b/src/features/vcs/GitLog.module.css index aac9112893..038267ae0b 100644 --- a/src/features/vcs/GitLog.module.css +++ b/src/features/vcs/GitLog.module.css @@ -14,6 +14,7 @@ min-height: 0; } .log { + container: git-log / inline-size; height: 100%; min-height: 0; display: flex; @@ -75,14 +76,32 @@ /* filters */ .filters { - gap: var(--space-1); - padding: 0 8px 0 6px; + height: auto; + min-height: 32px; + flex-wrap: wrap; + justify-content: flex-end; + gap: var(--space-0-5) var(--space-1); + padding: var(--space-0-5) 8px var(--space-0-5) 6px; min-width: 0; - overflow: hidden; +} +.filterControls, +.filterActions { + display: flex; + align-items: center; + gap: var(--space-1); +} +.filterControls { + flex: 1 1 260px; + min-width: 0; +} +.filterActions { + flex-wrap: wrap; + justify-content: flex-end; + max-width: 100%; } .textFilter { flex: 0 1 260px; - min-width: 100px; + min-width: min(100px, 60%); } .filterGroup { position: relative; @@ -96,6 +115,20 @@ .filterHidden { visibility: hidden; } +@container git-log (max-width: 320px) { + .filterControls, + .filterActions { + display: contents; + } + .textFilter { + flex: 1 0 100%; + } + /* Keep the filters measurable for the overflow menu. */ + .filterGroup { + position: absolute; + width: 0; + } +} .filterButton { flex: none; height: 24px; diff --git a/src/features/vcs/log/FilterBar.tsx b/src/features/vcs/log/FilterBar.tsx index fb5ab9de98..157b28cd79 100644 --- a/src/features/vcs/log/FilterBar.tsx +++ b/src/features/vcs/log/FilterBar.tsx @@ -293,55 +293,57 @@ export function FilterBar() { return (
- {!showBranches && ( - - )} - setLogFilters({ regex }), - }, - { - id: "case", - icon: "case", - title: "Match Case", - pressed: filters.matchCase, - onToggle: (matchCase) => setLogFilters({ matchCase }), - }, - ]} - /> - - {logFilters.map((f, i) => ( - - {hiddenFrom < logFilters.length && ( - { - const anchor = e.currentTarget; - menuBelow( - anchor, - logFilters.slice(hiddenFrom).map((f) => ({ - label: f.value ? `${tx(f.label)}: ${f.value}` : f.label, - run: () => f.onOpen(anchor), - })), - ); - }} +
+ {!showBranches && ( + + )} + setLogFilters({ regex }), + }, + { + id: "case", + icon: "case", + title: "Match Case", + pressed: filters.matchCase, + onToggle: (matchCase) => setLogFilters({ matchCase }), + }, + ]} /> - )} + + {logFilters.map((f, i) => ( + + {hiddenFrom < logFilters.length && ( + { + const anchor = e.currentTarget; + menuBelow( + anchor, + logFilters.slice(hiddenFrom).map((f) => ({ + label: f.value ? `${tx(f.label)}: ${f.value}` : f.label, + run: () => f.onOpen(anchor), + })), + ); + }} + /> + )} +
{dropdown} {branchAnchor && ( void selectBranches()} /> )} - - - menuBelow( - e, - Object.entries(bookmarks).map(([key, summary]) => ({ - label: summary, - run: () => { - const split = key.lastIndexOf("\0"); - void goToRef(key.slice(split + 1), split >= 0 ? key.slice(0, split) : undefined); +
+ + menuBelow( + e, + Object.entries(bookmarks).map(([key, summary]) => ({ + label: summary, + run: () => { + const split = key.lastIndexOf("\0"); + void goToRef(key.slice(split + 1), split >= 0 ? key.slice(0, split) : undefined); + }, + })), + ) + } + /> + + menuBelow(e, [ + { + label: "In Tool Window", + run: () => { + openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`); + }, }, - })), - ) - } - /> - - menuBelow(e, [ - { - label: "In Tool Window", - run: () => { - openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`); + { + label: "In Editor", + run: () => { + openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`, "editor"); + }, }, - }, - { - label: "In Editor", - run: () => { - openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`, "editor"); - }, - }, - { label: "External Repository…", run: openExternalLog }, - ]) - } - /> - - menuBelow( - e, - recentLogFilters().map((filters) => ({ - label: - [ - filters.range, - filters.branches.join(", "), - filters.authors.join(", "), - filters.text, - filters.path, - filters.paths?.join(", "), - filters.date?.label, - ] - .filter(Boolean) - .join(" · ") || tx("All commits"), - run: () => setLogFilters(filters), - })), - ) - } - /> - void reloadLog({ preserve: true })} /> - menuBelow(e, graphOptionsMenu(useLogOptions.getState()))} - /> - menuBelow(e, viewOptionsMenu(useLogOptions.getState()))} - /> - + { label: "External Repository…", run: openExternalLog }, + ]) + } + /> + + menuBelow( + e, + recentLogFilters().map((filters) => ({ + label: + [ + filters.range, + filters.branches.join(", "), + filters.authors.join(", "), + filters.text, + filters.path, + filters.paths?.join(", "), + filters.date?.label, + ] + .filter(Boolean) + .join(" · ") || tx("All commits"), + run: () => setLogFilters(filters), + })), + ) + } + /> + void reloadLog({ preserve: true })} /> + menuBelow(e, graphOptionsMenu(useLogOptions.getState()))} + /> + menuBelow(e, viewOptionsMenu(useLogOptions.getState()))} + /> + +
); } From 0cf0e93d92bddb07b55f841fb3b728fcf984b2c7 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 20:56:59 +0800 Subject: [PATCH 04/11] fix(settings): give settings forms more room (#4515) Settings starts with 22.5% of its width for navigation instead of a fixed 240px, giving the current form more room at the default window size while leaving space for long labels such as Build, Execution, Deployment. A user-resized divider is still remembered. --- e2e/settingsFormLayout.spec.ts | 1 + src/features/settings/dialog/SettingsDialog.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/settingsFormLayout.spec.ts b/e2e/settingsFormLayout.spec.ts index cf7056671b..0568de3d18 100644 --- a/e2e/settingsFormLayout.spec.ts +++ b/e2e/settingsFormLayout.spec.ts @@ -72,6 +72,7 @@ test("settings sidebar resizes with mouse and keyboard and remembers its width", await expect(handle).toBeVisible(); const sidebar = dialog.locator("#navigation"); const initial = (await sidebar.boundingBox())!.width; + expect(initial / (await dialog.getByTestId("settings").boundingBox())!.width).toBeCloseTo(0.225, 2); const box = (await handle.boundingBox())!; await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2); await page.mouse.down(); diff --git a/src/features/settings/dialog/SettingsDialog.tsx b/src/features/settings/dialog/SettingsDialog.tsx index 6d51722425..277accaeae 100644 --- a/src/features/settings/dialog/SettingsDialog.tsx +++ b/src/features/settings/dialog/SettingsDialog.tsx @@ -321,7 +321,7 @@ export function SettingsLayout() { return ( - + Date: Thu, 19 Nov 2026 20:58:36 +0800 Subject: [PATCH 05/11] fix(vcs): improve Commit panel layout and message typography (#4518) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Commit panel wraps change actions into groups when the pane is narrow, so Expand All and Collapse All stay visible, and Commit and Push… wraps its label instead of cutting it. The commit message uses the editor's font family, size, weight and line height. --- e2e/commit.spec.ts | 56 ++++++++++ src/features/vcs/CommitView.module.css | 35 ++++-- src/features/vcs/CommitView.tsx | 143 ++++++++++++++----------- 3 files changed, 163 insertions(+), 71 deletions(-) diff --git a/e2e/commit.spec.ts b/e2e/commit.spec.ts index 8a54125031..12600e7dbf 100644 --- a/e2e/commit.spec.ts +++ b/e2e/commit.spec.ts @@ -98,3 +98,59 @@ test("commit message history opens above the message without an empty icon colum expect(Math.abs(menuBox!.x - messageBox!.x)).toBeLessThan(2); await expect(row.locator("span")).toHaveCount(1); }); + +test("the Commit changes toolbar fits a narrow side pane", async ({ workbench: page }) => { + await stubRepository(page); + await page.keyboard.press("Meta+k"); + await page.evaluate(async () => { + const path = "/src/workbench/toolwindows/store.ts"; + const layout = await import(/* @vite-ignore */ path); + layout.moveToolWindow("commit", "left"); + layout.setToolWindowSize("left", 164); + }); + const panel = page.getByRole("region", { name: "Commit", exact: true }); + const toolbar = panel.getByRole("toolbar", { name: "Changes" }); + await expect(toolbar).toBeVisible(); + const clipped = await toolbar.evaluate((bar) => { + const bounds = bar.getBoundingClientRect(); + return [...bar.querySelectorAll("button")].flatMap((button) => { + const box = button.getBoundingClientRect(); + return box.right > bounds.right + 1 || box.bottom > bounds.bottom + 1 ? [button.ariaLabel] : []; + }); + }); + expect(clipped).toEqual([]); + const push = panel.getByRole("button", { name: "Commit and Push…" }); + const overflow = await push.locator("span").evaluate((label) => label.scrollWidth - label.clientWidth); + expect(overflow).toBeLessThanOrEqual(1); + await toolbar.getByRole("button", { name: "Collapse All" }).click(); + await expect(panel.getByRole("checkbox", { name: "Include build.gradle.kts in commit" })).toBeHidden(); +}); + +test("the commit message uses the configured editor typography", async ({ workbench: page }) => { + await stubRepository(page); + await page.keyboard.press("Meta+k"); + const message = page.getByRole("textbox", { name: "Commit message" }); + await expect(message).toBeFocused(); + await page.evaluate(async () => { + const path = "/src/platform/project.ts"; + const { useProject } = await import(/* @vite-ignore */ path); + const settings = useProject.getState().settings; + useProject.setState({ + settings: { + ...settings, + editor: { + ...settings?.editor, + fontFamily: "Fira Code", + fallbackFont: "Maple Mono NF CN", + fontSize: 17, + lineHeight: 28, + fontWeight: 500, + }, + }, + }); + }); + await expect(message).toHaveCSS("font-size", "17px"); + await expect(message).toHaveCSS("line-height", "28px"); + await expect(message).toHaveCSS("font-weight", "500"); + await expect(message).toHaveCSS("font-family", /"Fira Code".*"Maple Mono NF CN"/); +}); diff --git a/src/features/vcs/CommitView.module.css b/src/features/vcs/CommitView.module.css index c1f917a9f3..ba4840a9e8 100644 --- a/src/features/vcs/CommitView.module.css +++ b/src/features/vcs/CommitView.module.css @@ -26,6 +26,20 @@ gap: var(--space-0-5); padding: 0 6px; } +.changesToolbar { + height: auto; + min-height: 32px; + flex-wrap: wrap; + column-gap: var(--space-2); + padding-block: var(--space-0-5); +} +.changesTools { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: var(--space-0-5); + max-width: 100%; +} .sep { width: 1px; height: 16px; @@ -106,13 +120,12 @@ } .commitBar { flex: none; - height: 32px; + min-height: 32px; display: flex; + flex-wrap: wrap; align-items: center; - gap: var(--space-1); - padding: 0 6px 0 12px; - white-space: nowrap; - overflow: hidden; + gap: var(--space-0-5) var(--space-1); + padding: var(--space-0-5) 6px var(--space-0-5) 12px; } .grow { flex: 1; @@ -121,6 +134,7 @@ color: var(--fg-faint); font-family: var(--font-mono); font-size: var(--fs-tiny); + white-space: nowrap; } .lineLenWarn { color: var(--warning); @@ -136,8 +150,6 @@ border-top: 1px solid var(--border); outline: none; color: var(--fg-strong); - font-family: var(--font-mono); - font-size: var(--fs-code); line-height: var(--lh-code); -webkit-user-select: text; user-select: text; @@ -164,7 +176,6 @@ display: flex; align-items: center; gap: var(--space-2); - /* A narrow panel moves Commit and Push… to its own row rather than cutting its label. */ flex-wrap: wrap; padding: 8px 6px 10px 10px; white-space: nowrap; @@ -175,10 +186,14 @@ .commitActions > .pushButton { flex: 0 1 auto; min-width: 0; + min-height: var(--h-button, 28px); + height: auto; + padding: var(--space-1) var(--space-3); + line-height: 1.3; } .pushButton > span { - overflow: hidden; - text-overflow: ellipsis; + white-space: normal; + overflow-wrap: anywhere; } .stashList { flex: 1; diff --git a/src/features/vcs/CommitView.tsx b/src/features/vcs/CommitView.tsx index 325e1543c4..c8c6f989aa 100644 --- a/src/features/vcs/CommitView.tsx +++ b/src/features/vcs/CommitView.tsx @@ -18,7 +18,9 @@ import { import { tx, txTemplate } from "@/platform/i18n"; import clsx from "clsx"; import { executeAction } from "@/platform/actions"; -import { basename, dirname } from "@/platform/project"; +import { fontWeightOf } from "@/platform/editorSettings"; +import { resolveMonoFont } from "@/platform/fonts"; +import { basename, dirname, useProject } from "@/platform/project"; import { isTestFile, useEffectiveRoots } from "@/platform/projectRoots"; import { Button, @@ -763,68 +765,79 @@ export function ChangesTree({ mode }: { mode: "commit" | "local" | "dialog" }) { return (
-
- void refreshNow()} /> - {mode === "local" && } - - {mode === "local" && } - {mode !== "dialog" && } - - viewRef.current && - showContextMenu(bottomLeft(viewRef.current), [ - { kind: "header", label: "Group By" }, - { label: "Directory", checked: groupByDir, run: () => setGroupByDir(!groupByDir) }, - // IDEA offers it once the project has several repositories. - ...(repos.length > 1 - ? [{ label: "Repository", checked: groupByRepo, run: () => setGroupByRepo(!groupByRepo) }] - : []), - ...(staging - ? [] - : [{ label: "Staging State", checked: groupByStaging, run: () => setGroupByStaging(!groupByStaging) }]), - { kind: "separator" }, - { - label: "Show Unversioned Files Separately", - checked: showUnversionedSeparately, - run: () => setShowUnversionedSeparately(!showUnversionedSeparately), - }, - ...(mode === "local" - ? [ - { kind: "separator" } as const, - { label: "Show Diff Preview", checked: diffPreview, run: () => setDiffPreview(!diffPreview) }, - ] - : []), - // Not in the Commit dialog, whose files always open as source. - ...(mode === "dialog" ? [] : doubleClickMenu(doubleClickOpensDiff)), - ]) - } - /> - {/* WebStorm's Preview Diff: an embedded diff of the selection beside the changes (#1599). */} - {mode === "commit" && ( +
+
+ void refreshNow()} /> + {mode === "local" && } + + {mode === "local" && } + {mode !== "dialog" && } setCommitDiffPreview(!commitDiffPreview)} + aria-haspopup="menu" + onClick={() => + viewRef.current && + showContextMenu(bottomLeft(viewRef.current), [ + { kind: "header", label: "Group By" }, + { label: "Directory", checked: groupByDir, run: () => setGroupByDir(!groupByDir) }, + // IDEA offers it once the project has several repositories. + ...(repos.length > 1 + ? [{ label: "Repository", checked: groupByRepo, run: () => setGroupByRepo(!groupByRepo) }] + : []), + ...(staging + ? [] + : [ + { + label: "Staging State", + checked: groupByStaging, + run: () => setGroupByStaging(!groupByStaging), + }, + ]), + { kind: "separator" }, + { + label: "Show Unversioned Files Separately", + checked: showUnversionedSeparately, + run: () => setShowUnversionedSeparately(!showUnversionedSeparately), + }, + ...(mode === "local" + ? [ + { kind: "separator" } as const, + { label: "Show Diff Preview", checked: diffPreview, run: () => setDiffPreview(!diffPreview) }, + ] + : []), + // Not in the Commit dialog, whose files always open as source. + ...(mode === "dialog" ? [] : doubleClickMenu(doubleClickOpensDiff)), + ]) + } /> - )} - - {mode !== "dialog" && ( - - )} - setCollapsed(new Set())} /> - setCollapsed(new Set([...byKey.values()].filter((n) => n.type !== "file").map((n) => n.key)))} - /> + {/* WebStorm's Preview Diff: an embedded diff of the selection beside the changes (#1599). */} + {mode === "commit" && ( + setCommitDiffPreview(!commitDiffPreview)} + /> + )} +
+
+ {mode !== "dialog" && ( + + )} + setCollapsed(new Set())} /> + + setCollapsed(new Set([...byKey.values()].filter((n) => n.type !== "file").map((n) => n.key))) + } + /> +
{mode !== "dialog" && }
s.vcs.commit); + const editor = useProject((s) => s.settings?.editor); + const { family, size } = resolveMonoFont(undefined, editor); const first = message.split("\n")[0] ?? ""; const tooLong = cfg.limitSubject && first.length > cfg.subjectLimit; const problems = messageProblems(message, cfg).filter((p) => !p.startsWith("Subject line")); @@ -1182,7 +1197,13 @@ export function CommitMessageField({ data-autofocus={autoFocus ? "" : undefined} className={clsx(styles.message, !showMargin && styles.noMargin, emptyError && styles.messageError)} aria-invalid={emptyError || undefined} - style={{ ["--guide" as string]: `${margin}ch` }} + style={{ + ["--guide" as string]: `${margin}ch`, + fontFamily: family, + fontSize: size, + fontWeight: fontWeightOf(editor?.fontWeight, 400), + lineHeight: editor?.lineHeight ? `${editor.lineHeight}px` : undefined, + }} value={message} placeholder={tx("Commit Message")} aria-label={tx("Commit message")} From b3f8cec272f893984b5840d3d391c01a38ffbeae Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 21:01:13 +0800 Subject: [PATCH 06/11] fix(updates): don't hold the update lock while asking which window is focused (#4523) The automatic update announcement held updates.ready while asking a window whether it is focused (a main-thread round trip); a window starting up ran app_update_window_ready on the main thread and waited for the same lock, freezing startup with no window. The focused and live windows are now read before taking the lock. --- src-tauri/src/updates.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/updates.rs b/src-tauri/src/updates.rs index fe714bcbd3..a3d5304468 100644 --- a/src-tauri/src/updates.rs +++ b/src-tauri/src/updates.rs @@ -139,11 +139,14 @@ fn announce_available(app: &AppHandle) { return; } let state = app.state::(); + // Asking a window whether it is focused waits for the main thread, where + // `app_update_window_ready` takes `ready`: never hold the lock across it. + let focused = crate::windows::target_window(app); + let live = crate::windows::project_window_labels(app); let owner = { let mut ready = state.updates.ready.lock(); ready.retain(|label| app.get_webview_window(label).is_some()); - let focused = crate::windows::target_window(app); - ready_owner(focused.as_ref().map(|window| window.label()), &crate::windows::project_window_labels(app), &ready) + ready_owner(focused.as_ref().map(|window| window.label()), &live, &ready) }; let Some(owner) = owner else { return }; let update = { From a57e12dbc5452181ba380bec1259b590e2366859 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 21:07:43 +0800 Subject: [PATCH 07/11] fix(http): don't rescan Spring routes on every keystroke (#4525) Typing in a Java/Kotlin file rescanned every Spring mapping source once per keystroke: Feign navigation dropped the route index on each docChanged (it already overlays unsaved text), and editor endpoint icons re-queried every provider, Spring included, on each change though they show only plugin endpoints. Typing now keeps the disk index; icons ask only plugin providers after typing pauses. --- src/features/http-client/endpoints.test.ts | 34 +++++++++++++++++-- src/features/http-client/endpoints.ts | 17 ++++++++-- .../spring/feignNavigation.test.ts | 9 +++++ .../http-client/spring/feignNavigation.ts | 18 +++++++--- src/workbench/contributions.ts | 10 ++++-- 5 files changed, 76 insertions(+), 12 deletions(-) diff --git a/src/features/http-client/endpoints.test.ts b/src/features/http-client/endpoints.test.ts index 6d96ca8262..830e9e2652 100644 --- a/src/features/http-client/endpoints.test.ts +++ b/src/features/http-client/endpoints.test.ts @@ -1,9 +1,10 @@ -import { describe, expect, it } from "vitest"; +import { describe, expect, it, vi } from "vitest"; import { CompletionContext } from "@codemirror/autocomplete"; import { EditorState } from "@codemirror/state"; +import { EditorView } from "@codemirror/view"; import { useProject } from "@/platform/project"; import { registerEndpointProvider, searchEndpoints, type EndpointEntry } from "@/workbench/contributions"; -import { completionTarget, endpointCompletion, renderEndpoint } from "./endpoints"; +import { completionTarget, endpointCompletion, endpointEditorExtension, renderEndpoint } from "./endpoints"; const route: EndpointEntry = { method: "GET", @@ -70,4 +71,33 @@ describe("shared HTTP endpoints", () => { useProject.setState(previous); } }); + + it("asks only plugin providers for editor icons, once typing pauses", async () => { + vi.useFakeTimers(); + const previous = useProject.getState(); + useProject.setState({ project: { root: "/p" } as NonNullable }); + const scan = vi.fn(async () => [route]); + const plugin = vi.fn(async () => [{ ...route, pluginId: "demo", path: "/p/Users.java" }]); + const disposeScan = registerEndpointProvider({ id: "http.spring", endpoints: scan }); + const disposePlugin = registerEndpointProvider({ id: "plugin:demo", endpoints: plugin }); + const ctx = { doc: 1, path: "/p/Users.java", language: "java", uiMode: null, readOnly: false }; + const view = new EditorView({ + state: EditorState.create({ doc: "class Users {}", extensions: endpointEditorExtension(ctx) }), + }); + try { + await vi.runAllTimersAsync(); + plugin.mockClear(); + for (const ch of "abc") view.dispatch({ changes: { from: 0, insert: ch } }); + expect(plugin).not.toHaveBeenCalled(); + await vi.runAllTimersAsync(); + expect(plugin).toHaveBeenCalledTimes(1); + expect(scan).not.toHaveBeenCalled(); + } finally { + view.destroy(); + disposeScan(); + disposePlugin(); + useProject.setState(previous); + vi.useRealTimers(); + } + }); }); diff --git a/src/features/http-client/endpoints.ts b/src/features/http-client/endpoints.ts index 169d7bdb08..2e3cd8b6fa 100644 --- a/src/features/http-client/endpoints.ts +++ b/src/features/http-client/endpoints.ts @@ -72,6 +72,9 @@ export async function endpointCompletion(context: CompletionContext): Promise id.startsWith("plugin:"); + type Mark = { pos: number; endpoints: EndpointEntry[] }; const setMarks = StateEffect.define(); const marks = StateField.define({ @@ -112,18 +115,25 @@ export function endpointEditorExtension(ctx: EditorDocContext): Extension { destroyed = false; unsubscribe: () => void; projectUnsubscribe: () => void; + timer: ReturnType | undefined; constructor(readonly view: EditorView) { this.unsubscribe = onEndpointsChanged(() => this.refresh()); - this.projectUnsubscribe = useProject.subscribe(() => this.refresh()); + this.projectUnsubscribe = useProject.subscribe((state, previous) => { + if (state.project !== previous.project) this.refresh(); + }); this.refresh(); } update(u: { docChanged: boolean }) { - if (u.docChanged) this.refresh(); + if (!u.docChanged) return; + clearTimeout(this.timer); + this.timer = setTimeout(() => this.refresh(), REFRESH_DELAY); } refresh() { + clearTimeout(this.timer); const seq = ++this.seq; const root = useProject.getState().project?.root ?? null; - void searchEndpoints(root).then((entries) => { + // Only plugin endpoints get icons here; built-in providers (Spring) scan the project. + void searchEndpoints(root, isPluginProvider).then((entries) => { if (this.destroyed || seq !== this.seq) return; const byLine = new Map(); for (const e of entries) { @@ -136,6 +146,7 @@ export function endpointEditorExtension(ctx: EditorDocContext): Extension { } destroy() { this.destroyed = true; + clearTimeout(this.timer); this.unsubscribe(); this.projectUnsubscribe(); } diff --git a/src/features/http-client/spring/feignNavigation.test.ts b/src/features/http-client/spring/feignNavigation.test.ts index 0436af814c..27f47e1045 100644 --- a/src/features/http-client/spring/feignNavigation.test.ts +++ b/src/features/http-client/spring/feignNavigation.test.ts @@ -101,6 +101,15 @@ describe("core service-aware Feign navigation", () => { expect(await resolve()).toEqual([]); // Current source revalidation rejects the cached target. }); + it("keeps the disk index while a controller is edited", async () => { + await resolve(); + for (let version = 2; version < 6; version++) { + _emitEditorEvent({ type: "docChanged", doc: 9, path: users, baseVersion: version - 1, version, changes: [] }); + await resolve(); + } + expect(commands.springRouteSources).toHaveBeenCalledTimes(1); + }); + it("overlays recently edited unsaved controllers absent from the disk index", async () => { await resolve(); const path = "/p/users/src/main/kotlin/Added.kt"; diff --git a/src/features/http-client/spring/feignNavigation.ts b/src/features/http-client/spring/feignNavigation.ts index debe698e3a..09adfd344d 100644 --- a/src/features/http-client/spring/feignNavigation.ts +++ b/src/features/http-client/spring/feignNavigation.ts @@ -39,12 +39,16 @@ function inside(project: ProjectInfo, path: string): boolean { async function read(path: string): Promise { return editorsFor(path)[0]?.view.state.doc.toString() ?? (await call(commands.fsReadText(path))); } -function invalidate() { +/** Forgets resolved targets and service names; the disk route index stays. */ +function refresh() { epoch++; serviceNames.clear(); - clearRouteIndex(); invalidateNavigationProviders(); } +function invalidate() { + refresh(); + clearRouteIndex(); +} function named(module: string): Promise { let pending = serviceNames.get(module); @@ -155,9 +159,13 @@ export function registerFeignNavigation(): () => void { (!isRouteSource(event.path) && !isServiceConfiguration(event.path)) ) return; - if (event.type === "docChanged" && isRouteSource(event.path)) { - if (changedSources.size < 256) changedSources.add(event.path); - } else if (event.type === "docClosed" || event.type === "docSaved") changedSources.delete(event.path); + if (event.type === "docChanged") { + if (isRouteSource(event.path) && changedSources.size < 256) changedSources.add(event.path); + // Unsaved text is overlaid on the disk index: typing must not rescan the project. + refresh(); + return; + } + changedSources.delete(event.path); invalidate(); }); const projects = useProject.subscribe((state, previous) => { diff --git a/src/workbench/contributions.ts b/src/workbench/contributions.ts index 2dc9972202..38cae05929 100644 --- a/src/workbench/contributions.ts +++ b/src/workbench/contributions.ts @@ -1883,9 +1883,15 @@ export function registerEndpointProvider(p: EndpointProvider): () => void { }; } -export async function searchEndpoints(root: string | null): Promise { +/** Endpoints of every provider, or of those `provider` accepts (by provider id). */ +export async function searchEndpoints( + root: string | null, + provider: (id: string) => boolean = () => true, +): Promise { if (!root) return []; - const results = await Promise.allSettled([...endpointProviders.values()].map(async (p) => p.endpoints(root))); + const results = await Promise.allSettled( + [...endpointProviders.values()].filter((p) => provider(p.id)).map(async (p) => p.endpoints(root)), + ); return results.flatMap((result) => (result.status === "fulfilled" ? result.value : [])); } From 7f336408950afcc425f35b5eea088e14dca51d19 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 21:17:16 +0800 Subject: [PATCH 08/11] feat(markdown): run code blocks and command lines from the gutter (#4530) Markdown files get gutter run icons like IDEA's Markdown command runner: shell code blocks run in a new terminal tab from their fence, and code block lines run when a Run Anything provider recognizes them (Maven/Gradle lines, run configuration names; providers gain accepts()). Languages & Frameworks > Markdown > Commands toggles detection and picks the folder (asking when unset and the project and file folder differ). Untrusted projects get no icons. --- crates/ide-core/src/settings.rs | 22 ++- src/bindings.ts | 13 ++ src/features/build-tools/runAnything.ts | 4 + src/features/run/index.ts | 2 + src/features/run/markdownCommands.test.ts | 70 +++++++++ src/features/run/markdownCommands.ts | 135 ++++++++++++++++++ src/features/run/npmGutter.ts | 6 +- src/features/run/runAnything.ts | 1 + .../settings/languages/MarkdownPage.tsx | 60 +++++--- src/features/settings/pages/languages.tsx | 2 +- src/features/terminal/index.ts | 19 +++ src/features/terminal/runtime.ts | 1 + src/features/terminal/store.ts | 8 ++ src/platform/languageSettings.ts | 29 +++- src/platform/locales/text/en.json | 10 +- src/platform/locales/text/zh.json | 10 +- src/workbench/contributions.ts | 5 + 17 files changed, 369 insertions(+), 28 deletions(-) create mode 100644 src/features/run/markdownCommands.test.ts create mode 100644 src/features/run/markdownCommands.ts diff --git a/crates/ide-core/src/settings.rs b/crates/ide-core/src/settings.rs index 52523e9887..8f0f0c0312 100644 --- a/crates/ide-core/src/settings.rs +++ b/crates/ide-core/src/settings.rs @@ -1194,11 +1194,31 @@ pub struct ArduinoSettings { } /// Languages & Frameworks › Markdown. Like IDEA's, it is application-level only. -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Type)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)] #[serde(default, rename_all = "camelCase")] pub struct MarkdownSettings { /// Preview (and notebook Markdown cell) font size in px; unset follows the editor font size. pub preview_font_size: Option, + /// "Detect commands that can be run right from Markdown files": gutter run icons on + /// shell code blocks and on command lines in code blocks. + pub run_commands: bool, + /// Where those commands run; unset asks when the project and the file's folder differ. + pub command_directory: Option, +} + +impl Default for MarkdownSettings { + fn default() -> Self { + Self { preview_font_size: None, run_commands: true, command_directory: None } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)] +#[serde(rename_all = "lowercase")] +pub enum MarkdownCommandDirectory { + /// The project's root folder. + Project, + /// The Markdown file's parent folder. + File, } impl LanguagesSettings { diff --git a/src/bindings.ts b/src/bindings.ts index 626b6dfe25..c6ac9327f4 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -8237,10 +8237,23 @@ export type ManifestDependency = { to: number, }; +export type MarkdownCommandDirectory = +/** The project's root folder. */ +"project" | +/** The Markdown file's parent folder. */ +"file"; + /** Languages & Frameworks › Markdown. Like IDEA's, it is application-level only. */ export type MarkdownSettings = { /** Preview (and notebook Markdown cell) font size in px; unset follows the editor font size. */ previewFontSize?: number | null, + /** + * "Detect commands that can be run right from Markdown files": gutter run icons on + * shell code blocks and on command lines in code blocks. + */ + runCommands?: boolean, + /** Where those commands run; unset asks when the project and the file's folder differ. */ + commandDirectory?: MarkdownCommandDirectory | null, }; /** A marketplace entry with what is installed. */ diff --git a/src/features/build-tools/runAnything.ts b/src/features/build-tools/runAnything.ts index d272979cdf..fb16f6b7dc 100644 --- a/src/features/build-tools/runAnything.ts +++ b/src/features/build-tools/runAnything.ts @@ -97,4 +97,8 @@ export const buildToolsRunAnything: RunAnythingProvider = { const tool = lineTool(line); return !!tool && executeBuildLine(tool, line); }, + accepts(line) { + const tool = lineTool(line); + return !!tool && (tool === "maven" ? parseGoalLine(line) : parseTaskLine(line)).length > 0; + }, }; diff --git a/src/features/run/index.ts b/src/features/run/index.ts index 0c2e17ce44..56fcac0bbf 100644 --- a/src/features/run/index.ts +++ b/src/features/run/index.ts @@ -71,6 +71,7 @@ import { hotReload, hotReloadSession, hotRestart } from "./flutterHotReload"; import { npmGutter } from "./npmGutter"; import { launchSettingsGutter } from "./launchSettingsGutter"; import { runGutter } from "./runGutter"; +import { markdownCommandGutter } from "./markdownCommands"; import { gradleDelegation } from "./gradleRun"; import { activateStackTrace, useStackTraces } from "./stackTrace"; import { clearRuntimeCache } from "./runtimes"; @@ -485,6 +486,7 @@ export function activate(): () => void { }), registerEditorContribution({ id: "run.targets", order: 55, extensions: runGutter }), registerEditorContribution({ id: "run.npmScripts", order: 58, extensions: npmGutter }), + registerEditorContribution({ id: "run.markdownCommands", order: 58, extensions: markdownCommandGutter }), registerEditorContribution({ id: "run.launchSettings", order: 58, extensions: launchSettingsGutter }), registerMenuGroup({ id: "run.context", diff --git a/src/features/run/markdownCommands.test.ts b/src/features/run/markdownCommands.test.ts new file mode 100644 index 0000000000..d2d2ec33f6 --- /dev/null +++ b/src/features/run/markdownCommands.test.ts @@ -0,0 +1,70 @@ +import { afterEach, describe, expect, it } from "vitest"; +import { useProject } from "@/platform/project"; +import { commandMenuItems, markdownCommands, trimPrompt, type CommandEntry } from "./markdownCommands"; + +const accepts = (line: string) => /^(mvn|\.\/gradlew) /.test(line); + +describe("Markdown commands", () => { + it("runs shell blocks from their fence and recognized command lines from any block", () => { + const text = [ + "## Setup", + "```shell", + "$ mise install # tools", + "", + "mvn test", + "```", + "```java", + "mvn not a command here? still a recognized line", + "```", + "~~~text", + "./gradlew build", + "~~~", + ].join("\n"); + expect(markdownCommands(text, accepts).map((e) => [e.kind, e.line, e.lines])).toEqual([ + ["block", 1, ["mise install", "mvn test"]], + ["line", 4, ["mvn test"]], + ["line", 7, ["mvn not a command here? still a recognized line"]], + ["line", 10, ["./gradlew build"]], + ]); + }); + + it("ignores blocks without commands, other languages and unclosed fences' closing rules", () => { + expect(markdownCommands("```bash\n# only a comment\n```", accepts)).toEqual([]); + expect(markdownCommands("```python\nprint(1)\n```", accepts)).toEqual([]); + // A shorter closing fence doesn't close a longer one. + expect(markdownCommands("````sh\nls\n```\npwd\n````", accepts)[0]?.lines).toEqual(["ls", "```", "pwd"]); + }); + + it("keeps quoted # and PowerShell lines as written", () => { + expect(trimPrompt(['echo "a # b" # note', "$ git log #x", "#!/bin/sh"])).toEqual(['echo "a # b"', "git log"]); + expect(markdownCommands("```powershell\n$env:X = 1 # keep\n```", accepts)[0]?.lines).toEqual(["$env:X = 1 # keep"]); + }); +}); + +describe("Markdown command menu", () => { + const block: CommandEntry = { kind: "block", name: "block:1", line: 1, lines: ["make build"] }; + afterEach(() => useProject.setState({ project: null, settings: null })); + const open = (commandDirectory?: string) => + useProject.setState({ + project: { root: "/p", name: "p", settings: {}, trusted: true, isGit: false }, + settings: { languages: { markdown: { commandDirectory } } } as never, + }); + + it("asks for the folder when the project and the file's folder differ", async () => { + open(); + expect((await commandMenuItems(block, "/p/docs/README.md")).map((i) => "label" in i && i.label)).toEqual([ + "Run from Project Root Directory", + "Run from Parent Directory of Current File (docs)", + ]); + expect((await commandMenuItems(block, "/p/README.md")).map((i) => "label" in i && i.label)).toEqual([ + "Run in Terminal", + ]); + }); + + it("uses the configured folder", async () => { + open("file"); + expect((await commandMenuItems(block, "/p/docs/README.md")).map((i) => "label" in i && i.label)).toEqual([ + "Run in Terminal", + ]); + }); +}); diff --git a/src/features/run/markdownCommands.ts b/src/features/run/markdownCommands.ts new file mode 100644 index 0000000000..6d7c953f01 --- /dev/null +++ b/src/features/run/markdownCommands.ts @@ -0,0 +1,135 @@ +/** + * Run icons in Markdown files, like IDEA's Markdown command runner: ▶ on a shell + * code block's opening fence runs the block in a new terminal tab, and ▶ on a + * line of any code block runs it when a Run Anything provider recognizes the + * command (`mvn test`, `./gradlew build`, a run configuration's name). + */ +import type { Extension } from "@codemirror/state"; +import type { EditorDocContext } from "@/editor/api"; +import { executeAction } from "@/platform/actions"; +import { tx } from "@/platform/i18n"; +import { markdownCommandSettings } from "@/platform/languageSettings"; +import { useProject } from "@/platform/project"; +import type { MenuItem } from "@/ui"; +import { runAnythingProviderList } from "@/workbench/contributions"; +import { entryGutter, type ScriptEntry } from "./npmGutter"; + +const SHELL = new Set(["sh", "bash", "zsh", "shell", "shellscript", "shell-script", "console"]); +const POWERSHELL = new Set(["powershell", "pwsh", "ps1"]); +const FENCE = /^ {0,3}(`{3,}|~{3,})\s*([^\s`]*)/; + +export interface CommandEntry extends ScriptEntry { + kind: "block" | "line"; + /** What runs: the block's commands, or the line's. */ + lines: string[]; +} + +/** `line` without a trailing `# comment` outside quotes. */ +function stripComment(line: string): string { + let single = false; + let double = false; + for (let i = 0; i < line.length; i++) { + const c = line[i]; + if (c === "'" && !double) single = !single; + else if (c === '"' && !single) double = !double; + else if (c === "#" && !single && !double && (i === 0 || /\s/.test(line[i - 1]!))) return line.slice(0, i).trimEnd(); + } + return line; +} + +/** Shell lines without a leading `$` prompt or trailing comments; empty lines dropped. */ +export function trimPrompt(lines: readonly string[]): string[] { + return lines.map((line) => stripComment(line.startsWith("$") ? line.slice(1) : line).trim()).filter(Boolean); +} + +/** + * The runnable places of Markdown `text`: shell code blocks (on their opening fence) + * and code block lines `accepts` recognizes as commands. + */ +export function markdownCommands(text: string, accepts: (line: string) => boolean): CommandEntry[] { + const lines = text.split("\n"); + const out: CommandEntry[] = []; + for (let i = 0; i < lines.length; i++) { + const open = FENCE.exec(lines[i]!); + if (!open) continue; + const marker = open[1]!; + const language = open[2]!.toLowerCase(); + const close = new RegExp(`^ {0,3}${marker[0] === "`" ? "`" : "~"}{${marker.length},}\\s*$`); + let end = i + 1; + while (end < lines.length && !close.test(lines[end]!)) end++; + const body = lines.slice(i + 1, end).map((l) => l.replace(/\r$/, "")); + if (SHELL.has(language) || POWERSHELL.has(language)) { + const commands = POWERSHELL.has(language) ? body.filter((l) => l.trim()) : trimPrompt(body); + if (commands.length) out.push({ kind: "block", name: `block:${i}`, line: i, lines: commands }); + } + body.forEach((raw, k) => { + const [command] = trimPrompt([raw]); + if (command && accepts(command)) + out.push({ kind: "line", name: `line:${command}`, line: i + 1 + k, lines: [command] }); + }); + i = end; + } + return out; +} + +/** Whether a Run Anything provider runs `line` as a command it recognizes. */ +function accepted(line: string): boolean { + return runAnythingProviderList().some((p) => !!p.accepts?.(line)); +} + +async function runLine(line: string) { + for (const p of runAnythingProviderList()) if (p.accepts?.(line) && p.execute && (await p.execute(line))) return; +} + +const parentDir = (path: string) => path.slice(0, Math.max(path.lastIndexOf("/"), 0)) || "/"; + +/** The folders a block may run in: the setting's, or both when it asks and they differ. */ +function directories(path: string): { project: string; file: string } | string | null { + const { project, settings } = useProject.getState(); + if (!project?.root) return null; + const file = parentDir(path); + const choice = markdownCommandSettings(settings).commandDirectory; + if (choice === "file") return file; + if (choice === "project" || file === project.root) return project.root; + return { project: project.root, file }; +} + +function runBlock(lines: string[], cwd: string) { + void executeAction("terminal.runLines", { lines, cwd }); +} + +export async function commandMenuItems(entry: ScriptEntry, path: string): Promise { + const command = entry as CommandEntry; + if (command.kind === "line") { + const line = command.lines[0]!; + return [{ label: tx`Run '${line}'`, icon: "run", run: () => void runLine(line) }]; + } + const dirs = directories(path); + if (!dirs) return []; + const shown = typeof dirs === "string" ? "" : dirs.file.slice(dirs.project.length + 1) || dirs.file; + if (typeof dirs === "string") + return [{ label: tx`Run in Terminal`, icon: "terminal", run: () => runBlock(command.lines, dirs) }]; + return [ + { label: tx`Run from Project Root Directory`, icon: "terminal", run: () => runBlock(command.lines, dirs.project) }, + { + label: tx`Run from Parent Directory of Current File (${shown})`, + icon: "terminal", + run: () => runBlock(command.lines, dirs.file), + }, + ]; +} + +export function markdownCommandGutter(ctx: EditorDocContext): Extension { + const { project, settings } = useProject.getState(); + if (!project?.trusted || !markdownCommandSettings(settings).runCommands) return []; + return entryGutter( + ctx, + /\.(md|markdown)$/i, + (text) => markdownCommands(text, accepted), + commandMenuItems, + (entry) => { + const command = entry as CommandEntry; + return command.kind === "block" ? tx`Run in Terminal` : tx`Run '${command.lines[0]!}'`; + }, + ); +} diff --git a/src/features/run/npmGutter.ts b/src/features/run/npmGutter.ts index 82ae79f3a7..3cf66aef4e 100644 --- a/src/features/run/npmGutter.ts +++ b/src/features/run/npmGutter.ts @@ -312,6 +312,7 @@ class ScriptMarker extends GutterMarker { readonly entry: ScriptEntry, readonly path: string, readonly menu: EntryMenu, + readonly title: (entry: ScriptEntry) => string, ) { super(); } @@ -322,7 +323,7 @@ class ScriptMarker extends GutterMarker { const el = document.createElement("button"); el.type = "button"; el.className = styles.runMarker ?? ""; - el.title = tx`Run '${this.entry.name}'`; + el.title = this.title(this.entry); el.setAttribute("aria-label", el.title); el.innerHTML = gutterIconMarkup("gutter-run") ?? ""; el.addEventListener("click", () => { @@ -350,6 +351,7 @@ export function entryGutter( file: RegExp, entries: (text: string) => ScriptEntry[], menu: EntryMenu, + title: (entry: ScriptEntry) => string = (entry) => tx`Run '${entry.name}'`, ): Extension { const path = ctx.path; if (ctx.virtual || !file.test(path) || !useProject.getState().project?.root) return []; @@ -394,7 +396,7 @@ export function entryGutter( markers: (view) => runIconsShown() ? RangeSet.of( - view.state.field(entriesField).map((e) => new ScriptMarker(e, path, menu).range(e.pos)), + view.state.field(entriesField).map((e) => new ScriptMarker(e, path, menu, title).range(e.pos)), true, ) : RangeSet.empty, diff --git a/src/features/run/runAnything.ts b/src/features/run/runAnything.ts index c1607b5abe..b82bff47c8 100644 --- a/src/features/run/runAnything.ts +++ b/src/features/run/runAnything.ts @@ -30,6 +30,7 @@ export const runConfigsRunAnything: RunAnythingProvider = { group: "Run Configurations", order: 10, items: (query) => matchingConfigs(useRun.getState().configs, query).map(item), + accepts: (line) => useRun.getState().configs.some((c) => c.name === line.trim()), execute(line) { const config = useRun.getState().configs.find((c) => c.name === line.trim()); if (!config) return false; diff --git a/src/features/settings/languages/MarkdownPage.tsx b/src/features/settings/languages/MarkdownPage.tsx index 50b454001f..a3960dbb81 100644 --- a/src/features/settings/languages/MarkdownPage.tsx +++ b/src/features/settings/languages/MarkdownPage.tsx @@ -1,5 +1,5 @@ import { useId } from "react"; -import { NumberInput, Row, Section } from "../components/Form"; +import { NumberInput, Row, Section, Select, SettingToggle } from "../components/Form"; import { useSetting } from "../components/context"; /** Languages & Frameworks › Markdown, after IDEA's: application-level, preview font size follows the editor font until set. */ @@ -7,24 +7,48 @@ export function MarkdownPage() { const id = useId(); const [size, setSize] = useSetting("languages.markdown.previewFontSize"); const [editorSize] = useSetting("editor.fontSize"); + const [runCommands] = useSetting("languages.markdown.runCommands"); + const [directory, setDirectory] = useSetting<"project" | "file" | null>("languages.markdown.commandDirectory"); return ( -
- - +
+ + + +
+
+ - -
+ + + value={directory ?? ("" as "project")} + options={DIRECTORY_OPTIONS} + onChange={setDirectory} + disabled={!runCommands} + aria-label="Run commands from" + /> + +
+ ); } + +const DIRECTORY_OPTIONS = [ + { value: "project", label: "Project directory" }, + { value: "file", label: "Markdown file parent directory" }, +] as const; diff --git a/src/features/settings/pages/languages.tsx b/src/features/settings/pages/languages.tsx index 4ff3b07c05..054210b62f 100644 --- a/src/features/settings/pages/languages.tsx +++ b/src/features/settings/pages/languages.tsx @@ -169,7 +169,7 @@ export const LANGUAGE_PAGES: PageSpec[] = [ title: "Markdown", group: LANGUAGES_GROUP, order: 400, - keywords: ["markdown", "preview", "font size", "jupyter", "notebook"], + keywords: ["markdown", "preview", "font size", "jupyter", "notebook", "run commands", "code block"], component: MarkdownPage, }, { diff --git a/src/features/terminal/index.ts b/src/features/terminal/index.ts index af5b90fafa..6d45fecc23 100644 --- a/src/features/terminal/index.ts +++ b/src/features/terminal/index.ts @@ -199,6 +199,25 @@ export function activate(): () => void { focusActiveSoon(); }, }, + { + id: "terminal.runLines", + title: "Run Lines in Terminal", + description: "Opens a shell tab and types `{ lines, name?, cwd? }` into it.", + category: "Terminal", + icon: "terminal", + when: "projectOpen", + hidden: true, + run: async ({ arg }) => { + const a = arg as { lines?: unknown; name?: unknown; cwd?: unknown } | undefined; + const lines = Array.isArray(a?.lines) ? a.lines.filter((x): x is string => typeof x === "string") : []; + const cwd = (typeof a?.cwd === "string" && a.cwd) || projectRoot(); + if (!lines.length || !cwd) return; + const rt = await loadTerminalRuntime(); + rt.newTabRunning(cwd, typeof a?.name === "string" && a.name ? a.name : undefined, lines); + toolWindowService().show(WINDOW, true); + focusActiveSoon(); + }, + }, { id: "terminal.runCommand", title: "Run Command in Terminal", diff --git a/src/features/terminal/runtime.ts b/src/features/terminal/runtime.ts index 55eafcfcac..3d7ea4033e 100644 --- a/src/features/terminal/runtime.ts +++ b/src/features/terminal/runtime.ts @@ -6,6 +6,7 @@ export { closeAll, detachTab, newTab, + newTabRunning, pluginSession, syncTerminalProject, tabTitle, diff --git a/src/features/terminal/store.ts b/src/features/terminal/store.ts index 68ace5c0c5..5222e02be8 100644 --- a/src/features/terminal/store.ts +++ b/src/features/terminal/store.ts @@ -247,6 +247,14 @@ export function newTab(cwd: string, name?: string, command?: SessionOptions["com return tab; } +/** Opens a shell tab at `cwd` and types `lines` into it, each followed by Return. */ +export function newTabRunning(cwd: string, name: string | undefined, lines: readonly string[]): TerminalTab { + const tab = newTab(cwd, name); + // Sent once the shell's PTY exists (the session buffers input until then). + getSession(tab.session)?.input(lines.map((line) => `${line}\r`).join("")); + return tab; +} + export function newTabAt(dir: string): TerminalTab { return newTab(dir, basename(dir) || "Local"); } diff --git a/src/platform/languageSettings.ts b/src/platform/languageSettings.ts index cb09f1e311..659db6913d 100644 --- a/src/platform/languageSettings.ts +++ b/src/platform/languageSettings.ts @@ -238,8 +238,14 @@ export interface LanguagesValid { updateSnapshots: boolean; }; }; - /** Preview font size in px; `null` follows the editor font size. */ - markdown: { previewFontSize: number | null }; + markdown: { + /** Preview font size in px; `null` follows the editor font size. */ + previewFontSize: number | null; + /** Run icons on shell code blocks and command lines. */ + runCommands: boolean; + /** Where commands run; `null` asks when the project and the file's folder differ. */ + commandDirectory: "project" | "file" | null; + }; } export interface ProjectStructureValid { @@ -329,7 +335,7 @@ export const DEFAULT_LANGUAGES: LanguagesValid = { updateSnapshots: false, }, }, - markdown: { previewFontSize: null }, + markdown: { previewFontSize: null, runCommands: true, commandDirectory: null }, }; export const DEFAULT_PROJECT_STRUCTURE: ProjectStructureValid = { @@ -510,7 +516,14 @@ export function validateLanguages(raw: unknown): LanguagesValid { updateSnapshots: bool(maven.updateSnapshots, d.java.maven.updateSnapshots), }, }, - markdown: { previewFontSize: previewSize(markdown.previewFontSize) }, + markdown: { + previewFontSize: previewSize(markdown.previewFontSize), + runCommands: bool(markdown.runCommands, d.markdown.runCommands), + commandDirectory: + markdown.commandDirectory === "project" || markdown.commandDirectory === "file" + ? markdown.commandDirectory + : null, + }, }; } @@ -528,6 +541,14 @@ export function markdownPreviewFontSize(settings: unknown): number { ); } +/** Languages & Frameworks › Markdown › Commands of `settings`. */ +export function markdownCommandSettings( + settings: unknown, +): Pick { + const markdown = validateLanguages(obj(settings).languages).markdown; + return { runCommands: markdown.runCommands, commandDirectory: markdown.commandDirectory }; +} + /** Reactive `markdownPreviewFontSize` of the open project. */ export function useMarkdownPreviewFontSize(): number { return useProject((s) => markdownPreviewFontSize(s.settings)); diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json index a18685c96c..ef78645dcd 100644 --- a/src/platform/locales/text/en.json +++ b/src/platform/locales/text/en.json @@ -2664,5 +2664,13 @@ "The agent's default": "The agent's default", "Commit messages are short: a fast model with low effort is usually enough.": "Commit messages are short: a fast model with low effort is usually enough.", "Change Project Color…": "Change Project Color…", - "Project Color": "Project Color" + "Project Color": "Project Color", + "Run Lines in Terminal": "Run Lines in Terminal", + "Opens a shell tab and types `{ lines, name?, cwd? }` into it.": "Opens a shell tab and types `{ lines, name?, cwd? }` into it.", + "Run in Terminal": "Run in Terminal", + "Run from Project Root Directory": "Run from Project Root Directory", + "Run from Parent Directory of Current File ({shown})": "Run from Parent Directory of Current File ({shown})", + "Detect commands that can be run right from Markdown files": "Detect commands that can be run right from Markdown files", + "Run commands from": "Run commands from", + "Markdown file parent directory": "Markdown file parent directory" } diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index 8d54494c4b..7a01a21540 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -9039,5 +9039,13 @@ "The agent's default": "智能体的默认值", "Commit messages are short: a fast model with low effort is usually enough.": "提交信息很短,通常用快速模型配低推理强度就够了。", "Change Project Color…": "更改项目颜色…", - "Project Color": "项目颜色" + "Project Color": "项目颜色", + "Run Lines in Terminal": "在终端中运行多行命令", + "Opens a shell tab and types `{ lines, name?, cwd? }` into it.": "打开一个 Shell 终端标签页并输入 `{ lines, name?, cwd? }`。", + "Run in Terminal": "在终端中运行", + "Run from Project Root Directory": "从项目根目录运行", + "Run from Parent Directory of Current File ({shown})": "从当前文件的父目录运行({shown})", + "Detect commands that can be run right from Markdown files": "检测可以直接从 Markdown 文件运行的命令", + "Run commands from": "运行命令的目录", + "Markdown file parent directory": "Markdown 文件的父目录" } diff --git a/src/workbench/contributions.ts b/src/workbench/contributions.ts index 38cae05929..ed0180e151 100644 --- a/src/workbench/contributions.ts +++ b/src/workbench/contributions.ts @@ -1817,6 +1817,11 @@ export interface RunAnythingProvider { items(query: string): RunAnythingItem[]; /** Runs `line` when it belongs to this provider (`mvn clean`); false leaves it to the next one. */ execute?(line: string): boolean | Promise; + /** + * Whether `execute` runs `line` as a command this provider recognizes (cheap, + * synchronous): Markdown offers run icons for such lines in code blocks. + */ + accepts?(line: string): boolean; } const runAnythingProviders = new Map(); From 2265497b184e9787cf00e9ffdf613286c1cc38a6 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 21:34:39 +0800 Subject: [PATCH 09/11] fix(navigation): keep File Structure filters readable (#4522) The File Structure popup is 540px wide and its filter options wrap onto further rows instead of being clipped at narrow window widths; the filter field uses the UI font. --- e2e/fileStructureLayout.spec.ts | 54 +++++++++++++++++++ .../search/structure/StructureView.module.css | 14 ++--- .../search/structure/StructureView.tsx | 2 +- 3 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 e2e/fileStructureLayout.spec.ts diff --git a/e2e/fileStructureLayout.spec.ts b/e2e/fileStructureLayout.spec.ts new file mode 100644 index 0000000000..8e595875b8 --- /dev/null +++ b/e2e/fileStructureLayout.spec.ts @@ -0,0 +1,54 @@ +import { expect, openFromTree, stubDesktop, test } from "./fixtures"; + +test("File Structure keeps symbol filters readable at desktop and minimum window widths", async ({ + workbench: page, +}) => { + await openFromTree(page, "build.gradle.kts"); + await stubDesktop(page); + await page.evaluate(async () => { + const range = { start: { line: 0, col: 0 }, end: { line: 1, col: 1 } }; + const field = { + name: "orderCount", + kind: "field", + visibility: "private", + range, + selection_range: range, + children: [], + }; + window.__ipc.handlers.doc_outline = () => [ + { name: "OrderController", kind: "class", range, selection_range: range, children: [field] }, + ]; + window.__ipc.handlers.lsp_type_hierarchy = () => []; + const path = "/src/platform/actions.ts"; + const { executeAction } = await import(/* @vite-ignore */ path); + await executeAction("navigate.fileStructure"); + }); + + const dialog = page.getByRole("dialog", { name: "File Structure" }); + const fields = dialog.getByRole("checkbox", { name: "Show fields" }); + await expect(dialog.getByRole("checkbox", { name: "Show inherited members" })).toBeVisible(); + for (const width of [400, 1000]) { + await page.setViewportSize({ width, height: 600 }); + const clipped = await dialog.evaluate((element) => { + const labels = [...element.querySelectorAll("label")].filter((label) => + label.querySelector('input[type="checkbox"]'), + ); + const row = labels[0]!.parentElement!.getBoundingClientRect(); + return labels.flatMap((label) => { + const range = document.createRange(); + range.selectNodeContents(label); + const box = range.getBoundingClientRect(); + return box.top < row.top - 1 || box.right > row.right + 1 || box.bottom > row.bottom + 1 + ? [label.textContent] + : []; + }); + }); + expect(clipped).toEqual([]); + } + // The dialog scales in when it opens: wait for its settled width. + await expect.poll(async () => Math.round((await dialog.boundingBox())!.width)).toBe(540); + const field = dialog.getByRole("treeitem", { name: "orderCount" }); + await expect(field).toBeVisible(); + await fields.uncheck(); + await expect(field).toBeHidden(); +}); diff --git a/src/features/search/structure/StructureView.module.css b/src/features/search/structure/StructureView.module.css index 429236ab5c..b2dfa85d45 100644 --- a/src/features/search/structure/StructureView.module.css +++ b/src/features/search/structure/StructureView.module.css @@ -101,14 +101,12 @@ border: 0; outline: none; color: var(--fg-strong); - font-family: var(--font-mono); - font-size: var(--fs-code); + font-family: var(--font-ui); + font-size: var(--fs-ui); caret-color: var(--accent); } .filter::placeholder { color: var(--fg-faint); - font-family: var(--font-ui); - font-size: var(--fs-ui); } .filterStatus { color: var(--fg-muted); @@ -125,10 +123,12 @@ } .popupOptions { display: flex; + flex-wrap: wrap; + align-content: center; align-items: center; - gap: var(--space-3); - height: 26px; - padding: 0 12px; + gap: var(--space-1) var(--space-3); + min-height: 32px; + padding: var(--space-1) var(--space-3); border-bottom: 1px solid var(--border-popup); font-size: var(--fs-small); } diff --git a/src/features/search/structure/StructureView.tsx b/src/features/search/structure/StructureView.tsx index ba88b1153d..d8385c9a71 100644 --- a/src/features/search/structure/StructureView.tsx +++ b/src/features/search/structure/StructureView.tsx @@ -471,7 +471,7 @@ function FileStructureDialog() { Date: Thu, 19 Nov 2026 21:37:20 +0800 Subject: [PATCH 10/11] fix(database): refine console and data editor layout (#4520) Database console and data editor layout: console tabs show the console name with its data source and database (and the source icon) through new tabTitle/tabIcon file decorations, results tabs, the data source dialog, table editor and schema compare use the spacing scale and fit narrow panes. --- e2e/databaseDialogLayout.spec.ts | 24 +++ e2e/databaseResultTabs.spec.ts | 34 ++++ src/editor/core/model/tabTitles.ts | 4 +- src/editor/core/view/EditorArea.tsx | 14 +- src/features/database/DataDialogs.tsx | 9 +- src/features/database/DataView.tsx | 4 +- src/features/database/Database.module.css | 164 +++++++++++++----- src/features/database/DatabaseView.tsx | 6 +- src/features/database/Grid.tsx | 10 +- src/features/database/ResultsView.tsx | 6 +- .../database/SchemaCompare.module.css | 21 ++- src/features/database/SchemaCompareDialog.tsx | 7 +- src/features/database/SourceDialog.tsx | 136 ++++++++------- src/features/database/SqlFilterInput.tsx | 1 - src/features/database/TableEditor.tsx | 127 ++++++++------ src/features/database/console.tsx | 108 ++++++------ src/features/database/index.ts | 6 +- src/features/database/store.ts | 19 +- src/platform/locales/text/en.json | 2 + src/platform/locales/text/zh.json | 2 + src/workbench/contributions.ts | 3 + 21 files changed, 455 insertions(+), 252 deletions(-) diff --git a/e2e/databaseDialogLayout.spec.ts b/e2e/databaseDialogLayout.spec.ts index ca28d183ba..643f617e05 100644 --- a/e2e/databaseDialogLayout.spec.ts +++ b/e2e/databaseDialogLayout.spec.ts @@ -1,5 +1,29 @@ import { expect, test } from "./fixtures"; +test("data source tabs share a stable layout and scroll within a short window", async ({ workbench: page }) => { + await page.setViewportSize({ width: 560, height: 480 }); + await page.evaluate(async () => { + const path = "/src/features/database/store.ts"; + const { openSourceDialog } = await import(/* @vite-ignore */ path); + openSourceDialog(null, { name: "Local development", driver: "postgres", host: "localhost" }); + }); + + const dialog = page.getByRole("dialog", { name: "New Data Source" }); + const panel = dialog.getByRole("tabpanel"); + const dialogSize = () => dialog.evaluate((element) => [element.offsetWidth, element.offsetHeight]); + await expect(panel.getByRole("textbox", { name: "Host:" })).toBeVisible(); + const size = await dialogSize(); + await dialog.getByRole("tab", { name: "SSH/SSL" }).click(); + await expect(dialog.getByRole("tab", { name: "SSH/SSL" })).toHaveAttribute("aria-selected", "true"); + expect(await dialogSize()).toEqual(size); + + await dialog.getByRole("tab", { name: "General" }).click(); + const canScroll = await panel.evaluate((element) => element.scrollHeight > element.clientHeight); + expect(canScroll).toBe(true); + await panel.getByRole("textbox", { name: "URL:" }).scrollIntoViewIfNeeded(); + await expect(dialog.getByRole("button", { name: "Cancel" })).toBeInViewport(); +}); + for (const kind of ["password", "sshSecret", "params"] as const) { test(`database ${kind} dialog keeps its fields inside the window`, async ({ workbench: page }) => { await page.evaluate(async (kind) => { diff --git a/e2e/databaseResultTabs.spec.ts b/e2e/databaseResultTabs.spec.ts index abadb3eb01..29f75ddeb7 100644 --- a/e2e/databaseResultTabs.spec.ts +++ b/e2e/databaseResultTabs.spec.ts @@ -1,6 +1,40 @@ import type { Page } from "@playwright/test"; import { expect, openFromTree, test } from "./fixtures"; +test("managed console tabs identify their data source and ordinary SQL tabs keep the file name", async ({ + workbench: page, +}) => { + await page.evaluate(async () => { + const database = "/src/features/database/store.ts"; + const workbench = "/src/workbench/contributions.ts"; + const { useDatabase, bindConsole } = await import(database); + const { editorService } = await import(workbench); + const console = "/app-data/consoles/db/demo/console.sql"; + useDatabase.setState({ loaded: true, sources: [{ id: "demo", name: "Shop Demo", driver: "sqlite" }] }); + bindConsole(console, "demo"); + bindConsole("/acme-api/console.sql", "demo"); + await editorService().openFile("/acme-api/console.sql", { focus: true }); + await editorService().openFile(console, { focus: true }); + }); + + const consoleTab = page.getByRole("tab", { name: "console [Shop Demo]", exact: true }); + await expect(consoleTab).toHaveAttribute("aria-selected", "true"); + await expect(page.getByRole("tab", { name: "console.sql", exact: true })).toBeVisible(); + await expect(page.getByRole("toolbar", { name: "Query Console", exact: true })).toContainText("main"); + + await page.evaluate(async () => { + const path = "/src/features/database/store.ts"; + const { useDatabase } = await import(path); + useDatabase.setState((state: { sources: Array<{ name: string }> }) => ({ + sources: state.sources.map((source) => ({ ...source, name: "Shop QA" })), + })); + }); + await expect(page.getByRole("tab", { name: "console [Shop QA]", exact: true })).toHaveAttribute( + "aria-selected", + "true", + ); +}); + const edgeTitle = "Result 3 — a long query result at the edge of the Services pane"; const bindings = { "alpha-console.sql": "alpha", "beta-console.sql": "beta" }; diff --git a/src/editor/core/model/tabTitles.ts b/src/editor/core/model/tabTitles.ts index b7bdbb2122..0f2458afea 100644 --- a/src/editor/core/model/tabTitles.ts +++ b/src/editor/core/model/tabTitles.ts @@ -15,10 +15,10 @@ function parents(path: string): string[] { * For every path whose file name occurs more than once in `paths`, the * distinguishing directory hint. Paths with a unique name are absent. */ -export function disambiguateTitles(paths: readonly string[]): Map { +export function disambiguateTitles(paths: readonly string[], titleOf = baseName): Map { const groups = new Map(); for (const p of new Set(paths)) { - const name = baseName(p); + const name = titleOf(p); const list = groups.get(name); if (list) list.push(p); else groups.set(name, [p]); diff --git a/src/editor/core/view/EditorArea.tsx b/src/editor/core/view/EditorArea.tsx index 865563ba99..5910581154 100644 --- a/src/editor/core/view/EditorArea.tsx +++ b/src/editor/core/view/EditorArea.tsx @@ -161,7 +161,11 @@ function useTitleHints(): Map { return out.sort(); }), ); - return useMemo(() => disambiguateTitles(paths), [paths]); + const labels = useFileDecorations(useShallow(() => paths.map((p) => getFileDecoration(p)?.tabTitle ?? basename(p)))); + return useMemo(() => { + const byPath = new Map(paths.map((p, i) => [p, labels[i]!])); + return disambiguateTitles(paths, (p) => byPath.get(p) ?? basename(p)); + }, [paths, labels]); } const virtualData = (input: EditorInput) => input.data as VirtualInputData | undefined; @@ -180,6 +184,8 @@ function PaneView({ paneId }: { paneId: string }) { const dirty = tabs.map((tab, i) => inputDirty(tab.input, kinds) ?? textDirty[i] ?? false); const colors = useFileDecorations(useShallow(() => paths.map((p) => (p ? (getFileDecoration(p)?.color ?? "") : "")))); const tints = useFileDecorations(useShallow(() => paths.map((p) => (p ? (getFileDecoration(p)?.tint ?? "") : "")))); + const tabLabels = useFileDecorations(useShallow(() => paths.map((p) => getFileDecoration(p)?.tabTitle))); + const tabIcons = useFileDecorations(useShallow(() => paths.map((p) => getFileDecoration(p)?.tabIcon))); const errors = useFileDecorations(useShallow(() => paths.map((p) => !!p && !!getFileDecoration(p)?.error))); const fileColors = useFileColors("editorTabs"); @@ -200,7 +206,7 @@ function PaneView({ paneId }: { paneId: string }) { return tabs.map((t, i) => { const full = names[i]!; const dot = full.lastIndexOf("."); - const name = t.input.kind === "file" && !showExtension && dot > 0 ? full.slice(0, dot) : full; + const name = tabLabels[i] ?? (t.input.kind === "file" && !showExtension && dot > 0 ? full.slice(0, dot) : full); const dupe = !showDirectoryForNonUnique ? null : t.input.kind === "file" && t.input.path @@ -223,7 +229,7 @@ function PaneView({ paneId }: { paneId: string }) { text: dupe ? `${name} — ${dupe}` : name, icon: showFileIcon ? t.input.kind === "file" && t.input.path - ? file?.icon + ? (tabIcons[i] ?? file?.icon) : tabIcon(t.input, kinds) : undefined, italic: t.preview, @@ -255,6 +261,8 @@ function PaneView({ paneId }: { paneId: string }) { colors, errors, tints, + tabLabels, + tabIcons, fileColors, hints, showExtension, diff --git a/src/features/database/DataDialogs.tsx b/src/features/database/DataDialogs.tsx index bf1bb11d5d..281f5140bc 100644 --- a/src/features/database/DataDialogs.tsx +++ b/src/features/database/DataDialogs.tsx @@ -210,7 +210,14 @@ export function ImportDialog({ id, schema, table }: { id: string; schema: string File:
- + void choose()} />
diff --git a/src/features/database/DataView.tsx b/src/features/database/DataView.tsx index 966e70fdc4..d900c4e402 100644 --- a/src/features/database/DataView.tsx +++ b/src/features/database/DataView.tsx @@ -5,7 +5,7 @@ * Record / Value / Aggregates side panel following the selection. */ import { writeClipboardText } from "@/platform/clipboard"; -import { useMemo, useRef, useState, type KeyboardEvent, type RefObject } from "react"; +import { useMemo, useRef, useState, type KeyboardEvent, type ReactNode, type RefObject } from "react"; import clsx from "clsx"; import { Button, Checkbox, Icon, IconButton, Input, Popup, SearchField, Select, Tabs, T, type MenuItem } from "@/ui"; import { EXPORT_FORMATS, exportData, type ExportData, type ExportFormat } from "./export"; @@ -99,6 +99,7 @@ export interface DataViewProps extends Pick< /** Rows from here on (the table editor's added rows) are never filtered or sorted. */ fixedRows?: number; firstRowNumber?: number; + pager?: ReactNode; /** The side panel shown (`null`: hidden). */ panel: DataPanel | null; onPanelChange: (panel: DataPanel | null) => void; @@ -247,6 +248,7 @@ export function DataView(props: DataViewProps) {
)}
+ {props.pager &&
{props.pager}
}
{filterAt && ( input { - flex: 1; - min-width: 0; +.filterField:focus-within { + box-shadow: inset 0 -1px var(--focus-ring); } -.pager { - display: flex; - align-items: center; - gap: var(--space-0-5); - color: var(--fg-secondary); - font-size: var(--fs-small); - white-space: nowrap; +.filterField:has(input[aria-invalid="true"]) { + box-shadow: inset 0 -1px var(--danger); } .notice { - padding: 4px 8px; + padding: var(--space-1) var(--space-2); font-size: var(--fs-small); color: var(--fg-secondary); - background: var(--bg-editor-banner); + background: var(--bg-elev); border-bottom: 1px solid var(--border); } @@ -427,6 +435,28 @@ display: none; } /* Data source dialog. */ +.sourceLayout { + display: grid; + grid-template-rows: auto auto minmax(0, 1fr) auto; + height: clamp(220px, calc(100dvh - 150px), 560px); +} +.sourceLayout .form { + grid-template-columns: minmax(112px, 19%) minmax(0, 1fr); + align-content: start; + padding: var(--space-3) var(--space-4); +} +.sourceLayout .formLabel { + text-align: left; +} +.sourceLayout .formRow { + flex-wrap: wrap; +} +.sourceLayout .formRow > .fill { + flex: 1 1 160px; +} +.sourcePanel { + overflow: auto; +} .formSection { grid-column: 1 / -1; display: flex; @@ -549,10 +579,16 @@ font-size: var(--fs-small); } .testResult { - grid-column: 1 / -1; font-size: var(--fs-small); - min-height: 16px; - word-break: break-word; + max-height: 25vh; + padding: var(--space-2) var(--space-4); + overflow: auto; + overflow-wrap: anywhere; + border-top: 1px solid var(--border); +} +.testResult:empty { + padding: 0; + border: 0; } .ok { color: var(--success); @@ -737,17 +773,28 @@ .modifyBody { display: flex; flex-direction: column; - gap: 10px; - padding: 14px; + gap: var(--space-2); + height: clamp(320px, 68vh, 560px); + padding: var(--space-4); } .modifyMain { + flex: 1; display: grid; - grid-template-columns: 260px 1fr; - height: 240px; + grid-template-columns: minmax(108px, 34%) minmax(0, 1fr); + min-height: 0; border: 1px solid var(--border); border-radius: var(--radius-small); overflow: hidden; } +.modifyBody > .previewBlock { + flex: 0 0 38%; + min-height: 0; +} +.modifyBody .sqlPreview { + flex: 1; + min-height: 0; + max-height: none; +} .modifyColumns { display: flex; flex-direction: column; @@ -786,13 +833,17 @@ } .modifyProps { display: grid; - grid-template-columns: max-content 1fr; + grid-template-columns: minmax(0, 27%) minmax(0, 1fr); align-content: start; align-items: center; gap: var(--space-2) var(--space-3); padding: 12px; overflow: auto; } +.modifyProps .formLabel { + text-align: left; + overflow-wrap: anywhere; +} .quickDoc { width: 460px; max-width: calc(100vw - 32px); @@ -831,9 +882,6 @@ height: 100%; min-height: 0; } -.dataView > .fill { - min-width: 0; -} .headerFilter { flex: none; display: inline-flex; @@ -938,7 +986,8 @@ flex: none; display: flex; flex-direction: column; - width: 320px; + width: clamp(160px, 38%, 300px); + max-width: 50%; min-height: 0; border-left: 1px solid var(--border); } @@ -1165,29 +1214,42 @@ /* Export / history / import dialogs. */ .exportDialog { - display: flex; + display: grid; + grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--space-4); - height: 420px; - padding: 14px; + height: min(440px, 65vh); + min-height: 340px; + padding: var(--space-4); } .exportOptions { display: flex; flex-direction: column; gap: var(--space-2); - width: 300px; - flex: none; +} +.exportOptions .formRow > input { + flex: 1; } .exportOptions .formLabel, .exportPreview .formLabel { text-align: left; } .exportPreview { - flex: 1; min-width: 0; + min-height: 0; display: flex; flex-direction: column; gap: var(--space-2); } +@media (max-width: 620px) { + .exportDialog { + grid-template-columns: minmax(0, 1fr); + height: auto; + } + .exportPreviewText { + height: 200px; + flex: none; + } +} .exportPreviewText, .historyPreview { flex: 1; @@ -1368,6 +1430,7 @@ flex: none; display: flex; align-items: center; + flex-wrap: wrap; gap: var(--space-1); padding: 4px 8px; background: var(--bg-elev); @@ -1375,8 +1438,8 @@ font-size: var(--fs-ui); } .gridSearchField { - flex: 0 1 360px; - min-width: 160px; + flex: 0 1 320px; + min-width: min(100%, 160px); } .gridSearchCount { font-family: var(--font-mono); @@ -1396,14 +1459,19 @@ background: var(--bg-text-search-result-current); } -/* IDEA's floating pager at the bottom of a result: |< < 1-500 of 501+ > >| and the page size. */ +.pagerDock { + flex: none; + display: flex; + justify-content: center; + padding: var(--space-1) var(--space-2) var(--space-2); + background: var(--bg-editor); +} .resultPager { - position: absolute; - left: 50%; - bottom: 12px; - transform: translateX(-50%); display: flex; align-items: center; + justify-content: center; + flex-wrap: wrap; + max-width: 100%; gap: var(--space-0-5); padding: 2px 4px; border: 1px solid var(--border-popup, var(--border)); diff --git a/src/features/database/DatabaseView.tsx b/src/features/database/DatabaseView.tsx index 27036339c2..a2ed727720 100644 --- a/src/features/database/DatabaseView.tsx +++ b/src/features/database/DatabaseView.tsx @@ -16,6 +16,7 @@ import { Icon, IconButton, Menu, + Toolbar, Tree, showContextMenu, tooltipAttrs, @@ -523,6 +524,7 @@ export function DatabaseView() { return color ? `var(--db-color-${color})` : undefined; }} speedSearchField + horizontalScroll renderNode={(n: Node, state) => { const i = icon(n); const d = detail(n); @@ -611,7 +613,7 @@ function DatabaseToolbar() { const active = !!target && [...connected].some((t) => splitTarget(t).id === splitTarget(target).id); const button = { size: "small", iconSize: 16 } as const; return ( -
+ DDL -
+ ); } diff --git a/src/features/database/Grid.tsx b/src/features/database/Grid.tsx index 900eb9f626..e9d58322e8 100644 --- a/src/features/database/Grid.tsx +++ b/src/features/database/Grid.tsx @@ -118,7 +118,6 @@ interface Sel { } const ROW_H = 24; -const NUM_W = 48; /** Wide enough for the whole header (icon, name, filter, sort) and the longest sampled value. */ function initialWidth(c: GridColumn, sample: Cell[], decorations: number): number { @@ -169,6 +168,7 @@ export function Grid(props: GridProps) { copyFormat = "tsv", } = props; const scrollRef = useRef(null); + const numberWidth = Math.max(40, String(firstRowNumber + rowCount - 1).length * 8 + 8); const [sel, setSel] = useState(null); const dragging = useRef(false); useEffect(() => { @@ -225,8 +225,8 @@ export function Grid(props: GridProps) { const scrollColumnIntoView = (c: number) => { const el = scrollRef.current; if (!el || c < 0 || c >= widths.length) return; - const left = c ? NUM_W + widths.slice(0, c).reduce((a, b) => a + b, 0) : 0; - const right = NUM_W + widths.slice(0, c + 1).reduce((a, b) => a + b, 0); + const left = c ? numberWidth + widths.slice(0, c).reduce((a, b) => a + b, 0) : 0; + const right = numberWidth + widths.slice(0, c + 1).reduce((a, b) => a + b, 0); if (left < el.scrollLeft) el.scrollLeft = left; else if (right > el.scrollLeft + el.clientWidth) el.scrollLeft = Math.min(left, right - el.clientWidth); }; @@ -252,8 +252,8 @@ export function Grid(props: GridProps) { // Runs once per request. // eslint-disable-next-line react-hooks/exhaustive-deps }, [revealColumn]); - const totalWidth = useMemo(() => NUM_W + widths.reduce((a, b) => a + b, 0), [widths]); - const template = `${NUM_W}px ${widths.map((w) => `${w}px`).join(" ")}`; + const totalWidth = useMemo(() => numberWidth + widths.reduce((a, b) => a + b, 0), [numberWidth, widths]); + const template = `${numberWidth}px ${widths.map((w) => `${w}px`).join(" ")}`; const selected = (r: number, c: number) => { if (!sel) return false; diff --git a/src/features/database/ResultsView.tsx b/src/features/database/ResultsView.tsx index 8dd2452b2f..7389066bff 100644 --- a/src/features/database/ResultsView.tsx +++ b/src/features/database/ResultsView.tsx @@ -577,7 +577,7 @@ export function Result({ tab, onClose }: { tab: ResultTab; onClose?: () => void {notice}
)} -
+
void searchOpen={searchOpen} onSearchOpenChange={setSearchOpen} firstRowNumber={(tab.page ?? 0) * (tab.pageSize ?? 0) + 1} + pager={} aria-label={tab.title} rowState={(row) => (row >= loaded ? "inserted" : edits.deletes.has(row) ? "deleted" : null)} isModified={(row, col) => !!edits.updates.get(row)?.has(resultNames[col]!)} @@ -611,7 +612,6 @@ export function Result({ tab, onClose }: { tab: ResultTab; onClose?: () => void : [] } /> -
)} @@ -817,7 +817,7 @@ export function ResultsView() { ...results.map((r) => ({ id: String(r.id), label: r.title, - icon: r.plan ? "db-plan" : "database", + icon: r.plan ? "db-plan" : "db-table", closable: true, pinned: r.pinned, tooltip: r.outcome.statement.text, diff --git a/src/features/database/SchemaCompare.module.css b/src/features/database/SchemaCompare.module.css index cb7c9ddc12..a6cc9fbda4 100644 --- a/src/features/database/SchemaCompare.module.css +++ b/src/features/database/SchemaCompare.module.css @@ -2,8 +2,8 @@ display: flex; flex-direction: column; gap: var(--space-2); - height: 560px; - padding: 14px; + height: clamp(350px, 68vh, 620px); + padding: var(--space-4); } .pickers { display: flex; @@ -35,7 +35,8 @@ color: var(--fg-muted); } .panes { - display: flex; + display: grid; + grid-template-rows: minmax(0, 5fr) minmax(0, 4fr); gap: var(--space-2); flex: 1; min-height: 0; @@ -43,7 +44,6 @@ .tree { display: flex; flex-direction: column; - flex: 1.2; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-control); @@ -54,8 +54,19 @@ min-height: 0; } .preview { - flex: 1; + display: flex; + flex-direction: column; + gap: var(--space-1); min-width: 0; + min-height: 0; +} +.previewLabel { + color: var(--fg-secondary); + font-size: var(--fs-small); +} +.preview > :last-child { + flex: 1; + min-height: 0; } .row { display: inline-flex; diff --git a/src/features/database/SchemaCompareDialog.tsx b/src/features/database/SchemaCompareDialog.tsx index 9e39ea5fab..856ab66e4c 100644 --- a/src/features/database/SchemaCompareDialog.tsx +++ b/src/features/database/SchemaCompareDialog.tsx @@ -328,7 +328,12 @@ export function SchemaCompareDialog({ initial }: { initial: Side | null }) { /> )}
- +
+ + Migration script + + +
diff --git a/src/features/database/SourceDialog.tsx b/src/features/database/SourceDialog.tsx index 15bd42d16c..a635139c04 100644 --- a/src/features/database/SourceDialog.tsx +++ b/src/features/database/SourceDialog.tsx @@ -1404,7 +1404,7 @@ export function SourceDialog({ open onClose={closeDialog} title={initial ? tx`Data Source: ${initial.name}` : "New Data Source"} - width={640} + width={760} footerStart={