дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-20 00:25:42 +02:00
Порівняти коміти
2
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
8781acd42f | ||
|
|
107bf4a8e2 |
No files matched your search
@@ -1194,31 +1194,11 @@ pub struct ArduinoSettings {
|
||||
}
|
||||
|
||||
/// Languages & Frameworks › Markdown. Like IDEA's, it is application-level only.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
|
||||
#[derive(Clone, Debug, Default, 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<u32>,
|
||||
/// "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<MarkdownCommandDirectory>,
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function showBuild(page: Page) {
|
||||
await page.evaluate(async () => {
|
||||
const storePath = "/src/features/build/store.ts";
|
||||
const layoutPath = "/src/workbench/toolwindows/store.ts";
|
||||
const { useBuildRun } = await import(/* @vite-ignore */ storePath);
|
||||
const { showToolWindow } = await import(/* @vite-ignore */ layoutPath);
|
||||
useBuildRun.setState({
|
||||
title: "Build Project",
|
||||
system: "typescript",
|
||||
status: "failed",
|
||||
durationMs: 1200,
|
||||
selected: null,
|
||||
lines: [
|
||||
{ kind: "out", text: "Compiling TypeScript" },
|
||||
{ kind: "err", text: "Expected a number" },
|
||||
],
|
||||
messages: [{ severity: "error", text: "Expected a number", path: null, range: null, code: null }],
|
||||
});
|
||||
showToolWindow("build", true);
|
||||
});
|
||||
const build = page.getByRole("region", { name: "Build", exact: true });
|
||||
await expect(build.getByRole("log", { name: "Build output" })).toBeVisible();
|
||||
return build;
|
||||
}
|
||||
|
||||
test("Build gives about two thirds of the initial split to output", async ({ workbench: page }) => {
|
||||
const build = await showBuild(page);
|
||||
const tree = build.locator("[data-panel][id=build-tree]");
|
||||
const console = build.locator("[data-panel][id=build-console]");
|
||||
const treeWidth = (await tree.boundingBox())!.width;
|
||||
const consoleWidth = (await console.boundingBox())!.width;
|
||||
expect(treeWidth / (treeWidth + consoleWidth)).toBeCloseTo(0.33, 2);
|
||||
});
|
||||
|
||||
test("Build output and diagnostics respond to a console font change", async ({ workbench: page }) => {
|
||||
const build = await showBuild(page);
|
||||
const log = build.getByRole("log", { name: "Build output" });
|
||||
const rowGap = async () => {
|
||||
const first = (await log.getByText("Compiling TypeScript", { exact: true }).boundingBox())!;
|
||||
const second = (await log.getByText("Expected a number", { exact: true }).boundingBox())!;
|
||||
return second.y - first.y;
|
||||
};
|
||||
await expect.poll(rowGap).toBe(20);
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ path);
|
||||
const { settings } = useProject.getState();
|
||||
useProject.setState({
|
||||
settings: {
|
||||
...settings,
|
||||
terminal: {
|
||||
...settings?.terminal,
|
||||
useEditorFont: false,
|
||||
fontFamily: "Fira Code",
|
||||
fallbackFontFamily: "Maple Mono NF CN",
|
||||
fontSize: 18,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
await expect(log).toHaveCSS("font-size", "18px");
|
||||
await expect(log).toHaveCSS("font-family", /"Fira Code".*"Maple Mono NF CN"/);
|
||||
await expect.poll(rowGap).toBe(27);
|
||||
await build.getByRole("treeitem", { name: "Expected a number", exact: true }).click();
|
||||
const diagnostic = build.getByRole("document", { name: "Build message" });
|
||||
await expect(diagnostic).toContainText("Expected a number");
|
||||
await expect(diagnostic).toHaveCSS("font-size", "18px");
|
||||
await expect(diagnostic).toHaveCSS("line-height", "27px");
|
||||
});
|
||||
@@ -98,59 +98,3 @@ 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"/);
|
||||
});
|
||||
@@ -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),
|
||||
showLifecycle: kind === "run",
|
||||
...(kind === "services-run" ? { onRerun: null, onDebug: null } : {}),
|
||||
};
|
||||
} else if (kind === "debug" || kind === "services-debug") {
|
||||
const statePath = "/src/features/debugger/state.ts";
|
||||
|
||||
@@ -1,29 +1,5 @@
|
||||
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) => {
|
||||
|
||||
@@ -1,40 +1,6 @@
|
||||
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" };
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("keeps debug actions and views accessible when the Debug window is docked at the side", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 900, height: 760 });
|
||||
await page.evaluate(async () => {
|
||||
const debugModule = "/src/features/debugger/state.ts";
|
||||
const layoutModule = "/src/workbench/toolwindows/store.ts";
|
||||
const servicesModule = "/src/workbench/contributions.ts";
|
||||
const { adoptSession } = await import(/* @vite-ignore */ debugModule);
|
||||
const { moveToolWindow, setToolWindowSize } = await import(/* @vite-ignore */ layoutModule);
|
||||
const { toolWindowService } = await import(/* @vite-ignore */ servicesModule);
|
||||
adoptSession(91, { name: "Checkout service", adapter: "java-debug", status: "starting" });
|
||||
moveToolWindow("debug", "right");
|
||||
setToolWindowSize("right", 300);
|
||||
toolWindowService().show("debug", true);
|
||||
});
|
||||
|
||||
const pane = page.getByRole("region", { name: "Debug", exact: true });
|
||||
const toolbar = pane.getByRole("toolbar", { name: "Debugger actions" });
|
||||
const views = pane.getByRole("tablist", { name: "Debug views" });
|
||||
await expect(toolbar.getByRole("button", { name: "More", exact: true })).toBeInViewport();
|
||||
await expect(views.getByRole("tab", { name: "Console", exact: true })).toBeInViewport();
|
||||
await views.getByRole("tab", { name: "Memory", exact: true }).click();
|
||||
await expect(views.getByRole("tab", { name: "Memory", exact: true })).toHaveAttribute("aria-selected", "true");
|
||||
});
|
||||
@@ -19,33 +19,6 @@ async function openChain(page: Page) {
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
test("a narrow diff keeps navigation, settings and the difference count visible", async ({ workbench: page }) => {
|
||||
const toolbar = await openChain(page);
|
||||
await page.setViewportSize({ width: 400, height: 600 });
|
||||
const clipped = await toolbar.evaluate((bar) => {
|
||||
const bounds = bar.getBoundingClientRect();
|
||||
const items = [...bar.querySelectorAll("button, span")].filter(
|
||||
(el) => el.matches("button") || el.textContent === "1 difference",
|
||||
);
|
||||
return items.flatMap((el) => {
|
||||
const box = el.getBoundingClientRect();
|
||||
if (el.matches("button") && !box.width) return [];
|
||||
return !box.width ||
|
||||
box.right > bounds.right + 1 ||
|
||||
box.bottom > bounds.bottom + 1 ||
|
||||
el.scrollWidth > el.clientWidth + 1
|
||||
? [el.getAttribute("aria-label") || el.textContent]
|
||||
: [];
|
||||
});
|
||||
});
|
||||
expect(clipped).toEqual([]);
|
||||
await toolbar.getByRole("button", { name: "Settings", exact: true }).click();
|
||||
await page.getByRole("menuitemcheckbox", { name: "Unified Viewer", exact: true }).click();
|
||||
await expect(toolbar.locator("..").locator(".cm-editor")).toHaveCount(1);
|
||||
await toolbar.getByRole("button", { name: "Next Difference", exact: true }).click();
|
||||
await expect(toolbar).toContainText("1 of 1 differences");
|
||||
});
|
||||
|
||||
test("maximizes a diff preview tab and restores its previous layout", async ({ workbench: page }) => {
|
||||
const toolbar = await openChain(page);
|
||||
const viewer = toolbar.locator("..");
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
import { expect, openFromTree, test } from "./fixtures";
|
||||
|
||||
test("fits a long wrapped tab and its close button inside a narrow editor group", async ({ workbench: page }) => {
|
||||
const filename = "QuarterlyReconciliationAndCheckoutAllocation.test.ts";
|
||||
await page.setViewportSize({ width: 720, height: 760 });
|
||||
await openFromTree(page, "README.md");
|
||||
await page.evaluate(async (filename) => {
|
||||
const projectModule = "/src/platform/project.ts";
|
||||
const projectFilesModule = "/src/features/project-tree/fs.ts";
|
||||
const editorModule = "/src/editor/core/controller.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ projectModule);
|
||||
const { projectFs } = await import(/* @vite-ignore */ projectFilesModule);
|
||||
const { editorController, useTabs } = await import(/* @vite-ignore */ editorModule);
|
||||
const { project, settings } = useProject.getState();
|
||||
useProject.setState({
|
||||
settings: {
|
||||
...settings,
|
||||
editor: { ...settings?.editor, tabs: { ...settings?.editor?.tabs, multipleRows: true } },
|
||||
},
|
||||
});
|
||||
const path = `${project.root}/${filename}`;
|
||||
await projectFs(project.root).createFile(path);
|
||||
await editorController().openFilesIn([path], useTabs.getState().activePane, "right");
|
||||
}, filename);
|
||||
|
||||
const tab = page.getByRole("tab", { name: filename, exact: true });
|
||||
await expect(tab).toHaveAttribute("aria-selected", "true");
|
||||
await expect
|
||||
.poll(() =>
|
||||
tab.evaluate((element) => {
|
||||
const close = element.parentElement?.querySelector("[data-tab-close]");
|
||||
const strip = element.closest('[role="tablist"]');
|
||||
return !!close && !!strip && close.getBoundingClientRect().right <= strip.getBoundingClientRect().right;
|
||||
}),
|
||||
)
|
||||
.toBe(true);
|
||||
await tab.locator("..").getByRole("button", { name: "Close Tab", exact: true }).click();
|
||||
await expect(tab).toBeHidden();
|
||||
});
|
||||
@@ -1,54 +0,0 @@
|
||||
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();
|
||||
});
|
||||
@@ -94,30 +94,3 @@ 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();
|
||||
});
|
||||
@@ -1,19 +0,0 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("gives the project name room before its path in a narrow tree", async ({ workbench: page }) => {
|
||||
await page.evaluate(async () => {
|
||||
const storeModule = "/src/features/project-tree/store.ts";
|
||||
const { useProjectTree } = await import(/* @vite-ignore */ storeModule);
|
||||
useProjectTree.setState({ name: "checkout-order-processing" });
|
||||
});
|
||||
|
||||
const pane = page.getByRole("region", { name: "Project", exact: true });
|
||||
await pane.getByRole("button", { name: "Options", exact: true }).click();
|
||||
await page.getByRole("menuitemcheckbox", { name: "Horizontal Scrolling" }).click();
|
||||
|
||||
const tree = pane.getByRole("tree", { name: "Project" });
|
||||
const name = tree.getByText("checkout-order-processing", { exact: true });
|
||||
await expect(name).toBeVisible();
|
||||
await expect.poll(() => name.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true);
|
||||
await expect.poll(() => tree.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true);
|
||||
});
|
||||
@@ -81,39 +81,6 @@ 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 () => {
|
||||
|
||||
@@ -13,32 +13,6 @@ 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();
|
||||
@@ -68,7 +42,35 @@ 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 stubFindMatches(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 run(page, id);
|
||||
await page.getByRole("dialog").getByPlaceholder("Search").fill("http://localhost:8080");
|
||||
await expect(page.getByRole("dialog").locator("header [aria-live]")).toContainText(/match/);
|
||||
@@ -93,19 +95,6 @@ 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",
|
||||
@@ -122,31 +111,3 @@ 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);
|
||||
});
|
||||
@@ -48,51 +48,6 @@ async function move(page: Page, source: string, target: string) {
|
||||
await page.mouse.up();
|
||||
}
|
||||
|
||||
test("Services favors details and stacks the panes when docked to the side", async ({ workbench: page }) => {
|
||||
await configure(page);
|
||||
const services = page.getByRole("region", { name: "Services", exact: true });
|
||||
const items = services.locator("[data-panel][id=services-items]");
|
||||
const detail = services.locator("[data-panel][id=services-detail]");
|
||||
const handle = services.locator("[data-separator]");
|
||||
const share = async (axis: "width" | "height") => {
|
||||
const treeSize = (await items.boundingBox())![axis];
|
||||
return treeSize / (treeSize + (await detail.boundingBox())![axis]);
|
||||
};
|
||||
const dock = (anchor: "bottom" | "right" | "left") =>
|
||||
page.evaluate(async (anchor) => {
|
||||
const path = "/src/workbench/toolwindows/store.ts";
|
||||
const { moveToolWindow, setToolWindowSize } = await import(/* @vite-ignore */ path);
|
||||
moveToolWindow("services", anchor);
|
||||
if (anchor !== "bottom") setToolWindowSize(anchor, 280);
|
||||
}, anchor);
|
||||
|
||||
await expect(handle).toHaveAttribute("aria-orientation", "vertical");
|
||||
await expect.poll(() => share("width")).toBeCloseTo(0.3, 2);
|
||||
await handle.press("ArrowRight");
|
||||
await expect.poll(() => share("width")).toBeGreaterThan(0.31);
|
||||
const bottom = await share("width");
|
||||
|
||||
for (const anchor of ["right", "left"] as const) {
|
||||
await dock(anchor);
|
||||
await expect(handle).toHaveAttribute("aria-orientation", "horizontal");
|
||||
const treeBox = (await items.boundingBox())!;
|
||||
const detailBox = (await detail.boundingBox())!;
|
||||
expect(detailBox.width).toBeCloseTo(treeBox.width, 0);
|
||||
expect(detailBox.y).toBeGreaterThanOrEqual(treeBox.y + treeBox.height - 1);
|
||||
await expect.poll(() => share("height")).toBeCloseTo(0.3, 2);
|
||||
}
|
||||
await handle.press("ArrowDown");
|
||||
await expect.poll(() => share("height")).toBeGreaterThan(0.31);
|
||||
const side = await share("height");
|
||||
|
||||
await dock("bottom");
|
||||
await expect(handle).toHaveAttribute("aria-orientation", "vertical");
|
||||
await expect.poll(() => share("width")).toBeCloseTo(bottom, 2);
|
||||
await dock("right");
|
||||
await expect(handle).toHaveAttribute("aria-orientation", "horizontal");
|
||||
await expect.poll(() => share("height")).toBeCloseTo(side, 2);
|
||||
});
|
||||
|
||||
test("service pointer ordering works for Java and npm and survives reload", async ({ workbench: page }) => {
|
||||
await configure(page);
|
||||
const tree = page.getByRole("tree", { name: "Services", exact: true });
|
||||
|
||||
@@ -72,7 +72,6 @@ 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();
|
||||
|
||||
@@ -139,14 +139,11 @@ fn announce_available(app: &AppHandle) {
|
||||
return;
|
||||
}
|
||||
let state = app.state::<AppState>();
|
||||
// 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());
|
||||
ready_owner(focused.as_ref().map(|window| window.label()), &live, &ready)
|
||||
let focused = crate::windows::target_window(app);
|
||||
ready_owner(focused.as_ref().map(|window| window.label()), &crate::windows::project_window_labels(app), &ready)
|
||||
};
|
||||
let Some(owner) = owner else { return };
|
||||
let update = {
|
||||
|
||||
@@ -8237,23 +8237,10 @@ 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. */
|
||||
|
||||
@@ -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[], titleOf = baseName): Map<string, string> {
|
||||
export function disambiguateTitles(paths: readonly string[]): Map<string, string> {
|
||||
const groups = new Map<string, string[]>();
|
||||
for (const p of new Set(paths)) {
|
||||
const name = titleOf(p);
|
||||
const name = baseName(p);
|
||||
const list = groups.get(name);
|
||||
if (list) list.push(p);
|
||||
else groups.set(name, [p]);
|
||||
|
||||
@@ -161,11 +161,7 @@ function useTitleHints(): Map<string, string> {
|
||||
return out.sort();
|
||||
}),
|
||||
);
|
||||
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]);
|
||||
return useMemo(() => disambiguateTitles(paths), [paths]);
|
||||
}
|
||||
|
||||
const virtualData = (input: EditorInput) => input.data as VirtualInputData | undefined;
|
||||
@@ -184,8 +180,6 @@ 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");
|
||||
|
||||
@@ -206,7 +200,7 @@ function PaneView({ paneId }: { paneId: string }) {
|
||||
return tabs.map((t, i) => {
|
||||
const full = names[i]!;
|
||||
const dot = full.lastIndexOf(".");
|
||||
const name = tabLabels[i] ?? (t.input.kind === "file" && !showExtension && dot > 0 ? full.slice(0, dot) : full);
|
||||
const name = t.input.kind === "file" && !showExtension && dot > 0 ? full.slice(0, dot) : full;
|
||||
const dupe = !showDirectoryForNonUnique
|
||||
? null
|
||||
: t.input.kind === "file" && t.input.path
|
||||
@@ -229,7 +223,7 @@ function PaneView({ paneId }: { paneId: string }) {
|
||||
text: dupe ? `${name} — ${dupe}` : name,
|
||||
icon: showFileIcon
|
||||
? t.input.kind === "file" && t.input.path
|
||||
? (tabIcons[i] ?? file?.icon)
|
||||
? file?.icon
|
||||
: tabIcon(t.input, kinds)
|
||||
: undefined,
|
||||
italic: t.preview,
|
||||
@@ -261,8 +255,6 @@ function PaneView({ paneId }: { paneId: string }) {
|
||||
colors,
|
||||
errors,
|
||||
tints,
|
||||
tabLabels,
|
||||
tabIcons,
|
||||
fileColors,
|
||||
hints,
|
||||
showExtension,
|
||||
|
||||
@@ -97,8 +97,4 @@ 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;
|
||||
},
|
||||
};
|
||||
@@ -76,6 +76,8 @@
|
||||
overflow: auto;
|
||||
position: relative;
|
||||
padding: 4px 0;
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-code);
|
||||
color: var(--fg);
|
||||
background: var(--bg-app);
|
||||
-webkit-user-select: text;
|
||||
@@ -97,6 +99,7 @@
|
||||
left: 0;
|
||||
min-width: 100%;
|
||||
padding: 0 12px;
|
||||
line-height: 20px;
|
||||
white-space: pre;
|
||||
tab-size: 4;
|
||||
}
|
||||
@@ -138,6 +141,9 @@
|
||||
.detail {
|
||||
overflow: auto;
|
||||
padding: 4px 12px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-code);
|
||||
line-height: 20px;
|
||||
color: var(--fg);
|
||||
background: var(--bg-app);
|
||||
-webkit-user-select: text;
|
||||
|
||||
@@ -5,16 +5,7 @@
|
||||
* its source (as IDEA: selection shows, navigation jumps).
|
||||
*/
|
||||
import { copySelectionOnKeyDown } from "@/ui/selectableText";
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
type MouseEvent,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent, type ReactNode } from "react";
|
||||
import clsx from "clsx";
|
||||
import { useVirtualizer } from "@tanstack/react-virtual";
|
||||
import { basename, relativeDir, useProject } from "@/platform/project";
|
||||
@@ -50,7 +41,6 @@ import { openTarget, openUrl } from "@/features/run/navigate";
|
||||
import { navigateToMessage, rerunBuild, selectBuildNode, useBuildRun } from "./store";
|
||||
import styles from "./Build.module.css";
|
||||
import { WidestColumns } from "@/platform/consoleColumns";
|
||||
import { useConsoleFont } from "@/platform/consoleFont";
|
||||
import { tx } from "@/platform/i18n";
|
||||
|
||||
const SEVERITY_ICON: Record<Severity, string> = { error: "error", warning: "warning", info: "info", hint: "info" };
|
||||
@@ -213,6 +203,8 @@ function BuildTree() {
|
||||
);
|
||||
}
|
||||
|
||||
const LINE_HEIGHT = 20;
|
||||
|
||||
/**
|
||||
* One console line: file locations and URLs (compiler diagnostics, stack
|
||||
* frames) are links, resolved against the directory of the step that printed
|
||||
@@ -250,7 +242,7 @@ function ConsoleLineText({ line, root }: { line: ConsoleLine; root: string }) {
|
||||
return <>{out}</>;
|
||||
}
|
||||
|
||||
function BuildConsole({ rowHeight }: { rowHeight: number }) {
|
||||
function BuildConsole() {
|
||||
const root = useProject((s) => s.project?.root ?? "/");
|
||||
const lines = useBuildRun((s) => s.lines);
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
@@ -260,15 +252,12 @@ function BuildConsole({ rowHeight }: { rowHeight: number }) {
|
||||
const virtualizer = useVirtualizer({
|
||||
count: lines.length,
|
||||
getScrollElement: () => ref.current,
|
||||
estimateSize: () => rowHeight,
|
||||
estimateSize: () => LINE_HEIGHT,
|
||||
overscan: 20,
|
||||
});
|
||||
useLayoutEffect(() => {
|
||||
virtualizer.measure();
|
||||
}, [rowHeight, virtualizer]);
|
||||
useEffect(() => {
|
||||
if (stick.current && lines.length) virtualizer.scrollToIndex(lines.length - 1, { align: "end" });
|
||||
}, [lines.length, rowHeight, virtualizer]);
|
||||
}, [lines.length, virtualizer]);
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
@@ -279,7 +268,7 @@ function BuildConsole({ rowHeight }: { rowHeight: number }) {
|
||||
aria-label={tx("Build output")}
|
||||
onScroll={(e) => {
|
||||
const el = e.currentTarget;
|
||||
stick.current = el.scrollHeight - el.scrollTop - el.clientHeight < rowHeight * 2;
|
||||
stick.current = el.scrollHeight - el.scrollTop - el.clientHeight < LINE_HEIGHT * 2;
|
||||
}}
|
||||
>
|
||||
<div
|
||||
@@ -330,16 +319,15 @@ function MessageDetail({ message }: { message: BuildMessage }) {
|
||||
);
|
||||
}
|
||||
|
||||
function BuildOutput({ rowHeight }: { rowHeight: number }) {
|
||||
function BuildOutput() {
|
||||
const selected = useBuildRun((s) => s.selected);
|
||||
const messages = useBuildRun((s) => s.messages);
|
||||
const node = useMemo(() => (selected ? findNode(messages, selected) : undefined), [selected, messages]);
|
||||
return node?.kind === "message" ? <MessageDetail message={node.message} /> : <BuildConsole rowHeight={rowHeight} />;
|
||||
return node?.kind === "message" ? <MessageDetail message={node.message} /> : <BuildConsole />;
|
||||
}
|
||||
|
||||
export function BuildView() {
|
||||
const hasBuild = useBuildRun((s) => s.status !== null);
|
||||
const font = useConsoleFont();
|
||||
if (!hasBuild) {
|
||||
return (
|
||||
<div className={styles.view}>
|
||||
@@ -357,22 +345,12 @@ export function BuildView() {
|
||||
id="build-view-split"
|
||||
storageKey="openidea.build.split"
|
||||
>
|
||||
<SplitPanel id="build-tree" defaultSize="33%" minSize="120px" className={styles.pane}>
|
||||
<SplitPanel id="build-tree" defaultSize="38%" minSize="120px" className={styles.pane}>
|
||||
<BuildTree />
|
||||
</SplitPanel>
|
||||
<SplitHandle />
|
||||
<SplitPanel
|
||||
id="build-console"
|
||||
minSize="120px"
|
||||
className={styles.pane}
|
||||
style={{
|
||||
fontFamily: font.family,
|
||||
fontSize: font.size,
|
||||
fontWeight: font.weight,
|
||||
lineHeight: `${font.rowHeight}px`,
|
||||
}}
|
||||
>
|
||||
<BuildOutput rowHeight={font.rowHeight} />
|
||||
<SplitPanel id="build-console" minSize="120px" className={styles.pane}>
|
||||
<BuildOutput />
|
||||
</SplitPanel>
|
||||
</SplitGroup>
|
||||
</div>
|
||||
|
||||
@@ -210,14 +210,7 @@ export function ImportDialog({ id, schema, table }: { id: string; schema: string
|
||||
<T>File:</T>
|
||||
</span>
|
||||
<div className={styles.formRow}>
|
||||
<Input
|
||||
className={styles.fill}
|
||||
readOnly
|
||||
aria-label="File"
|
||||
value={file ?? ""}
|
||||
placeholder="Choose a CSV or TSV file"
|
||||
title={file ?? undefined}
|
||||
/>
|
||||
<Input readOnly aria-label="File" value={file ?? ""} placeholder="Choose a CSV or TSV file" />
|
||||
<IconButton icon="folder" title="Choose File…" onClick={() => void choose()} />
|
||||
</div>
|
||||
<span className={styles.formLabel}>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Record / Value / Aggregates side panel following the selection.
|
||||
*/
|
||||
import { writeClipboardText } from "@/platform/clipboard";
|
||||
import { useMemo, useRef, useState, type KeyboardEvent, type ReactNode, type RefObject } from "react";
|
||||
import { useMemo, useRef, useState, type KeyboardEvent, 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,7 +99,6 @@ 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;
|
||||
@@ -248,7 +247,6 @@ export function DataView(props: DataViewProps) {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{props.pager && <div className={styles.pagerDock}>{props.pager}</div>}
|
||||
</div>
|
||||
{filterAt && (
|
||||
<FilterPopup
|
||||
|
||||
@@ -73,11 +73,10 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding: 0 var(--space-1);
|
||||
padding: 0 6px;
|
||||
color: var(--fg-line-number);
|
||||
background: var(--bg-editor-gutter);
|
||||
border-right: 1px solid var(--border);
|
||||
border-bottom: 1px solid var(--border);
|
||||
user-select: none;
|
||||
}
|
||||
.cell {
|
||||
@@ -140,10 +139,9 @@
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-0-5);
|
||||
min-height: 32px;
|
||||
padding: var(--space-0-5) var(--space-2);
|
||||
height: var(--h-header);
|
||||
padding: 0 6px;
|
||||
flex: none;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
@@ -235,16 +233,14 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
.dbToolbar {
|
||||
min-height: 32px;
|
||||
height: 32px;
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-0-5);
|
||||
padding: var(--space-0-5) var(--space-2);
|
||||
padding: 0 6px;
|
||||
}
|
||||
.dbToolbarSep {
|
||||
flex: none;
|
||||
width: 1px;
|
||||
height: 16px;
|
||||
margin: 0 4px;
|
||||
@@ -290,22 +286,15 @@
|
||||
.consoleBar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-0-5);
|
||||
min-height: 32px;
|
||||
padding: var(--space-0-5) var(--space-2);
|
||||
gap: var(--space-1);
|
||||
height: var(--h-header);
|
||||
padding: 0 8px;
|
||||
background: var(--bg-editor);
|
||||
border-bottom: 1px solid var(--border);
|
||||
font-family: var(--font-ui);
|
||||
font-size: var(--fs-ui);
|
||||
color: var(--fg-secondary);
|
||||
}
|
||||
.consoleSchema {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
padding-inline: var(--space-2);
|
||||
}
|
||||
|
||||
/* Inline statement errors in consoles. */
|
||||
:global(.cm-openidea-db-error) {
|
||||
@@ -318,9 +307,9 @@
|
||||
/* Table editor. */
|
||||
/* The table editor's WHERE | ORDER BY row (IDEA). */
|
||||
.filterBar {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
|
||||
display: flex;
|
||||
flex: none;
|
||||
height: var(--h-header);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.filterField {
|
||||
@@ -329,26 +318,29 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1-5);
|
||||
padding: 0 var(--space-2);
|
||||
padding: 0 8px;
|
||||
color: var(--fg-muted);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-small);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.filterField + .filterField {
|
||||
border-left: 1px solid var(--border);
|
||||
}
|
||||
.filterField:focus-within {
|
||||
box-shadow: inset 0 -1px var(--focus-ring);
|
||||
.filterField > input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.filterField:has(input[aria-invalid="true"]) {
|
||||
box-shadow: inset 0 -1px var(--danger);
|
||||
.pager {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-0-5);
|
||||
color: var(--fg-secondary);
|
||||
font-size: var(--fs-small);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.notice {
|
||||
padding: var(--space-1) var(--space-2);
|
||||
padding: 4px 8px;
|
||||
font-size: var(--fs-small);
|
||||
color: var(--fg-secondary);
|
||||
background: var(--bg-elev);
|
||||
background: var(--bg-editor-banner);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
@@ -435,28 +427,6 @@
|
||||
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;
|
||||
@@ -579,16 +549,10 @@
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
.testResult {
|
||||
grid-column: 1 / -1;
|
||||
font-size: var(--fs-small);
|
||||
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;
|
||||
min-height: 16px;
|
||||
word-break: break-word;
|
||||
}
|
||||
.ok {
|
||||
color: var(--success);
|
||||
@@ -773,28 +737,17 @@
|
||||
.modifyBody {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
height: clamp(320px, 68vh, 560px);
|
||||
padding: var(--space-4);
|
||||
gap: 10px;
|
||||
padding: 14px;
|
||||
}
|
||||
.modifyMain {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(108px, 34%) minmax(0, 1fr);
|
||||
min-height: 0;
|
||||
grid-template-columns: 260px 1fr;
|
||||
height: 240px;
|
||||
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;
|
||||
@@ -833,17 +786,13 @@
|
||||
}
|
||||
.modifyProps {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 27%) minmax(0, 1fr);
|
||||
grid-template-columns: max-content 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);
|
||||
@@ -882,6 +831,9 @@
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
.dataView > .fill {
|
||||
min-width: 0;
|
||||
}
|
||||
.headerFilter {
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
@@ -986,8 +938,7 @@
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: clamp(160px, 38%, 300px);
|
||||
max-width: 50%;
|
||||
width: 320px;
|
||||
min-height: 0;
|
||||
border-left: 1px solid var(--border);
|
||||
}
|
||||
@@ -1214,42 +1165,29 @@
|
||||
|
||||
/* Export / history / import dialogs. */
|
||||
.exportDialog {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
|
||||
display: flex;
|
||||
gap: var(--space-4);
|
||||
height: min(440px, 65vh);
|
||||
min-height: 340px;
|
||||
padding: var(--space-4);
|
||||
height: 420px;
|
||||
padding: 14px;
|
||||
}
|
||||
.exportOptions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
.exportOptions .formRow > input {
|
||||
flex: 1;
|
||||
width: 300px;
|
||||
flex: none;
|
||||
}
|
||||
.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;
|
||||
@@ -1430,7 +1368,6 @@
|
||||
flex: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1);
|
||||
padding: 4px 8px;
|
||||
background: var(--bg-elev);
|
||||
@@ -1438,8 +1375,8 @@
|
||||
font-size: var(--fs-ui);
|
||||
}
|
||||
.gridSearchField {
|
||||
flex: 0 1 320px;
|
||||
min-width: min(100%, 160px);
|
||||
flex: 0 1 360px;
|
||||
min-width: 160px;
|
||||
}
|
||||
.gridSearchCount {
|
||||
font-family: var(--font-mono);
|
||||
@@ -1459,19 +1396,14 @@
|
||||
background: var(--bg-text-search-result-current);
|
||||
}
|
||||
|
||||
.pagerDock {
|
||||
flex: none;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: var(--space-1) var(--space-2) var(--space-2);
|
||||
background: var(--bg-editor);
|
||||
}
|
||||
/* IDEA's floating pager at the bottom of a result: |< < 1-500 of 501+ > >| and the page size. */
|
||||
.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));
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
Icon,
|
||||
IconButton,
|
||||
Menu,
|
||||
Toolbar,
|
||||
Tree,
|
||||
showContextMenu,
|
||||
tooltipAttrs,
|
||||
@@ -524,7 +523,6 @@ export function DatabaseView() {
|
||||
return color ? `var(--db-color-${color})` : undefined;
|
||||
}}
|
||||
speedSearchField
|
||||
horizontalScroll
|
||||
renderNode={(n: Node, state) => {
|
||||
const i = icon(n);
|
||||
const d = detail(n);
|
||||
@@ -613,7 +611,7 @@ function DatabaseToolbar() {
|
||||
const active = !!target && [...connected].some((t) => splitTarget(t).id === splitTarget(target).id);
|
||||
const button = { size: "small", iconSize: 16 } as const;
|
||||
return (
|
||||
<Toolbar className={styles.dbToolbar} aria-label="Database actions">
|
||||
<div className={styles.dbToolbar} role="toolbar" aria-label={tx("Database actions")}>
|
||||
<IconButton
|
||||
ref={plus}
|
||||
{...button}
|
||||
@@ -650,7 +648,7 @@ function DatabaseToolbar() {
|
||||
>
|
||||
<T>DDL</T>
|
||||
</button>
|
||||
</Toolbar>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ 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 {
|
||||
@@ -168,7 +169,6 @@ export function Grid(props: GridProps) {
|
||||
copyFormat = "tsv",
|
||||
} = props;
|
||||
const scrollRef = useRef<HTMLDivElement>(null);
|
||||
const numberWidth = Math.max(40, String(firstRowNumber + rowCount - 1).length * 8 + 8);
|
||||
const [sel, setSel] = useState<Sel | null>(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 ? 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);
|
||||
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);
|
||||
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(() => numberWidth + widths.reduce((a, b) => a + b, 0), [numberWidth, widths]);
|
||||
const template = `${numberWidth}px ${widths.map((w) => `${w}px`).join(" ")}`;
|
||||
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 selected = (r: number, c: number) => {
|
||||
if (!sel) return false;
|
||||
|
||||
@@ -577,7 +577,7 @@ export function Result({ tab, onClose }: { tab: ResultTab; onClose?: () => void
|
||||
{notice}
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.fill}>
|
||||
<div className={clsx(styles.fill, styles.gridHost)}>
|
||||
<DataView
|
||||
columns={gridColumns}
|
||||
rowCount={rowCount}
|
||||
@@ -590,7 +590,6 @@ export function Result({ tab, onClose }: { tab: ResultTab; onClose?: () => void
|
||||
searchOpen={searchOpen}
|
||||
onSearchOpenChange={setSearchOpen}
|
||||
firstRowNumber={(tab.page ?? 0) * (tab.pageSize ?? 0) + 1}
|
||||
pager={<Pager tab={busy ? { ...tab, busy: true } : tab} />}
|
||||
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]!)}
|
||||
@@ -612,6 +611,7 @@ export function Result({ tab, onClose }: { tab: ResultTab; onClose?: () => void
|
||||
: []
|
||||
}
|
||||
/>
|
||||
<Pager tab={busy ? { ...tab, busy: true } : tab} />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -817,7 +817,7 @@ export function ResultsView() {
|
||||
...results.map((r) => ({
|
||||
id: String(r.id),
|
||||
label: r.title,
|
||||
icon: r.plan ? "db-plan" : "db-table",
|
||||
icon: r.plan ? "db-plan" : "database",
|
||||
closable: true,
|
||||
pinned: r.pinned,
|
||||
tooltip: r.outcome.statement.text,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
height: clamp(350px, 68vh, 620px);
|
||||
padding: var(--space-4);
|
||||
height: 560px;
|
||||
padding: 14px;
|
||||
}
|
||||
.pickers {
|
||||
display: flex;
|
||||
@@ -35,8 +35,7 @@
|
||||
color: var(--fg-muted);
|
||||
}
|
||||
.panes {
|
||||
display: grid;
|
||||
grid-template-rows: minmax(0, 5fr) minmax(0, 4fr);
|
||||
display: flex;
|
||||
gap: var(--space-2);
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
@@ -44,6 +43,7 @@
|
||||
.tree {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1.2;
|
||||
min-width: 0;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-control);
|
||||
@@ -54,19 +54,8 @@
|
||||
min-height: 0;
|
||||
}
|
||||
.preview {
|
||||
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;
|
||||
min-width: 0;
|
||||
}
|
||||
.row {
|
||||
display: inline-flex;
|
||||
|
||||
@@ -328,12 +328,7 @@ export function SchemaCompareDialog({ initial }: { initial: Side | null }) {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.preview}>
|
||||
<span className={styles.previewLabel}>
|
||||
<T>Migration script</T>
|
||||
</span>
|
||||
<CodePreview sql aria-label="Migration script" text={sql} />
|
||||
</div>
|
||||
<CodePreview sql className={styles.preview} aria-label="Migration script" text={sql} />
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
@@ -1404,7 +1404,7 @@ export function SourceDialog({
|
||||
open
|
||||
onClose={closeDialog}
|
||||
title={initial ? tx`Data Source: ${initial.name}` : "New Data Source"}
|
||||
width={760}
|
||||
width={640}
|
||||
footerStart={
|
||||
<Button onClick={() => void runTest()} disabled={busy || !valid}>
|
||||
<T>Test Connection</T>
|
||||
@@ -1415,76 +1415,74 @@ export function SourceDialog({
|
||||
{ label: "OK", role: "default", disabled: busy || !valid, onClick: () => void save() },
|
||||
]}
|
||||
>
|
||||
<div className={styles.sourceLayout}>
|
||||
<div className={styles.form}>
|
||||
<label className={styles.formLabel} htmlFor="db-name">
|
||||
<T>Name:</T>
|
||||
</label>
|
||||
<div className={styles.formRow}>
|
||||
<Input
|
||||
id="db-name"
|
||||
className={styles.fill}
|
||||
value={s.name ?? ""}
|
||||
placeholder={name}
|
||||
onChange={(e) => set({ name: e.target.value })}
|
||||
<div className={styles.form}>
|
||||
<label className={styles.formLabel} htmlFor="db-name">
|
||||
<T>Name:</T>
|
||||
</label>
|
||||
<div className={styles.formRow}>
|
||||
<Input
|
||||
id="db-name"
|
||||
className={styles.fill}
|
||||
value={s.name ?? ""}
|
||||
placeholder={name}
|
||||
onChange={(e) => set({ name: e.target.value })}
|
||||
/>
|
||||
<span className={styles.formLabel}>
|
||||
<T>Color:</T>
|
||||
</span>
|
||||
<Select
|
||||
aria-label="Color"
|
||||
className={styles.narrowSelect}
|
||||
value={s.color ?? "none"}
|
||||
options={COLORS}
|
||||
onChange={(c) => set({ color: c === "none" ? null : c })}
|
||||
renderValue={(o) => (
|
||||
<span className={styles.colorValue}>
|
||||
{o && o.value !== "none" && (
|
||||
<span className={styles.colorSwatch} style={{ background: colorVar(o.value as DbColor) }} />
|
||||
)}
|
||||
<T>{o?.label ?? "No color"}</T>
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
{/* IDEA's Make Global: stored with the IDE and listed in every project. */}
|
||||
<span title={tx("Available in all projects")}>
|
||||
<Checkbox
|
||||
checked={!!s.global}
|
||||
disabled={!!s.pluginOwner}
|
||||
onChange={(global) => set({ global })}
|
||||
label="Global"
|
||||
/>
|
||||
<span className={styles.formLabel}>
|
||||
<T>Color:</T>
|
||||
</span>
|
||||
<Select
|
||||
aria-label="Color"
|
||||
className={styles.narrowSelect}
|
||||
value={s.color ?? "none"}
|
||||
options={COLORS}
|
||||
onChange={(c) => set({ color: c === "none" ? null : c })}
|
||||
renderValue={(o) => (
|
||||
<span className={styles.colorValue}>
|
||||
{o && o.value !== "none" && (
|
||||
<span className={styles.colorSwatch} style={{ background: colorVar(o.value as DbColor) }} />
|
||||
)}
|
||||
<T>{o?.label ?? "No color"}</T>
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
{/* IDEA's Make Global: stored with the IDE and listed in every project. */}
|
||||
<span title={tx("Available in all projects")}>
|
||||
<Checkbox
|
||||
checked={!!s.global}
|
||||
disabled={!!s.pluginOwner}
|
||||
onChange={(global) => set({ global })}
|
||||
label="Global"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<span />
|
||||
{showComment ? (
|
||||
<textarea
|
||||
className={styles.textArea}
|
||||
aria-label={tx("Comment")}
|
||||
autoFocus={!s.comment}
|
||||
rows={2}
|
||||
value={s.comment ?? ""}
|
||||
placeholder={tx("Comment")}
|
||||
onChange={(e) => set({ comment: e.target.value })}
|
||||
/>
|
||||
) : (
|
||||
<button type="button" className={styles.linkButton} onClick={() => setShowComment(true)}>
|
||||
<T>Add comment</T>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<Tabs
|
||||
variant="compact"
|
||||
className={styles.dialogTabs}
|
||||
activeId={current}
|
||||
onSelect={(id) => setTab(id as Tab)}
|
||||
aria-label="Data source settings"
|
||||
panelIdPrefix="db-source"
|
||||
items={tabs}
|
||||
/>
|
||||
<div className={`${styles.form} ${styles.sourcePanel}`} role="tabpanel" id={`db-source-panel-${current}`}>
|
||||
{body[current]}
|
||||
</span>
|
||||
</div>
|
||||
<span />
|
||||
{showComment ? (
|
||||
<textarea
|
||||
className={styles.textArea}
|
||||
aria-label={tx("Comment")}
|
||||
autoFocus={!s.comment}
|
||||
rows={2}
|
||||
value={s.comment ?? ""}
|
||||
placeholder={tx("Comment")}
|
||||
onChange={(e) => set({ comment: e.target.value })}
|
||||
/>
|
||||
) : (
|
||||
<button type="button" className={styles.linkButton} onClick={() => setShowComment(true)}>
|
||||
<T>Add comment</T>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<Tabs
|
||||
variant="compact"
|
||||
className={styles.dialogTabs}
|
||||
activeId={current}
|
||||
onSelect={(id) => setTab(id as Tab)}
|
||||
aria-label="Data source settings"
|
||||
panelIdPrefix="db-source"
|
||||
items={tabs}
|
||||
/>
|
||||
<div className={styles.form} role="tabpanel" id={`db-source-panel-${current}`}>
|
||||
{body[current]}
|
||||
<div className={`${styles.testResult} ${test?.ok ? styles.ok : styles.bad}`} role="status">
|
||||
{busy && !test ? tx("Connecting…") : test?.text}
|
||||
{test?.trust && (
|
||||
|
||||
@@ -101,6 +101,7 @@ export function SqlFilterInput({
|
||||
variant="bare"
|
||||
mono
|
||||
aria-label={kind === "where" ? "WHERE filter" : "ORDER BY"}
|
||||
placeholder={kind === "where" ? "WHERE" : "ORDER BY"}
|
||||
invalid={invalid}
|
||||
value={value}
|
||||
onChange={(e) => {
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
type DbTablePage,
|
||||
type RequestId,
|
||||
} from "@/platform/ipc";
|
||||
import { EmptyState, Icon, IconButton, Select, Spinner, Toolbar, showContextMenu } from "@/ui";
|
||||
import { Button, EmptyState, Icon, IconButton, Select, Spinner, T, showContextMenu, tooltipAttrs } from "@/ui";
|
||||
import { notifications, type EditorInput } from "@/workbench/contributions";
|
||||
import { SqlFilterInput } from "./SqlFilterInput";
|
||||
import { ColumnsPopup } from "./ColumnsPopup";
|
||||
@@ -35,7 +35,6 @@ import styles from "./Database.module.css";
|
||||
import { registerTableEditor, tableEditorChanged, type TableEditorHandle } from "./tableEditorFocus";
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { shortcutLabel } from "@/platform/keymap";
|
||||
import { pageWindow } from "./resultView";
|
||||
|
||||
const PAGE_SIZES = ["100", "500", "1000", "5000"];
|
||||
|
||||
@@ -284,18 +283,9 @@ export function TableEditor({ input }: { input: EditorInput }) {
|
||||
useEffect(() => registerTableEditor(viewRef.current!, handle), [handle]);
|
||||
useEffect(() => tableEditorChanged(handle), [handle, dirty, editable]);
|
||||
const orderInvalid = orderDraft !== null && !parseOrderBy(orderDraft, names);
|
||||
const hasMore = page?.result.hasMore ?? false;
|
||||
const { first, last, total } = pageWindow({
|
||||
page: offset / limit,
|
||||
pageSize: limit,
|
||||
rows: loaded,
|
||||
hasMore,
|
||||
total: null,
|
||||
});
|
||||
const singlePage = offset === 0 && !hasMore;
|
||||
return (
|
||||
<div className={styles.view} ref={viewRef} data-db-table-editor="">
|
||||
<Toolbar className={styles.toolbar} aria-label="Table actions">
|
||||
<div className={styles.toolbar}>
|
||||
<IconButton
|
||||
icon="refresh"
|
||||
title="Reload Page"
|
||||
@@ -303,31 +293,55 @@ export function TableEditor({ input }: { input: EditorInput }) {
|
||||
onClick={reload}
|
||||
disabled={loading}
|
||||
/>
|
||||
<IconButton
|
||||
icon="search"
|
||||
title="Search"
|
||||
shortcut={shortcutLabel("find.inFile")}
|
||||
aria-pressed={searchOpen}
|
||||
onClick={() => setSearchOpen(!searchOpen)}
|
||||
/>
|
||||
<div className={styles.pager}>
|
||||
<IconButton
|
||||
icon="chevron-left"
|
||||
title="Previous Page"
|
||||
shortcut={shortcutLabel("db.previousPage")}
|
||||
disabled={!canPrevious}
|
||||
onClick={() => setOffset(Math.max(0, offset - limit))}
|
||||
/>
|
||||
<span>
|
||||
{loaded ? `${offset + 1}–${offset + loaded}` : "0"}
|
||||
{page?.result.hasMore ? " of more" : ""}
|
||||
</span>
|
||||
<IconButton
|
||||
icon="chevron-right"
|
||||
title="Next Page"
|
||||
shortcut={shortcutLabel("db.nextPage")}
|
||||
disabled={!canNext}
|
||||
onClick={() => setOffset(offset + limit)}
|
||||
/>
|
||||
<Select
|
||||
aria-label="Page size"
|
||||
value={String(limit)}
|
||||
options={PAGE_SIZES.map((v) => ({ value: v, label: v }))}
|
||||
onChange={(v) => {
|
||||
setOffset(0);
|
||||
setLimit(Number(v));
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{editable && (
|
||||
<>
|
||||
<span className={styles.toolbarSeparator} />
|
||||
<IconButton icon="plus" title="Add Row" shortcut={shortcutLabel("db.addRow")} onClick={addRow} />
|
||||
<IconButton
|
||||
icon="revert"
|
||||
title="Revert"
|
||||
shortcut={shortcutLabel("db.revertChanges")}
|
||||
disabled={!dirty}
|
||||
onClick={() => setEdits(emptyEdits())}
|
||||
/>
|
||||
<IconButton
|
||||
icon="arrow-up"
|
||||
title="Submit"
|
||||
shortcut={shortcutLabel("db.submitChanges")}
|
||||
<Button
|
||||
size="small"
|
||||
variant="primary"
|
||||
disabled={!dirty}
|
||||
onClick={() => void submit()}
|
||||
/>
|
||||
{...tooltipAttrs("Submit", shortcutLabel("db.submitChanges"))}
|
||||
>
|
||||
<T>Submit</T>
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
disabled={!dirty}
|
||||
onClick={() => setEdits(emptyEdits())}
|
||||
{...tooltipAttrs("Revert", shortcutLabel("db.revertChanges"))}
|
||||
>
|
||||
<T>Revert</T>
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{loading && <Spinner size={12} />}
|
||||
@@ -347,12 +361,18 @@ export function TableEditor({ input }: { input: EditorInput }) {
|
||||
disabled={!editable}
|
||||
onClick={() => openDialog({ kind: "import", id: ref.id, schema: ref.schema, table: ref.table })}
|
||||
/>
|
||||
<IconButton
|
||||
icon="search"
|
||||
title="Search"
|
||||
shortcut={shortcutLabel("find.inFile")}
|
||||
aria-pressed={searchOpen}
|
||||
onClick={() => setSearchOpen(!searchOpen)}
|
||||
/>
|
||||
<PanelToggle panel={panel} onChange={setPanel} />
|
||||
</Toolbar>
|
||||
</div>
|
||||
<div className={styles.filterBar}>
|
||||
<label className={styles.filterField}>
|
||||
<Icon name="filter" size={14} />
|
||||
<span aria-hidden="true">WHERE</span>
|
||||
<SqlFilterInput
|
||||
kind="where"
|
||||
schema={ref.schema}
|
||||
@@ -371,7 +391,6 @@ export function TableEditor({ input }: { input: EditorInput }) {
|
||||
</label>
|
||||
<label className={styles.filterField}>
|
||||
<Icon name="db-sort" size={14} />
|
||||
<span aria-hidden="true">ORDER BY</span>
|
||||
<SqlFilterInput
|
||||
kind="order"
|
||||
schema={ref.schema}
|
||||
@@ -432,44 +451,6 @@ export function TableEditor({ input }: { input: EditorInput }) {
|
||||
driver={source?.driver}
|
||||
sort={sort}
|
||||
onSort={onSort}
|
||||
pager={
|
||||
<Toolbar className={styles.resultPager} aria-label="Table pages">
|
||||
{!singlePage && (
|
||||
<>
|
||||
<IconButton
|
||||
size="small"
|
||||
icon="chevron-left"
|
||||
title="Previous Page"
|
||||
shortcut={shortcutLabel("db.previousPage")}
|
||||
disabled={!canPrevious}
|
||||
onClick={() => setOffset(Math.max(0, offset - limit))}
|
||||
/>
|
||||
<span className={styles.resultPagerRange}>
|
||||
{loaded ? tx`${first}-${last} of ${total ?? `${last + 1}+`}` : tx`${loaded} rows`}
|
||||
</span>
|
||||
<IconButton
|
||||
size="small"
|
||||
icon="chevron-right"
|
||||
title="Next Page"
|
||||
shortcut={shortcutLabel("db.nextPage")}
|
||||
disabled={!canNext}
|
||||
onClick={() => setOffset(offset + limit)}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<Select
|
||||
variant="ghost"
|
||||
aria-label="Page size"
|
||||
value={String(limit)}
|
||||
options={PAGE_SIZES.map((v) => ({ value: v, label: v }))}
|
||||
renderValue={singlePage ? () => tx`${loaded} rows` : undefined}
|
||||
onChange={(v) => {
|
||||
setOffset(0);
|
||||
setLimit(Number(v));
|
||||
}}
|
||||
/>
|
||||
</Toolbar>
|
||||
}
|
||||
rowMenu={(rows) =>
|
||||
editable
|
||||
? [
|
||||
|
||||
@@ -45,9 +45,9 @@ import type { EditorDocContext } from "@/editor/api";
|
||||
import { iconNode } from "@/ui/iconNode";
|
||||
import { call, commands, type DbDriver, type DbSessionContext, type DbStatementOutcome } from "@/platform/ipc";
|
||||
import { shortcutLabel } from "@/platform/keymap";
|
||||
import { Icon, IconButton, Select, Toolbar, lazyComponent } from "@/ui";
|
||||
import { IconButton, Select, lazyComponent } from "@/ui";
|
||||
import { useProject } from "@/platform/project";
|
||||
import { activeSchema, schemaSwitchable, sourceIcon, sourceLabel, splitTarget, targetOf } from "./model";
|
||||
import { activeSchema, schemaSwitchable, sourceLabel, splitTarget, targetOf } from "./model";
|
||||
import { loadSavedCatalog, offerIntrospection } from "./introspection";
|
||||
import { analyze, templateContexts, valuesSlot } from "./sql/analyze";
|
||||
import {
|
||||
@@ -477,11 +477,10 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {
|
||||
// SQL resolution scopes in the settings can move the console to another data source.
|
||||
useProject((s) => s.settings);
|
||||
const boundId = bound ? splitTarget(bound).id : null;
|
||||
const driver = sources.find((s) => s.id === boundId)?.driver;
|
||||
const jdbc = driver === "jdbc";
|
||||
const supportsTransactions = driver !== "clickhouse" && !jdbc;
|
||||
const sqlServer = driver === "sqlServer";
|
||||
const switchable = schemaSwitchable(driver);
|
||||
const jdbc = sourceById(boundId)?.driver === "jdbc";
|
||||
const supportsTransactions = sourceById(boundId)?.driver !== "clickhouse" && !jdbc;
|
||||
const sqlServer = sourceById(boundId)?.driver === "sqlServer";
|
||||
const switchable = schemaSwitchable(sourceById(boundId)?.driver);
|
||||
// The console's active schema: its pick, else the connection's default (`completion.defaultSchema`).
|
||||
const pickedSchema = useDatabase((s) => s.consoleSchemas[path]);
|
||||
const defaultSchema = useDatabase((s) => (bound ? s.completion[bound]?.defaultSchema : undefined));
|
||||
@@ -504,10 +503,9 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {
|
||||
: schemaList?.status === "ok"
|
||||
? schemaList.value
|
||||
: [];
|
||||
const out = names.map((n) => ({ value: n, label: n, icon: "db-schema" }));
|
||||
const out = names.map((n) => ({ value: n, label: n }));
|
||||
// The connection's default is offered even before its schema list loads.
|
||||
if (defaultSchema && !names.includes(defaultSchema))
|
||||
out.unshift({ value: defaultSchema, label: defaultSchema, icon: "db-schema" });
|
||||
if (defaultSchema && !names.includes(defaultSchema)) out.unshift({ value: defaultSchema, label: defaultSchema });
|
||||
return out;
|
||||
}, [switchable, schemaList, defaultSchema, sqlServer, boundId, databases]);
|
||||
const targets = useMemo(() => {
|
||||
@@ -522,9 +520,9 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {
|
||||
value: targetOf(id, name, dbs.value.current),
|
||||
label: `${s.name ?? ""}: ${name}`,
|
||||
detail: host,
|
||||
icon: sourceIcon(s),
|
||||
icon: "database",
|
||||
});
|
||||
} else out.push({ value: id, label: s.name ?? "", detail: host, icon: sourceIcon(s) });
|
||||
} else out.push({ value: id, label: s.name ?? "", detail: host, icon: "db-schema" });
|
||||
}
|
||||
// A console bound to a database whose list is not loaded yet still shows it.
|
||||
if (bound && !out.some((o) => o.value === bound))
|
||||
@@ -538,7 +536,7 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {
|
||||
if (bound) void loadCompletion(bound);
|
||||
}, [bound]);
|
||||
return (
|
||||
<Toolbar className={styles.consoleBar} aria-label="Query Console">
|
||||
<div className={styles.consoleBar}>
|
||||
<IconButton
|
||||
icon="run"
|
||||
title="Execute"
|
||||
@@ -552,8 +550,6 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {
|
||||
disabled={!bound || running}
|
||||
onClick={() => void executeScriptInView(view, path)}
|
||||
/>
|
||||
<span className={styles.toolbarSeparator} />
|
||||
<IconButton icon="history" title="Browse Query History" disabled={!bound} onClick={() => openHistory(path)} />
|
||||
{!jdbc && (
|
||||
<IconButton
|
||||
icon="db-plan"
|
||||
@@ -562,6 +558,14 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {
|
||||
onClick={() => void explainInView(view, path)}
|
||||
/>
|
||||
)}
|
||||
<IconButton
|
||||
icon="stop"
|
||||
title="Cancel Running Statement"
|
||||
disabled={!running}
|
||||
onClick={() => cancelConsole(path)}
|
||||
/>
|
||||
<span className={styles.toolbarSeparator} />
|
||||
<IconButton icon="history" title="Browse Query History" disabled={!bound} onClick={() => openHistory(path)} />
|
||||
<IconButton
|
||||
icon="db-in-editor-results"
|
||||
title="In-Editor Results"
|
||||
@@ -569,18 +573,28 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {
|
||||
onClick={() => void setInEditorResults(!inEditor)}
|
||||
/>
|
||||
<span className={styles.toolbarSeparator} />
|
||||
<Select
|
||||
variant="ghost"
|
||||
aria-label="Row limit"
|
||||
value={String(maxRows)}
|
||||
options={ROW_LIMITS.map((v) => ({ value: v, label: tx`${Number(v).toLocaleString("en")} rows` }))}
|
||||
onChange={(v) => useDatabase.setState({ maxRows: Number(v) })}
|
||||
/>
|
||||
{supportsTransactions && (
|
||||
<Select
|
||||
variant="ghost"
|
||||
aria-label="Transaction mode"
|
||||
value={manual ? "manual" : "auto"}
|
||||
options={[
|
||||
{ value: "auto", label: "Tx: Auto" },
|
||||
{ value: "manual", label: "Tx: Manual" },
|
||||
]}
|
||||
onChange={(v) => bound && void setManualCommit(bound, v === "manual")}
|
||||
disabled={!bound}
|
||||
/>
|
||||
<>
|
||||
<span className={styles.toolbarSeparator} />
|
||||
<Select
|
||||
variant="ghost"
|
||||
aria-label="Transaction mode"
|
||||
value={manual ? "manual" : "auto"}
|
||||
options={[
|
||||
{ value: "auto", label: "Tx: Auto" },
|
||||
{ value: "manual", label: "Tx: Manual" },
|
||||
]}
|
||||
onChange={(v) => bound && void setManualCommit(bound, v === "manual")}
|
||||
disabled={!bound}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{supportsTransactions && manual && (
|
||||
<>
|
||||
@@ -598,31 +612,8 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<IconButton
|
||||
icon="stop"
|
||||
title="Cancel Running Statement"
|
||||
disabled={!running}
|
||||
onClick={() => cancelConsole(path)}
|
||||
/>
|
||||
<span className={styles.toolbarSeparator} />
|
||||
<Select
|
||||
variant="ghost"
|
||||
aria-label="Row limit"
|
||||
value={String(maxRows)}
|
||||
options={ROW_LIMITS.map((v) => ({ value: v, label: tx`${Number(v).toLocaleString("en")} rows` }))}
|
||||
onChange={(v) => useDatabase.setState({ maxRows: Number(v) })}
|
||||
/>
|
||||
<span className={styles.spacer} />
|
||||
{bound && driver === "snowflake" && <SnowflakeSession target={bound} idle={!running} />}
|
||||
<Select
|
||||
variant="ghost"
|
||||
aria-label="Data source"
|
||||
value={bound ?? null}
|
||||
placeholder={sources.length ? "<data source>" : "None configured"}
|
||||
options={targets}
|
||||
onChange={(id) => bindConsole(path, id)}
|
||||
disabled={!sources.length}
|
||||
/>
|
||||
{bound && sourceById(boundId)?.driver === "snowflake" && <SnowflakeSession target={bound} idle={!running} />}
|
||||
{switchable && (
|
||||
<Select
|
||||
variant="ghost"
|
||||
@@ -635,13 +626,16 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {
|
||||
disabled={!bound}
|
||||
/>
|
||||
)}
|
||||
{driver === "sqlite" && (
|
||||
<span className={styles.consoleSchema} title={tx("Schema")}>
|
||||
<Icon name="db-schema" size={14} />
|
||||
{schema || "main"}
|
||||
</span>
|
||||
)}
|
||||
</Toolbar>
|
||||
<Select
|
||||
variant="ghost"
|
||||
aria-label="Data source"
|
||||
value={bound ?? null}
|
||||
placeholder={sources.length ? "<data source>" : "None configured"}
|
||||
options={targets}
|
||||
onChange={(id) => bindConsole(path, id)}
|
||||
disabled={!sources.length}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
DB_TOOL_WINDOW,
|
||||
RESULTS_VIEW,
|
||||
consoleSource,
|
||||
consoleDecorations,
|
||||
consoleTints,
|
||||
inEditorResults,
|
||||
setInEditorResults,
|
||||
loadSources,
|
||||
@@ -161,9 +161,9 @@ export function activate(): () => void {
|
||||
newMenuOpen: false,
|
||||
});
|
||||
}),
|
||||
// Consoles of coloured data sources get a tinted tab.
|
||||
useDatabase.subscribe((s, prev) => {
|
||||
if (s.consoles !== prev.consoles || s.sources !== prev.sources)
|
||||
setFileDecorations("database", consoleDecorations(s));
|
||||
if (s.consoles !== prev.consoles || s.sources !== prev.sources) setFileDecorations("database", consoleTints(s));
|
||||
}),
|
||||
() => setFileDecorations("database", new Map()),
|
||||
watchIdleConnections(),
|
||||
|
||||
@@ -45,7 +45,6 @@ import {
|
||||
effectiveSsh,
|
||||
idleTargets,
|
||||
newSourceId,
|
||||
sourceIcon,
|
||||
splitTarget,
|
||||
targetOf,
|
||||
} from "./model";
|
||||
@@ -602,21 +601,13 @@ export function watchIdleConnections(everyMs = 5000): () => void {
|
||||
return () => clearInterval(timer);
|
||||
}
|
||||
|
||||
/** Managed consoles show their source in the tab. Ordinary SQL files can also inherit a source tint. */
|
||||
export function consoleDecorations(s: Pick<DatabaseState, "consoles" | "sources">): Map<string, FileDecoration> {
|
||||
/** Console files of coloured data sources, tinted like IDEA's (file decorations). */
|
||||
export function consoleTints(s: Pick<DatabaseState, "consoles" | "sources">): Map<string, FileDecoration> {
|
||||
const out = new Map<string, FileDecoration>();
|
||||
for (const [path, target] of Object.entries(s.consoles)) {
|
||||
const { id, database } = splitTarget(target);
|
||||
const source = s.sources.find((x) => x.id === id);
|
||||
if (!source) continue;
|
||||
const tint = colorVar(source.color);
|
||||
// db_console_path and db_consoles own this directory, including already saved consoles.
|
||||
const consoleName = /(?:^|\/)consoles\/db\/[^/]+\/(console(?:_\d+)?)\.sql$/.exec(path.replaceAll("\\", "/"))?.[1];
|
||||
if (consoleName) {
|
||||
const name = source.name || id;
|
||||
const label = database ? `${name}: ${database}` : name;
|
||||
out.set(path, { tint, tabTitle: `${consoleName} [${label}]`, tabIcon: sourceIcon(source) });
|
||||
} else if (tint) out.set(path, { tint });
|
||||
const id = splitTarget(target).id;
|
||||
const tint = colorVar(s.sources.find((x) => x.id === id)?.color);
|
||||
if (tint) out.set(path, { tint });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -19,28 +19,20 @@
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
min-height: 32px;
|
||||
height: 32px;
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-0-5) var(--space-2);
|
||||
padding: var(--space-0-5) var(--space-2) var(--space-0-5) var(--space-1);
|
||||
border-bottom: 1px solid var(--border);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-0-5);
|
||||
padding: 0 8px 0 4px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tool {
|
||||
width: var(--h-control);
|
||||
height: var(--h-control);
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
@@ -54,21 +46,17 @@
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-0-5);
|
||||
min-width: 0;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.tab {
|
||||
height: 24px;
|
||||
max-inline-size: 100%;
|
||||
padding: 0 8px;
|
||||
border-radius: var(--radius-small);
|
||||
color: var(--fg);
|
||||
font-size: var(--fs-ui);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tab:hover {
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
SplitHandle,
|
||||
SplitPanel,
|
||||
Tabs,
|
||||
Toolbar,
|
||||
showContextMenu,
|
||||
type MenuItem,
|
||||
type TabItem,
|
||||
@@ -219,43 +218,43 @@ export function DebugToolWindow() {
|
||||
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
<div className={styles.toolbar}>
|
||||
<Toolbar className={styles.actions} aria-label="Debugger actions">
|
||||
<ToolButton action="debug.rerun" icon="rerun" />
|
||||
<ToolButton action="debug.stop" icon="stop" tone="danger" />
|
||||
<span className={styles.sep} aria-hidden />
|
||||
<ToolButton action="debug.resume" icon="resume" />
|
||||
<ToolButton action="debug.pause" icon="pause" />
|
||||
<ToolButton action="debug.stepOver" icon="step-over" />
|
||||
<ToolButton action="debug.stepInto" icon="step-into" />
|
||||
<ToolButton action="debug.stepOut" icon="step-out" />
|
||||
<span className={styles.sep} aria-hidden />
|
||||
{rootOf(active).adapter === "dart" && (
|
||||
<>
|
||||
<ToolButton action="debug.hotReload" icon="hot-reload" />
|
||||
<ToolButton action="debug.hotRestart" icon="refresh" />
|
||||
{rootOf(active).vmServiceUri && <ToolButton action="debug.openDevTools" icon="external-link" />}
|
||||
<span className={styles.sep} aria-hidden />
|
||||
</>
|
||||
)}
|
||||
<IconButton
|
||||
icon="view-breakpoints"
|
||||
action="debug.viewBreakpoints"
|
||||
size="small"
|
||||
iconSize={16}
|
||||
className={styles.tool}
|
||||
/>
|
||||
<IconButton
|
||||
icon="mute-breakpoint"
|
||||
title={muted ? "Unmute Breakpoints" : "Mute Breakpoints"}
|
||||
pressed={muted}
|
||||
size="small"
|
||||
iconSize={16}
|
||||
className={styles.tool}
|
||||
onClick={() => setMuted(!muted)}
|
||||
/>
|
||||
<MoreActions />
|
||||
</Toolbar>
|
||||
<div className={styles.toolbar} role="toolbar" aria-label={tx("Debugger actions")}>
|
||||
{/* IDEA's XDebugger.ToolWindow.TopToolbar3 (+ its "More" group), then the views. */}
|
||||
<ToolButton action="debug.rerun" icon="rerun" />
|
||||
<ToolButton action="debug.stop" icon="stop" tone="danger" />
|
||||
<span className={styles.sep} aria-hidden />
|
||||
<ToolButton action="debug.resume" icon="resume" />
|
||||
<ToolButton action="debug.pause" icon="pause" />
|
||||
<ToolButton action="debug.stepOver" icon="step-over" />
|
||||
<ToolButton action="debug.stepInto" icon="step-into" />
|
||||
<ToolButton action="debug.stepOut" icon="step-out" />
|
||||
<span className={styles.sep} aria-hidden />
|
||||
{rootOf(active).adapter === "dart" && (
|
||||
<>
|
||||
<ToolButton action="debug.hotReload" icon="hot-reload" />
|
||||
<ToolButton action="debug.hotRestart" icon="refresh" />
|
||||
{rootOf(active).vmServiceUri && <ToolButton action="debug.openDevTools" icon="external-link" />}
|
||||
<span className={styles.sep} aria-hidden />
|
||||
</>
|
||||
)}
|
||||
<IconButton
|
||||
icon="view-breakpoints"
|
||||
action="debug.viewBreakpoints"
|
||||
size="small"
|
||||
iconSize={16}
|
||||
className={styles.tool}
|
||||
/>
|
||||
<IconButton
|
||||
icon="mute-breakpoint"
|
||||
title={muted ? "Unmute Breakpoints" : "Mute Breakpoints"}
|
||||
pressed={muted}
|
||||
size="small"
|
||||
iconSize={16}
|
||||
className={styles.tool}
|
||||
onClick={() => setMuted(!muted)}
|
||||
/>
|
||||
<MoreActions />
|
||||
<span className={styles.sep} aria-hidden />
|
||||
<div role="tablist" aria-label={tx("Debug views")} className={styles.tabs}>
|
||||
{(
|
||||
[
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { describe, expect, it } 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, endpointEditorExtension, renderEndpoint } from "./endpoints";
|
||||
import { completionTarget, endpointCompletion, renderEndpoint } from "./endpoints";
|
||||
|
||||
const route: EndpointEntry = {
|
||||
method: "GET",
|
||||
@@ -71,33 +70,4 @@ 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<typeof previous.project> });
|
||||
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();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -72,9 +72,6 @@ export async function endpointCompletion(context: CompletionContext): Promise<Co
|
||||
};
|
||||
}
|
||||
|
||||
const REFRESH_DELAY = 300;
|
||||
const isPluginProvider = (id: string) => id.startsWith("plugin:");
|
||||
|
||||
type Mark = { pos: number; endpoints: EndpointEntry[] };
|
||||
const setMarks = StateEffect.define<Mark[]>();
|
||||
const marks = StateField.define<Mark[]>({
|
||||
@@ -115,25 +112,18 @@ export function endpointEditorExtension(ctx: EditorDocContext): Extension {
|
||||
destroyed = false;
|
||||
unsubscribe: () => void;
|
||||
projectUnsubscribe: () => void;
|
||||
timer: ReturnType<typeof setTimeout> | undefined;
|
||||
constructor(readonly view: EditorView) {
|
||||
this.unsubscribe = onEndpointsChanged(() => this.refresh());
|
||||
this.projectUnsubscribe = useProject.subscribe((state, previous) => {
|
||||
if (state.project !== previous.project) this.refresh();
|
||||
});
|
||||
this.projectUnsubscribe = useProject.subscribe(() => this.refresh());
|
||||
this.refresh();
|
||||
}
|
||||
update(u: { docChanged: boolean }) {
|
||||
if (!u.docChanged) return;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => this.refresh(), REFRESH_DELAY);
|
||||
if (u.docChanged) this.refresh();
|
||||
}
|
||||
refresh() {
|
||||
clearTimeout(this.timer);
|
||||
const seq = ++this.seq;
|
||||
const root = useProject.getState().project?.root ?? null;
|
||||
// Only plugin endpoints get icons here; built-in providers (Spring) scan the project.
|
||||
void searchEndpoints(root, isPluginProvider).then((entries) => {
|
||||
void searchEndpoints(root).then((entries) => {
|
||||
if (this.destroyed || seq !== this.seq) return;
|
||||
const byLine = new Map<number, EndpointEntry[]>();
|
||||
for (const e of entries) {
|
||||
@@ -146,7 +136,6 @@ export function endpointEditorExtension(ctx: EditorDocContext): Extension {
|
||||
}
|
||||
destroy() {
|
||||
this.destroyed = true;
|
||||
clearTimeout(this.timer);
|
||||
this.unsubscribe();
|
||||
this.projectUnsubscribe();
|
||||
}
|
||||
|
||||
@@ -101,15 +101,6 @@ 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";
|
||||
|
||||
@@ -39,15 +39,11 @@ function inside(project: ProjectInfo, path: string): boolean {
|
||||
async function read(path: string): Promise<string> {
|
||||
return editorsFor(path)[0]?.view.state.doc.toString() ?? (await call(commands.fsReadText(path)));
|
||||
}
|
||||
/** Forgets resolved targets and service names; the disk route index stays. */
|
||||
function refresh() {
|
||||
function invalidate() {
|
||||
epoch++;
|
||||
serviceNames.clear();
|
||||
invalidateNavigationProviders();
|
||||
}
|
||||
function invalidate() {
|
||||
refresh();
|
||||
clearRouteIndex();
|
||||
invalidateNavigationProviders();
|
||||
}
|
||||
|
||||
function named(module: string): Promise<string | null> {
|
||||
@@ -159,13 +155,9 @@ export function registerFeignNavigation(): () => void {
|
||||
(!isRouteSource(event.path) && !isServiceConfiguration(event.path))
|
||||
)
|
||||
return;
|
||||
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);
|
||||
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);
|
||||
invalidate();
|
||||
});
|
||||
const projects = useProject.subscribe((state, previous) => {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
gap: 5px;
|
||||
border-radius: var(--radius-row);
|
||||
}
|
||||
|
||||
@@ -41,16 +41,9 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.labelGroup {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.labelGroup .label {
|
||||
.rootName {
|
||||
flex: none;
|
||||
max-inline-size: 100%;
|
||||
max-width: 60%;
|
||||
}
|
||||
.rootLabel {
|
||||
color: var(--fg-strong);
|
||||
@@ -67,7 +60,6 @@
|
||||
text-decoration-line: line-through;
|
||||
}
|
||||
.error {
|
||||
padding-block: var(--space-0-5);
|
||||
text-decoration-line: underline;
|
||||
text-decoration-style: wavy;
|
||||
text-decoration-color: var(--danger);
|
||||
@@ -96,7 +88,7 @@
|
||||
}
|
||||
.detail {
|
||||
min-width: 0;
|
||||
margin-inline-start: var(--space-1);
|
||||
margin-left: 4px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -338,29 +338,26 @@ const Row = memo(function Row({
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<span className={styles.labelGroup}>
|
||||
<HighlightedText
|
||||
className={clsx(
|
||||
styles.label,
|
||||
// Project and module roots use semibold labels.
|
||||
node.root && !node.icon && styles.rootLabel,
|
||||
moduleFolder && styles.moduleLabel,
|
||||
faded && !deco.color && styles.excluded,
|
||||
file?.deprecated && styles.deprecated,
|
||||
deco.error && styles.error,
|
||||
)}
|
||||
style={deco.color ? { color: deco.color } : undefined}
|
||||
text={node.label}
|
||||
indices={matches}
|
||||
tone="accent"
|
||||
/>
|
||||
{deco.suffix && <DecorationSuffix segments={deco.suffix} color={deco.suffixColor} />}
|
||||
{detail && (
|
||||
<span className={styles.detail} title={detail}>
|
||||
{detail}
|
||||
</span>
|
||||
<HighlightedText
|
||||
className={clsx(
|
||||
styles.label,
|
||||
node.root && styles.rootName,
|
||||
// Only the project itself is bold (IDEA); contributed roots like Scratches are not.
|
||||
node.root && !node.icon && styles.rootLabel,
|
||||
// Maven / Gradle module folders are bold too, as in IDEA.
|
||||
moduleFolder && styles.moduleLabel,
|
||||
faded && !deco.color && styles.excluded,
|
||||
// IDEA strikes out deprecated classes.
|
||||
file?.deprecated && styles.deprecated,
|
||||
deco.error && styles.error,
|
||||
)}
|
||||
</span>
|
||||
style={deco.color ? { color: deco.color } : undefined}
|
||||
text={node.label}
|
||||
indices={matches}
|
||||
tone="accent"
|
||||
/>
|
||||
{deco.suffix && <DecorationSuffix segments={deco.suffix} color={deco.suffixColor} />}
|
||||
{detail && <span className={styles.detail}>{detail}</span>}
|
||||
{deco.badge && <span className={styles.badge}>{deco.badge}</span>}
|
||||
</>
|
||||
)}
|
||||
@@ -424,14 +421,8 @@ const MemberRow = memo(function MemberRow({
|
||||
onPointerDown={(e) => onPointerDown(node, e)}
|
||||
>
|
||||
<SymbolBadge kind={badgeKind(item.kind)} className={styles.icon} />
|
||||
<span className={styles.labelGroup}>
|
||||
<HighlightedText className={styles.label} text={item.name} indices={matches} tone="accent" />
|
||||
{item.detail && (
|
||||
<span className={styles.detail} title={item.detail}>
|
||||
{item.detail}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<HighlightedText className={styles.label} text={item.name} indices={matches} tone="accent" />
|
||||
{item.detail && <span className={styles.detail}>{item.detail}</span>}
|
||||
</span>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -51,10 +51,6 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.topToolbarSession {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
flex: none;
|
||||
width: 32px;
|
||||
@@ -73,36 +69,12 @@
|
||||
.toolbar::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.toolbarGroup {
|
||||
display: flex;
|
||||
flex: none;
|
||||
flex-direction: inherit;
|
||||
align-items: center;
|
||||
gap: var(--space-0-5);
|
||||
max-width: 100%;
|
||||
}
|
||||
.toolbarGroup + .toolbarGroup::before {
|
||||
content: "";
|
||||
.toolbarSep {
|
||||
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;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
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";
|
||||
@@ -182,15 +181,10 @@ export function SessionPanel({
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={clsx(styles.session, showLifecycle && styles.topToolbarSession)}>
|
||||
<div
|
||||
className={styles.toolbar}
|
||||
role="toolbar"
|
||||
aria-orientation={showLifecycle ? "horizontal" : "vertical"}
|
||||
aria-label={tx("Run actions")}
|
||||
>
|
||||
<div className={styles.session}>
|
||||
<div className={styles.toolbar} role="toolbar" aria-orientation="vertical" aria-label={tx("Run actions")}>
|
||||
{showLifecycle && (
|
||||
<div className={styles.toolbarGroup}>
|
||||
<>
|
||||
<IconButton
|
||||
icon="rerun"
|
||||
title="Rerun"
|
||||
@@ -248,36 +242,34 @@ export function SessionPanel({
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.toolbarSep} />
|
||||
</>
|
||||
)}
|
||||
<div className={styles.toolbarGroup}>
|
||||
{!rt.terminal && (
|
||||
<>
|
||||
<IconButton
|
||||
icon="search"
|
||||
title="Find…"
|
||||
shortcut={formatBinding(hostBinding("Meta+F"))}
|
||||
pressed={findOpen}
|
||||
onClick={() => setFindOpen((v) => !v)}
|
||||
/>
|
||||
<IconButton
|
||||
icon="scroll-to-end"
|
||||
title="Scroll to End"
|
||||
pressed={follow}
|
||||
onClick={() => setFollow((v) => !v)}
|
||||
/>
|
||||
<IconButton icon="soft-wrap" title="Soft-Wrap" pressed={softWrap} onClick={toggleWrap} />
|
||||
</>
|
||||
)}
|
||||
<IconButton icon="trash" title="Clear All" onClick={() => clearConsole(session.id)} />
|
||||
</div>
|
||||
<div className={styles.toolbarGroup}>
|
||||
<IconButton
|
||||
icon="settings"
|
||||
title="Edit Configurations…"
|
||||
onClick={() => void executeAction("run.editConfigs", session.config.id)}
|
||||
/>
|
||||
</div>
|
||||
{!rt.terminal && (
|
||||
<>
|
||||
<IconButton
|
||||
icon="search"
|
||||
title="Find…"
|
||||
shortcut={formatBinding(hostBinding("Meta+F"))}
|
||||
pressed={findOpen}
|
||||
onClick={() => setFindOpen((v) => !v)}
|
||||
/>
|
||||
<IconButton
|
||||
icon="scroll-to-end"
|
||||
title="Scroll to End"
|
||||
pressed={follow}
|
||||
onClick={() => setFollow((v) => !v)}
|
||||
/>
|
||||
<IconButton icon="soft-wrap" title="Soft-Wrap" pressed={softWrap} onClick={toggleWrap} />
|
||||
</>
|
||||
)}
|
||||
<IconButton icon="trash" title="Clear All" onClick={() => clearConsole(session.id)} />
|
||||
<div className={styles.toolbarSep} />
|
||||
<IconButton
|
||||
icon="settings"
|
||||
title="Edit Configurations…"
|
||||
onClick={() => void executeAction("run.editConfigs", session.config.id)}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.sessionBody}>
|
||||
{rt.tests ? (
|
||||
|
||||
@@ -71,7 +71,6 @@ 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";
|
||||
@@ -486,7 +485,6 @@ 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",
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
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",
|
||||
]);
|
||||
});
|
||||
});
|
||||
@@ -1,135 +0,0 @@
|
||||
/**
|
||||
* 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<MenuItem[]> {
|
||||
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]!}'`;
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -312,7 +312,6 @@ class ScriptMarker extends GutterMarker {
|
||||
readonly entry: ScriptEntry,
|
||||
readonly path: string,
|
||||
readonly menu: EntryMenu,
|
||||
readonly title: (entry: ScriptEntry) => string,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -323,7 +322,7 @@ class ScriptMarker extends GutterMarker {
|
||||
const el = document.createElement("button");
|
||||
el.type = "button";
|
||||
el.className = styles.runMarker ?? "";
|
||||
el.title = this.title(this.entry);
|
||||
el.title = tx`Run '${this.entry.name}'`;
|
||||
el.setAttribute("aria-label", el.title);
|
||||
el.innerHTML = gutterIconMarkup("gutter-run") ?? "";
|
||||
el.addEventListener("click", () => {
|
||||
@@ -351,7 +350,6 @@ 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 [];
|
||||
@@ -396,7 +394,7 @@ export function entryGutter(
|
||||
markers: (view) =>
|
||||
runIconsShown()
|
||||
? RangeSet.of(
|
||||
view.state.field(entriesField).map((e) => new ScriptMarker(e, path, menu, title).range(e.pos)),
|
||||
view.state.field(entriesField).map((e) => new ScriptMarker(e, path, menu).range(e.pos)),
|
||||
true,
|
||||
)
|
||||
: RangeSet.empty,
|
||||
|
||||
@@ -30,7 +30,6 @@ 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;
|
||||
|
||||
@@ -106,22 +106,18 @@
|
||||
--border-tab-selected: transparent;
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-1) var(--space-3);
|
||||
gap: var(--space-3);
|
||||
padding: 8px 14px 4px 20px;
|
||||
}
|
||||
.scopeDetail {
|
||||
flex: 1 1 200px;
|
||||
flex: 1;
|
||||
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;
|
||||
|
||||
@@ -67,7 +67,6 @@ 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,
|
||||
@@ -83,7 +82,9 @@ import {
|
||||
resolveFindScope,
|
||||
setFindPopupCommandHandler,
|
||||
loadFindPopupSize,
|
||||
loadFindPopupSplit,
|
||||
saveFindPopupSize,
|
||||
saveFindPopupSplit,
|
||||
setFindPopupNewTab,
|
||||
setFindPopupPinned,
|
||||
useFindPopup,
|
||||
@@ -164,6 +165,11 @@ 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<string, number>) => {
|
||||
setSplit(layout);
|
||||
saveFindPopupSplit(layout);
|
||||
};
|
||||
const [marks, setMarks] = useState<ReplaceMarks>(NO_MARKS);
|
||||
const [running, setRunning] = useState<ReplaceRun | null>(null);
|
||||
const [progress, setProgress] = useState<ReplaceProgress | null>(null);
|
||||
@@ -863,8 +869,8 @@ function FindInFilesDialog() {
|
||||
</div>
|
||||
<div className={styles.split}>
|
||||
{rows.length ? (
|
||||
<SplitGroup orientation="vertical" id="find-popup-split" storageKey={FIND_POPUP_SPLIT_KEY}>
|
||||
<SplitPanel id="results" minSize={ROW * 3} defaultSize="33%">
|
||||
<SplitGroup orientation="vertical" id="find-popup-split" defaultLayout={split} onLayoutChanged={keepSplit}>
|
||||
<SplitPanel id="results" minSize={ROW * 3} defaultSize="48%">
|
||||
{resultsBox}
|
||||
</SplitPanel>
|
||||
<SplitHandle hairline={false} />
|
||||
|
||||
@@ -98,8 +98,9 @@ export function setFindPopupNewTab(newTab: boolean) {
|
||||
}
|
||||
|
||||
const SIZE_KEY = "openidea.search.findPopupSize.v1";
|
||||
export const FIND_POPUP_SPLIT_KEY = "openidea.search.findPopupSplit.v1";
|
||||
const 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;
|
||||
@@ -109,6 +110,17 @@ export function saveFindPopupSize(size: { w: number; h: number }) {
|
||||
saveJson(SIZE_KEY, size);
|
||||
}
|
||||
|
||||
export function loadFindPopupSplit(): Record<string, number> | undefined {
|
||||
const v = loadJson<unknown>(SPLIT_KEY, null);
|
||||
return v && typeof v === "object" && Object.values(v).every((n) => typeof n === "number")
|
||||
? (v as Record<string, number>)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
export function saveFindPopupSplit(layout: Record<string, number>) {
|
||||
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
|
||||
|
||||
@@ -101,12 +101,14 @@
|
||||
border: 0;
|
||||
outline: none;
|
||||
color: var(--fg-strong);
|
||||
font-family: var(--font-ui);
|
||||
font-size: var(--fs-ui);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-code);
|
||||
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);
|
||||
@@ -123,12 +125,10 @@
|
||||
}
|
||||
.popupOptions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
gap: var(--space-1) var(--space-3);
|
||||
min-height: 32px;
|
||||
padding: var(--space-1) var(--space-3);
|
||||
gap: var(--space-3);
|
||||
height: 26px;
|
||||
padding: 0 12px;
|
||||
border-bottom: 1px solid var(--border-popup);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ function FileStructureDialog() {
|
||||
<Dialog
|
||||
open
|
||||
onClose={close}
|
||||
width={540}
|
||||
width={460}
|
||||
position="top"
|
||||
transparentBackdrop
|
||||
aria-label="File Structure"
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
type TreeReorder,
|
||||
} from "@/ui";
|
||||
import {
|
||||
SERVICES_WINDOW,
|
||||
useServiceProviders,
|
||||
useToolWindowShown,
|
||||
serviceProviders,
|
||||
@@ -31,7 +30,6 @@ import {
|
||||
type ServiceTreeItem,
|
||||
type ServiceItemAction,
|
||||
} from "@/workbench/contributions";
|
||||
import { useToolWindowLayout } from "@/workbench/toolwindows/store";
|
||||
import {
|
||||
addServiceMenu,
|
||||
clearProviderRoots,
|
||||
@@ -90,9 +88,6 @@ export function ServicesTreeView() {
|
||||
const selectedKey = useServicesTree((s) => s.selectedKey);
|
||||
const selectedKeys = useServicesTree((s) => s.selectedKeys);
|
||||
const expanded = useServicesTree((s) => s.expanded);
|
||||
const anchor = useToolWindowLayout((s) => s.placements[SERVICES_WINDOW]?.anchor ?? "bottom");
|
||||
const sideDocked = anchor !== "bottom";
|
||||
const orientation = sideDocked ? "vertical" : "horizontal";
|
||||
const addRef = useRef<HTMLButtonElement>(null);
|
||||
const filterRef = useRef<HTMLButtonElement>(null);
|
||||
|
||||
@@ -224,13 +219,8 @@ export function ServicesTreeView() {
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<SplitGroup
|
||||
key={orientation}
|
||||
orientation={orientation}
|
||||
className={styles.split}
|
||||
storageKey={sideDocked ? "openidea.services.detailSplit.vertical" : "openidea.services.detailSplit"}
|
||||
>
|
||||
<SplitPanel id="services-items" defaultSize="30%" minSize={sideDocked ? "80px" : "160px"}>
|
||||
<SplitGroup orientation="horizontal" className={styles.split} storageKey="openidea.services.detailSplit">
|
||||
<SplitPanel id="services-items" defaultSize="40%" minSize="160px">
|
||||
<div className={styles.tree}>
|
||||
<Tree<ServiceTreeItem>
|
||||
key={location}
|
||||
@@ -284,7 +274,7 @@ export function ServicesTreeView() {
|
||||
<SplitHandle />
|
||||
<SplitPanel
|
||||
id="services-detail"
|
||||
minSize={sideDocked ? "120px" : "200px"}
|
||||
minSize="200px"
|
||||
// The panel library puts `overflow: auto` inline; the detail content
|
||||
// (a console, a log) owns its scrolling, so the pane must not add a second
|
||||
// bar. A column flex box lets that content fill the pane.
|
||||
|
||||
@@ -212,18 +212,9 @@ describe("languages settings", () => {
|
||||
});
|
||||
|
||||
it("leaves the Markdown preview font size unset (editor font) and keeps a set one in 8..72", () => {
|
||||
expect(validateLanguages({}).markdown.previewFontSize).toBeNull();
|
||||
expect(validateLanguages({ markdown: { previewFontSize: 90 } }).markdown.previewFontSize).toBe(72);
|
||||
expect(validateLanguages({ markdown: { previewFontSize: "x" } }).markdown.previewFontSize).toBeNull();
|
||||
});
|
||||
|
||||
it("detects Markdown commands by default and asks for their folder until one is chosen", () => {
|
||||
expect(validateLanguages({}).markdown).toMatchObject({ runCommands: true, commandDirectory: null });
|
||||
expect(validateLanguages({ markdown: { runCommands: false, commandDirectory: "file" } }).markdown).toMatchObject({
|
||||
runCommands: false,
|
||||
commandDirectory: "file",
|
||||
});
|
||||
expect(validateLanguages({ markdown: { commandDirectory: "elsewhere" } }).markdown.commandDirectory).toBeNull();
|
||||
expect(validateLanguages({}).markdown).toEqual({ previewFontSize: null });
|
||||
expect(validateLanguages({ markdown: { previewFontSize: 90 } }).markdown).toEqual({ previewFontSize: 72 });
|
||||
expect(validateLanguages({ markdown: { previewFontSize: "x" } }).markdown).toEqual({ previewFontSize: null });
|
||||
});
|
||||
|
||||
it("keeps the Markdown page global, like IDEA's application-level setting", () => {
|
||||
|
||||
@@ -321,7 +321,7 @@ export function SettingsLayout() {
|
||||
|
||||
return (
|
||||
<SplitGroup id="settings" orientation="horizontal" storageKey="openidea.settings.layout" className={styles.layout}>
|
||||
<SplitPanel id="navigation" defaultSize="22.5%" minSize="160px" maxSize="40%" className={styles.sidebar}>
|
||||
<SplitPanel id="navigation" defaultSize="240px" minSize="160px" maxSize="40%" className={styles.sidebar}>
|
||||
<SearchField
|
||||
data-autofocus
|
||||
className={styles.search}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useId } from "react";
|
||||
import { NumberInput, Row, Section, Select, SettingToggle } from "../components/Form";
|
||||
import { NumberInput, Row, Section } 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,48 +7,24 @@ export function MarkdownPage() {
|
||||
const id = useId();
|
||||
const [size, setSize] = useSetting<number | null>("languages.markdown.previewFontSize");
|
||||
const [editorSize] = useSetting<number>("editor.fontSize");
|
||||
const [runCommands] = useSetting<boolean>("languages.markdown.runCommands");
|
||||
const [directory, setDirectory] = useSetting<"project" | "file" | null>("languages.markdown.commandDirectory");
|
||||
return (
|
||||
<>
|
||||
<Section title="Preview">
|
||||
<Row
|
||||
label="Preview font size"
|
||||
htmlFor={id}
|
||||
hint="Also used by Markdown cells in Jupyter notebooks. Defaults to the editor font size, independent of the UI font size."
|
||||
>
|
||||
<NumberInput
|
||||
id={id}
|
||||
value={size ?? editorSize}
|
||||
onChange={setSize}
|
||||
min={8}
|
||||
max={72}
|
||||
integer
|
||||
unit="px"
|
||||
aria-label="Preview font size"
|
||||
/>
|
||||
</Row>
|
||||
</Section>
|
||||
<Section title="Commands">
|
||||
<SettingToggle
|
||||
k="languages.markdown.runCommands"
|
||||
label="Detect commands that can be run right from Markdown files"
|
||||
<Section title="Preview">
|
||||
<Row
|
||||
label="Preview font size"
|
||||
htmlFor={id}
|
||||
hint="Also used by Markdown cells in Jupyter notebooks. Defaults to the editor font size, independent of the UI font size."
|
||||
>
|
||||
<NumberInput
|
||||
id={id}
|
||||
value={size ?? editorSize}
|
||||
onChange={setSize}
|
||||
min={8}
|
||||
max={72}
|
||||
integer
|
||||
unit="px"
|
||||
aria-label="Preview font size"
|
||||
/>
|
||||
<Row label="Run commands from" disabled={!runCommands}>
|
||||
<Select<"project" | "file">
|
||||
value={directory ?? ("" as "project")}
|
||||
options={DIRECTORY_OPTIONS}
|
||||
onChange={setDirectory}
|
||||
disabled={!runCommands}
|
||||
aria-label="Run commands from"
|
||||
/>
|
||||
</Row>
|
||||
</Section>
|
||||
</>
|
||||
</Row>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
const DIRECTORY_OPTIONS = [
|
||||
{ value: "project", label: "Project directory" },
|
||||
{ value: "file", label: "Markdown file parent directory" },
|
||||
] as const;
|
||||
@@ -169,7 +169,7 @@ export const LANGUAGE_PAGES: PageSpec[] = [
|
||||
title: "Markdown",
|
||||
group: LANGUAGES_GROUP,
|
||||
order: 400,
|
||||
keywords: ["markdown", "preview", "font size", "jupyter", "notebook", "run commands", "code block"],
|
||||
keywords: ["markdown", "preview", "font size", "jupyter", "notebook"],
|
||||
component: MarkdownPage,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -199,25 +199,6 @@ 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",
|
||||
|
||||
@@ -6,7 +6,6 @@ export {
|
||||
closeAll,
|
||||
detachTab,
|
||||
newTab,
|
||||
newTabRunning,
|
||||
pluginSession,
|
||||
syncTerminalProject,
|
||||
tabTitle,
|
||||
|
||||
@@ -247,14 +247,6 @@ 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");
|
||||
}
|
||||
|
||||
@@ -26,20 +26,6 @@
|
||||
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;
|
||||
@@ -120,12 +106,13 @@
|
||||
}
|
||||
.commitBar {
|
||||
flex: none;
|
||||
min-height: 32px;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-0-5) var(--space-1);
|
||||
padding: var(--space-0-5) 6px var(--space-0-5) 12px;
|
||||
gap: var(--space-1);
|
||||
padding: 0 6px 0 12px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
.grow {
|
||||
flex: 1;
|
||||
@@ -134,7 +121,6 @@
|
||||
color: var(--fg-faint);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-tiny);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.lineLenWarn {
|
||||
color: var(--warning);
|
||||
@@ -150,6 +136,8 @@
|
||||
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;
|
||||
@@ -176,6 +164,7 @@
|
||||
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;
|
||||
@@ -186,14 +175,10 @@
|
||||
.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 {
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.stashList {
|
||||
flex: 1;
|
||||
|
||||
@@ -18,9 +18,7 @@ import {
|
||||
import { tx, txTemplate } from "@/platform/i18n";
|
||||
import clsx from "clsx";
|
||||
import { executeAction } from "@/platform/actions";
|
||||
import { fontWeightOf } from "@/platform/editorSettings";
|
||||
import { resolveMonoFont } from "@/platform/fonts";
|
||||
import { basename, dirname, useProject } from "@/platform/project";
|
||||
import { basename, dirname } from "@/platform/project";
|
||||
import { isTestFile, useEffectiveRoots } from "@/platform/projectRoots";
|
||||
import {
|
||||
Button,
|
||||
@@ -765,79 +763,68 @@ export function ChangesTree({ mode }: { mode: "commit" | "local" | "dialog" }) {
|
||||
|
||||
return (
|
||||
<div className={styles.changes}>
|
||||
<div className={clsx(styles.toolbar, styles.changesToolbar)} role="toolbar" aria-label={tx("Changes")}>
|
||||
<div className={styles.changesTools}>
|
||||
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void refreshNow()} />
|
||||
{mode === "local" && <IconButton icon="commit" action="vcs.commit" size="small" />}
|
||||
<IconButton icon="undo" action="vcs.rollback" size="small" />
|
||||
{mode === "local" && <IconButton icon="changelist" action="vcs.changelist.new" size="small" />}
|
||||
{mode !== "dialog" && <IconButton icon="git-pull" action="vcs.update" size="small" />}
|
||||
<div className={styles.toolbar} role="toolbar" aria-label={tx("Changes")}>
|
||||
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void refreshNow()} />
|
||||
{mode === "local" && <IconButton icon="commit" action="vcs.commit" size="small" />}
|
||||
<IconButton icon="undo" action="vcs.rollback" size="small" />
|
||||
{mode === "local" && <IconButton icon="changelist" action="vcs.changelist.new" size="small" />}
|
||||
{mode !== "dialog" && <IconButton icon="git-pull" action="vcs.update" size="small" />}
|
||||
<IconButton
|
||||
ref={viewRef}
|
||||
icon="eye"
|
||||
title="View Options"
|
||||
size="small"
|
||||
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)),
|
||||
])
|
||||
}
|
||||
/>
|
||||
{/* WebStorm's Preview Diff: an embedded diff of the selection beside the changes (#1599). */}
|
||||
{mode === "commit" && (
|
||||
<IconButton
|
||||
ref={viewRef}
|
||||
icon="eye"
|
||||
title="View Options"
|
||||
icon="editor-preview"
|
||||
title="Preview Diff"
|
||||
size="small"
|
||||
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)),
|
||||
])
|
||||
}
|
||||
pressed={commitDiffPreview}
|
||||
onClick={() => setCommitDiffPreview(!commitDiffPreview)}
|
||||
/>
|
||||
{/* WebStorm's Preview Diff: an embedded diff of the selection beside the changes (#1599). */}
|
||||
{mode === "commit" && (
|
||||
<IconButton
|
||||
icon="editor-preview"
|
||||
title="Preview Diff"
|
||||
size="small"
|
||||
pressed={commitDiffPreview}
|
||||
onClick={() => setCommitDiffPreview(!commitDiffPreview)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.changesTools}>
|
||||
{mode !== "dialog" && (
|
||||
<IconButton icon="locate" title="Select Opened File" size="small" onClick={selectOpened} />
|
||||
)}
|
||||
<IconButton icon="expand-all" title="Expand All" size="small" onClick={() => setCollapsed(new Set())} />
|
||||
<IconButton
|
||||
icon="collapse-all"
|
||||
title="Collapse All"
|
||||
size="small"
|
||||
onClick={() =>
|
||||
setCollapsed(new Set([...byKey.values()].filter((n) => n.type !== "file").map((n) => n.key)))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<span className={styles.sep} />
|
||||
{mode !== "dialog" && (
|
||||
<IconButton icon="locate" title="Select Opened File" size="small" onClick={selectOpened} />
|
||||
)}
|
||||
<IconButton icon="expand-all" title="Expand All" size="small" onClick={() => setCollapsed(new Set())} />
|
||||
<IconButton
|
||||
icon="collapse-all"
|
||||
title="Collapse All"
|
||||
size="small"
|
||||
onClick={() => setCollapsed(new Set([...byKey.values()].filter((n) => n.type !== "file").map((n) => n.key)))}
|
||||
/>
|
||||
</div>
|
||||
{mode !== "dialog" && <OperationBanner />}
|
||||
<div
|
||||
@@ -1146,8 +1133,6 @@ export function CommitMessageField({
|
||||
}
|
||||
|
||||
const cfg = useWorkflowSettings((s) => 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"));
|
||||
@@ -1197,13 +1182,7 @@ 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`,
|
||||
fontFamily: family,
|
||||
fontSize: size,
|
||||
fontWeight: fontWeightOf(editor?.fontWeight, 400),
|
||||
lineHeight: editor?.lineHeight ? `${editor.lineHeight}px` : undefined,
|
||||
}}
|
||||
style={{ ["--guide" as string]: `${margin}ch` }}
|
||||
value={message}
|
||||
placeholder={tx("Commit Message")}
|
||||
aria-label={tx("Commit message")}
|
||||
|
||||
@@ -47,22 +47,9 @@
|
||||
}
|
||||
}
|
||||
@container diff-editor (max-width: 380px) {
|
||||
.toolbar {
|
||||
height: auto;
|
||||
min-height: var(--h-header);
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
padding-block: var(--space-0-5);
|
||||
}
|
||||
.toolbar > .sep,
|
||||
.toolbar > .inlineOption {
|
||||
.toolbar > .sep {
|
||||
display: none;
|
||||
}
|
||||
.toolbar > .count {
|
||||
flex: 1 1 auto;
|
||||
order: 1;
|
||||
text-align: end;
|
||||
}
|
||||
}
|
||||
.labels {
|
||||
flex: none;
|
||||
|
||||
@@ -1447,7 +1447,6 @@ export function DiffEditor({
|
||||
{canSwap && <IconButton icon="swap-panels" title="Swap Sides" size="small" onClick={() => void swapSides()} />}
|
||||
<IconButton
|
||||
icon="diff-side-by-side"
|
||||
className={styles.inlineOption}
|
||||
title="Side-by-side Viewer"
|
||||
size="small"
|
||||
pressed={viewMode === "split"}
|
||||
@@ -1456,7 +1455,6 @@ export function DiffEditor({
|
||||
/>
|
||||
<IconButton
|
||||
icon="diff-unified"
|
||||
className={styles.inlineOption}
|
||||
title="Unified Viewer"
|
||||
size="small"
|
||||
pressed={viewMode === "unified"}
|
||||
@@ -1480,7 +1478,6 @@ export function DiffEditor({
|
||||
/>
|
||||
<IconButton
|
||||
icon="collapse-all"
|
||||
className={styles.inlineOption}
|
||||
title="Collapse Unchanged Fragments"
|
||||
size="small"
|
||||
pressed={opts.collapse}
|
||||
@@ -1489,7 +1486,6 @@ export function DiffEditor({
|
||||
{viewMode === "split" && (
|
||||
<IconButton
|
||||
icon="lock"
|
||||
className={styles.inlineOption}
|
||||
title="Synchronize Scrolling"
|
||||
size="small"
|
||||
pressed={opts.syncScroll}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
min-height: 0;
|
||||
}
|
||||
.log {
|
||||
container: git-log / inline-size;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
@@ -76,32 +75,14 @@
|
||||
|
||||
/* filters */
|
||||
.filters {
|
||||
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;
|
||||
}
|
||||
.filterControls,
|
||||
.filterActions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
.filterControls {
|
||||
flex: 1 1 260px;
|
||||
padding: 0 8px 0 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
.filterActions {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.textFilter {
|
||||
flex: 0 1 260px;
|
||||
min-width: min(100px, 60%);
|
||||
min-width: 100px;
|
||||
}
|
||||
.filterGroup {
|
||||
position: relative;
|
||||
@@ -115,20 +96,6 @@
|
||||
.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;
|
||||
|
||||
@@ -293,57 +293,55 @@ export function FilterBar() {
|
||||
|
||||
return (
|
||||
<div className={styles.filters} role="toolbar" aria-label={tx("Log filters")}>
|
||||
<div className={styles.filterControls}>
|
||||
{!showBranches && (
|
||||
<IconButton icon="chevron-right" title="Show Branches" size="small" action="vcs.log.showBranches" />
|
||||
)}
|
||||
<SearchField
|
||||
className={styles.textFilter}
|
||||
value={text}
|
||||
onChange={setText}
|
||||
placeholder="Text or hash"
|
||||
aria-label="Filter by message"
|
||||
toggles={[
|
||||
{
|
||||
id: "regex",
|
||||
icon: "regex",
|
||||
title: "Regex",
|
||||
pressed: filters.regex,
|
||||
onToggle: (regex) => setLogFilters({ regex }),
|
||||
},
|
||||
{
|
||||
id: "case",
|
||||
icon: "case",
|
||||
title: "Match Case",
|
||||
pressed: filters.matchCase,
|
||||
onToggle: (matchCase) => setLogFilters({ matchCase }),
|
||||
},
|
||||
]}
|
||||
{!showBranches && (
|
||||
<IconButton icon="chevron-right" title="Show Branches" size="small" action="vcs.log.showBranches" />
|
||||
)}
|
||||
<SearchField
|
||||
className={styles.textFilter}
|
||||
value={text}
|
||||
onChange={setText}
|
||||
placeholder="Text or hash"
|
||||
aria-label="Filter by message"
|
||||
toggles={[
|
||||
{
|
||||
id: "regex",
|
||||
icon: "regex",
|
||||
title: "Regex",
|
||||
pressed: filters.regex,
|
||||
onToggle: (regex) => setLogFilters({ regex }),
|
||||
},
|
||||
{
|
||||
id: "case",
|
||||
icon: "case",
|
||||
title: "Match Case",
|
||||
pressed: filters.matchCase,
|
||||
onToggle: (matchCase) => setLogFilters({ matchCase }),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<span ref={groupRef} className={styles.filterGroup}>
|
||||
{logFilters.map((f, i) => (
|
||||
<FilterButton key={f.label} {...f} hidden={i >= hiddenFrom} />
|
||||
))}
|
||||
</span>
|
||||
{hiddenFrom < logFilters.length && (
|
||||
<IconButton
|
||||
icon="chevron-right"
|
||||
title="More Filters"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => {
|
||||
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),
|
||||
})),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<span ref={groupRef} className={styles.filterGroup}>
|
||||
{logFilters.map((f, i) => (
|
||||
<FilterButton key={f.label} {...f} hidden={i >= hiddenFrom} />
|
||||
))}
|
||||
</span>
|
||||
{hiddenFrom < logFilters.length && (
|
||||
<IconButton
|
||||
icon="chevron-right"
|
||||
title="More Filters"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => {
|
||||
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),
|
||||
})),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{dropdown}
|
||||
{branchAnchor && (
|
||||
<BranchFilterPopup
|
||||
@@ -358,89 +356,88 @@ export function FilterBar() {
|
||||
onSelectMany={() => void selectBranches()}
|
||||
/>
|
||||
)}
|
||||
<div className={styles.filterActions}>
|
||||
<IconButton
|
||||
icon="bookmark"
|
||||
title="Bookmarked Commits"
|
||||
size="small"
|
||||
disabled={!Object.keys(bookmarks).length}
|
||||
onClick={(e) =>
|
||||
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);
|
||||
},
|
||||
})),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<IconButton
|
||||
icon="plus"
|
||||
title="Open Another Log Tab"
|
||||
size="small"
|
||||
onClick={(e) =>
|
||||
menuBelow(e, [
|
||||
{
|
||||
label: "In Tool Window",
|
||||
run: () => {
|
||||
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`);
|
||||
},
|
||||
<span className={styles.grow} />
|
||||
<IconButton
|
||||
icon="bookmark"
|
||||
title="Bookmarked Commits"
|
||||
size="small"
|
||||
disabled={!Object.keys(bookmarks).length}
|
||||
onClick={(e) =>
|
||||
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);
|
||||
},
|
||||
{
|
||||
label: "In Editor",
|
||||
run: () => {
|
||||
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`, "editor");
|
||||
},
|
||||
})),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<IconButton
|
||||
icon="plus"
|
||||
title="Open Another Log Tab"
|
||||
size="small"
|
||||
onClick={(e) =>
|
||||
menuBelow(e, [
|
||||
{
|
||||
label: "In Tool Window",
|
||||
run: () => {
|
||||
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`);
|
||||
},
|
||||
{ label: "External Repository…", run: openExternalLog },
|
||||
])
|
||||
}
|
||||
/>
|
||||
<IconButton
|
||||
icon="clock"
|
||||
title="Recent Filters"
|
||||
size="small"
|
||||
onClick={(e) =>
|
||||
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),
|
||||
})),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void reloadLog({ preserve: true })} />
|
||||
<IconButton
|
||||
icon="sort"
|
||||
title="Graph Options"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => menuBelow(e, graphOptionsMenu(useLogOptions.getState()))}
|
||||
/>
|
||||
<IconButton
|
||||
icon="eye"
|
||||
title="View Options"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => menuBelow(e, viewOptionsMenu(useLogOptions.getState()))}
|
||||
/>
|
||||
<IconButton icon="search" title="Go to Hash/Branch/Tag" size="small" action="vcs.log.goToRef" />
|
||||
</div>
|
||||
},
|
||||
{
|
||||
label: "In Editor",
|
||||
run: () => {
|
||||
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`, "editor");
|
||||
},
|
||||
},
|
||||
{ label: "External Repository…", run: openExternalLog },
|
||||
])
|
||||
}
|
||||
/>
|
||||
<IconButton
|
||||
icon="clock"
|
||||
title="Recent Filters"
|
||||
size="small"
|
||||
onClick={(e) =>
|
||||
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),
|
||||
})),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void reloadLog({ preserve: true })} />
|
||||
<IconButton
|
||||
icon="sort"
|
||||
title="Graph Options"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => menuBelow(e, graphOptionsMenu(useLogOptions.getState()))}
|
||||
/>
|
||||
<IconButton
|
||||
icon="eye"
|
||||
title="View Options"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => menuBelow(e, viewOptionsMenu(useLogOptions.getState()))}
|
||||
/>
|
||||
<IconButton icon="search" title="Go to Hash/Branch/Tag" size="small" action="vcs.log.goToRef" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ export interface ConsoleFont {
|
||||
}
|
||||
|
||||
/**
|
||||
* The font of the Build, Run and Debug consoles: Tools › Terminal › Font (which can follow
|
||||
* Editor › Font), with the row height the consoles lay their lines out with. The
|
||||
* The font of the Run and Debug consoles: Tools › Terminal › Font (which can follow
|
||||
* Editor › Font), with the row height both consoles lay their lines out with. The
|
||||
* weights match the terminal's: the editor's main and bold weights when the terminal
|
||||
* uses the editor font, else regular and bold.
|
||||
*/
|
||||
|
||||
@@ -238,14 +238,8 @@ export interface LanguagesValid {
|
||||
updateSnapshots: boolean;
|
||||
};
|
||||
};
|
||||
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;
|
||||
};
|
||||
/** Preview font size in px; `null` follows the editor font size. */
|
||||
markdown: { previewFontSize: number | null };
|
||||
}
|
||||
|
||||
export interface ProjectStructureValid {
|
||||
@@ -335,7 +329,7 @@ export const DEFAULT_LANGUAGES: LanguagesValid = {
|
||||
updateSnapshots: false,
|
||||
},
|
||||
},
|
||||
markdown: { previewFontSize: null, runCommands: true, commandDirectory: null },
|
||||
markdown: { previewFontSize: null },
|
||||
};
|
||||
|
||||
export const DEFAULT_PROJECT_STRUCTURE: ProjectStructureValid = {
|
||||
@@ -516,14 +510,7 @@ export function validateLanguages(raw: unknown): LanguagesValid {
|
||||
updateSnapshots: bool(maven.updateSnapshots, d.java.maven.updateSnapshots),
|
||||
},
|
||||
},
|
||||
markdown: {
|
||||
previewFontSize: previewSize(markdown.previewFontSize),
|
||||
runCommands: bool(markdown.runCommands, d.markdown.runCommands),
|
||||
commandDirectory:
|
||||
markdown.commandDirectory === "project" || markdown.commandDirectory === "file"
|
||||
? markdown.commandDirectory
|
||||
: null,
|
||||
},
|
||||
markdown: { previewFontSize: previewSize(markdown.previewFontSize) },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -541,14 +528,6 @@ export function markdownPreviewFontSize(settings: unknown): number {
|
||||
);
|
||||
}
|
||||
|
||||
/** Languages & Frameworks › Markdown › Commands of `settings`. */
|
||||
export function markdownCommandSettings(
|
||||
settings: unknown,
|
||||
): Pick<LanguagesValid["markdown"], "runCommands" | "commandDirectory"> {
|
||||
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));
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{
|
||||
"Table actions": "Table actions",
|
||||
"Table pages": "Table pages",
|
||||
"Problems actions": "Problems actions",
|
||||
"TODO actions": "TODO actions",
|
||||
"Same as the existing configuration '{existing}'": "Same as the existing configuration '{existing}'",
|
||||
@@ -2666,13 +2664,5 @@
|
||||
"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",
|
||||
"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"
|
||||
"Project Color": "Project Color"
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
{
|
||||
"Table actions": "表数据操作",
|
||||
"Table pages": "表数据分页",
|
||||
"Problems actions": "问题操作",
|
||||
"Windows file and folder names cannot end with a period or space": "Windows 文件和文件夹名称不能以句点或空格结尾",
|
||||
"Use URL template": "使用 URL 模板",
|
||||
@@ -9041,13 +9039,5 @@
|
||||
"The agent's default": "智能体的默认值",
|
||||
"Commit messages are short: a fast model with low effort is usually enough.": "提交信息很短,通常用快速模型配低推理强度就够了。",
|
||||
"Change 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 文件的父目录"
|
||||
"Project Color": "项目颜色"
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
}
|
||||
/* Islands tabs: the selected tab is a rounded pill (tab-selected-bg / -border); no underline, no separators. */
|
||||
.editor {
|
||||
--tab-inline-padding: var(--space-2);
|
||||
height: var(--h-header);
|
||||
padding: 0 4px;
|
||||
}
|
||||
@@ -77,7 +76,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1-5);
|
||||
padding: 0 var(--tab-inline-padding, 10px);
|
||||
padding: 0 10px;
|
||||
border-radius: inherit;
|
||||
white-space: nowrap;
|
||||
color: inherit;
|
||||
@@ -208,12 +207,6 @@
|
||||
.wrap .tab {
|
||||
height: calc(var(--h-header) - 6px);
|
||||
}
|
||||
.editor.wrap .tab {
|
||||
max-inline-size: 100%;
|
||||
}
|
||||
.editor.wrap .tabButton {
|
||||
min-inline-size: 0;
|
||||
}
|
||||
|
||||
/* Vertical strip (editor tabs placed left / right): a scrolling column of full-width tabs. */
|
||||
.vertical {
|
||||
@@ -273,7 +266,7 @@
|
||||
margin: 0 0 0 4px;
|
||||
}
|
||||
.closeLeft .closable .tabButton {
|
||||
padding: 0 var(--tab-inline-padding, 10px) 0 2px;
|
||||
padding: 0 10px 0 2px;
|
||||
}
|
||||
|
||||
/* drag & drop: the dragged tab is an empty slot the other tabs make room for (IDEA) */
|
||||
|
||||
@@ -1063,9 +1063,6 @@ export interface FileDecoration {
|
||||
suffixColor?: string;
|
||||
/** CSS colour tinting the editor tab (a data source's colour on its console). */
|
||||
tint?: string;
|
||||
/** Display name and icon for a specialized file tab. The path still identifies the document. */
|
||||
tabTitle?: string;
|
||||
tabIcon?: string;
|
||||
/** Short badge text, e.g. a problem count. */
|
||||
badge?: string;
|
||||
tooltip?: string;
|
||||
@@ -1820,11 +1817,6 @@ 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<boolean>;
|
||||
/**
|
||||
* 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<string, RunAnythingProvider>();
|
||||
@@ -1891,15 +1883,9 @@ export function registerEndpointProvider(p: EndpointProvider): () => void {
|
||||
};
|
||||
}
|
||||
|
||||
/** 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<EndpointEntry[]> {
|
||||
export async function searchEndpoints(root: string | null): Promise<EndpointEntry[]> {
|
||||
if (!root) return [];
|
||||
const results = await Promise.allSettled(
|
||||
[...endpointProviders.values()].filter((p) => provider(p.id)).map(async (p) => p.endpoints(root)),
|
||||
);
|
||||
const results = await Promise.allSettled([...endpointProviders.values()].map(async (p) => p.endpoints(root)));
|
||||
return results.flatMap((result) => (result.status === "fulfilled" ? result.value : []));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Заблокувати користувача