дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-23 10:00:48 +02:00
Порівняти коміти
12
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
6771575c88 | ||
|
|
bbea793adf | ||
|
|
f1c556e2ec | ||
|
|
2d99a79e69 | ||
|
|
ca778e2382 | ||
|
|
414353a5bd | ||
|
|
3080dc6100 | ||
|
|
1bb9f8d07c | ||
|
|
a539baec37 | ||
|
|
7dff6e1852 | ||
|
|
fc7fa85850 | ||
|
|
7e5a2cf051 |
No files matched your search
@@ -102,24 +102,44 @@ jobs:
|
||||
name: Rust (${{ matrix.os }})
|
||||
needs: changes
|
||||
if: needs.changes.outputs.rust == 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-22.04, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
# Self-hosted runners (scripts/selfhost-runner) only for trusted events, and only while the
|
||||
# SELFHOSTED_RUNNERS repository variable is 'true': runs-on cannot fall back when none is online.
|
||||
runs-on: ${{ matrix.os == 'ubuntu-22.04' && vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: pnpm/action-setup@v5
|
||||
with: { version: 11 }
|
||||
- uses: actions/setup-node@v5
|
||||
with: { node-version: 22, cache: pnpm }
|
||||
with:
|
||||
node-version: 22
|
||||
cache: ${{ runner.environment != 'self-hosted' && 'pnpm' || '' }}
|
||||
package-manager-cache: ${{ runner.environment != 'self-hosted' }}
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with: { components: "clippy, rustfmt" }
|
||||
# Only main saves the cache (saving takes minutes on Windows); PRs restore main's.
|
||||
# Self-hosted runners keep persistent local Cargo caches; GitHub-hosted runners use Actions cache
|
||||
# (only main saves it because saving takes minutes on Windows; PRs restore main's).
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
if: runner.environment != 'self-hosted'
|
||||
with:
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
# The persistent target dir makes incremental builds pay off; cap its size so it can't fill the disk.
|
||||
- name: Persistent Cargo target dir
|
||||
if: runner.environment == 'self-hosted'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "CARGO_INCREMENTAL=1" >> "$GITHUB_ENV"
|
||||
size=$(du -sm "$CARGO_TARGET_DIR" 2>/dev/null | cut -f1 || true)
|
||||
if [ "${size:-0}" -gt 40000 ]; then
|
||||
echo "$CARGO_TARGET_DIR is ${size} MB; clearing it"
|
||||
rm -rf "$CARGO_TARGET_DIR"
|
||||
fi
|
||||
- uses: taiki-e/install-action@nextest
|
||||
- name: Linux deps
|
||||
if: runner.os == 'Linux'
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function show(page: Page, action: string) {
|
||||
await page.evaluate(async (action) => {
|
||||
const actions = "/src/platform/actions.ts";
|
||||
if (!(await (await import(/* @vite-ignore */ actions)).executeAction(action))) throw Error(action);
|
||||
}, action);
|
||||
}
|
||||
|
||||
test("analysis scope fields align with their radio choices and retain their values", async ({ workbench: page }) => {
|
||||
await page.evaluate(async () => {
|
||||
const search = "/src/platform/search.ts";
|
||||
(await import(/* @vite-ignore */ search)).saveCustomScopes([
|
||||
{ name: "Frontend", pattern: "file:src//*" },
|
||||
{ name: "Tests", pattern: "file:tests//*" },
|
||||
]);
|
||||
});
|
||||
await show(page, "analyze.inspectCode");
|
||||
const dialog = page.getByRole("dialog", { name: "Specify Inspection Scope" });
|
||||
const scope = dialog.getByRole("group", { name: "Scope" });
|
||||
const directory = scope.getByRole("textbox", { name: "Directory" });
|
||||
const custom = scope.getByRole("button", { name: "Custom scope", exact: true });
|
||||
const radio = scope.getByRole("radio", { name: "Module or directory" });
|
||||
const label = scope.getByText("Module or directory", { exact: true });
|
||||
|
||||
await radio.check();
|
||||
const path = (await directory.boundingBox())!;
|
||||
const choice = (await label.boundingBox())!;
|
||||
expect(path.y + path.height / 2).toBeCloseTo(choice.y + choice.height / 2, 0);
|
||||
await directory.fill("/dev/acme-api/src");
|
||||
await expect(custom).toBeDisabled();
|
||||
await scope.getByRole("radio", { name: "Custom scope", exact: true }).check();
|
||||
await expect(directory).toBeDisabled();
|
||||
expect((await custom.boundingBox())!.x).toBeCloseTo(path.x, 0);
|
||||
await custom.click();
|
||||
await page.getByRole("option", { name: /^Tests/ }).click();
|
||||
await expect(custom).toContainText("Tests");
|
||||
|
||||
await radio.check();
|
||||
await expect(directory).toHaveValue("/dev/acme-api/src");
|
||||
await scope.getByRole("radio", { name: "Custom scope", exact: true }).check();
|
||||
await expect(custom).toContainText("Tests");
|
||||
await page.setViewportSize({ width: 400, height: 640 });
|
||||
const stacked = (await directory.boundingBox())!;
|
||||
const customBox = (await custom.boundingBox())!;
|
||||
const radioBox = (await label.boundingBox())!;
|
||||
const next = (await scope.getByText("Current file", { exact: true }).boundingBox())!;
|
||||
expect(stacked.y).toBeGreaterThan(radioBox.y + radioBox.height);
|
||||
expect(stacked.y + stacked.height).toBeLessThan(next.y);
|
||||
expect(stacked.x).toBeCloseTo(customBox.x, 0);
|
||||
expect(await scope.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
});
|
||||
|
||||
for (const [action, title] of [
|
||||
["code.cleanup", "Run Code Cleanup"],
|
||||
["analyze.locateDuplicates", "Locate Duplicates"],
|
||||
["find.structural", "Structural Search"],
|
||||
["find.replaceStructural", "Structural Replace"],
|
||||
] as const) {
|
||||
test(`${title} keeps directory options with their scope choice`, async ({ workbench: page }) => {
|
||||
await show(page, action);
|
||||
const dialog = page.getByRole("dialog", { name: title });
|
||||
const scope = dialog.getByRole("group", { name: "Scope" });
|
||||
const directory = scope.getByRole("textbox", { name: "Directory" });
|
||||
await expect(directory).toBeDisabled();
|
||||
await scope.getByRole("radio", { name: "Module or directory" }).check();
|
||||
await expect(directory).toBeEnabled();
|
||||
await expect(scope.getByRole("button", { name: "Browse…" })).toBeEnabled();
|
||||
});
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
* with its frames and variables, and stepping and resuming go back to the adapter. The adapter is
|
||||
* stubbed at the IPC layer; `crates/ide-dap/tests` drives real ones.
|
||||
*/
|
||||
import type { JvmMemoryResult } from "../src/platform/ipc";
|
||||
import { expect, ipcCalls, openFromTree, stubDesktop, test } from "./fixtures";
|
||||
|
||||
const ROOT = "/dev/acme-api";
|
||||
@@ -114,6 +115,83 @@ test("stops at a breakpoint, shows frames and variables, steps and resumes", asy
|
||||
await expect(debug.getByText("CreateOrderRequest(sku='A-1', qty=2)")).toBeHidden();
|
||||
});
|
||||
|
||||
test("Memory gives class filtering the available toolbar width and exposes changed-only filtering", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
const rows = [
|
||||
{ name: "OrderCache", instances: 64, deltaInstances: 12 },
|
||||
{ name: "OrderRepository", instances: 16, deltaInstances: 0 },
|
||||
].map((row) => ({ ...row, bytes: row.instances * 16, deltaBytes: null, module: null, ambiguous: false }));
|
||||
const result: JvmMemoryResult = {
|
||||
status: "ready",
|
||||
snapshot: {
|
||||
rows,
|
||||
totalInstances: 80,
|
||||
totalBytes: 1280,
|
||||
javaVersion: "21",
|
||||
takenWhileSuspended: true,
|
||||
hasBaseline: true,
|
||||
elapsedMs: 5,
|
||||
source: "debugger",
|
||||
},
|
||||
};
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(
|
||||
async ({ result, id }) => {
|
||||
const caps = { jvmMemory: true, jvmHeap: true };
|
||||
window.__ipc.handlers.debug_capabilities = () => caps;
|
||||
window.__ipc.handlers.debug_jvm_memory_classes = () => result;
|
||||
const debugPath = "/src/features/debugger/state.ts";
|
||||
const { adoptSession } = await import(/* @vite-ignore */ debugPath);
|
||||
adoptSession(id, { adapter: "java-debug", name: "Billing Service", status: "paused", caps });
|
||||
const dockPath = "/src/workbench/toolwindows/store.ts";
|
||||
const layout = await import(/* @vite-ignore */ dockPath);
|
||||
layout.moveToolWindow("debug", "bottom");
|
||||
layout.setToolWindowSize("bottom", 300);
|
||||
layout.showToolWindow("debug", true);
|
||||
},
|
||||
{ result, id: SESSION },
|
||||
);
|
||||
|
||||
const debug = page.getByRole("region", { name: "Debug", exact: true });
|
||||
await debug.getByRole("tab", { name: "Memory" }).click();
|
||||
const toolbar = debug.getByRole("toolbar", { name: "Memory", exact: true });
|
||||
const filter = toolbar.getByRole("textbox", { name: "Filter classes" });
|
||||
const options = toolbar.getByRole("button", { name: "View Options" });
|
||||
const grid = debug.getByRole("grid", { name: "Memory", exact: true });
|
||||
await expect(grid.getByText("OrderRepository", { exact: true })).toBeVisible();
|
||||
expect((await filter.boundingBox())!.width).toBeGreaterThan((await toolbar.boundingBox())!.width / 2);
|
||||
|
||||
await page.evaluate(async () => {
|
||||
const dockPath = "/src/workbench/toolwindows/store.ts";
|
||||
const layout = await import(/* @vite-ignore */ dockPath);
|
||||
layout.moveToolWindow("debug", "right");
|
||||
layout.setToolWindowSize("right", 330);
|
||||
});
|
||||
await expect.poll(async () => (await toolbar.boundingBox())!.width).toBeCloseTo(330, 0);
|
||||
const bar = (await toolbar.boundingBox())!;
|
||||
const gear = (await options.boundingBox())!;
|
||||
const input = (await filter.boundingBox())!;
|
||||
expect(input.width).toBeGreaterThan(bar.width / 2);
|
||||
expect(input.x + input.width).toBeLessThan(gear.x);
|
||||
expect(gear.x + gear.width).toBeLessThanOrEqual(bar.x + bar.width);
|
||||
|
||||
await filter.fill("cache");
|
||||
await expect(grid.getByText("OrderRepository", { exact: true })).toBeHidden();
|
||||
await toolbar.getByRole("button", { name: "Clear", exact: true }).click();
|
||||
await expect(grid.getByText("OrderRepository", { exact: true })).toBeVisible();
|
||||
|
||||
await options.press("Enter");
|
||||
const changed = page.getByRole("menuitemcheckbox", { name: "Changed only" });
|
||||
await expect(changed).not.toBeChecked();
|
||||
await changed.press("Enter");
|
||||
await expect(grid.getByText("OrderRepository", { exact: true })).toBeHidden();
|
||||
await expect(options).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(options).toBeFocused();
|
||||
await options.press("Enter");
|
||||
await expect(changed).toBeChecked();
|
||||
});
|
||||
|
||||
test("Evaluate keeps a multiline expression and its result visible in a short dialog", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 580, height: 420 });
|
||||
await stubDesktop(page);
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
async function openTable(page: Page, columns: number) {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async (columns) => {
|
||||
window.__ipc.handlers.debug_evaluate_in = ({ expression }) => {
|
||||
const query = String(expression);
|
||||
const sliced = query.includes("totals.iloc[:2, :2]");
|
||||
const visibleColumns = sliced ? 2 : Math.min(30, columns);
|
||||
const columnsInFrame = sliced ? 2 : columns;
|
||||
const start = query.includes("100, 100,") ? 100 : 0;
|
||||
const rows = sliced ? 2 : 220;
|
||||
const count = sliced ? 2 : 100;
|
||||
const result = query.includes("missing_table")
|
||||
? { error: "NameError: missing_table" }
|
||||
: {
|
||||
kind: "frame",
|
||||
shape: [rows, columnsInFrame],
|
||||
rows,
|
||||
columns: columnsInFrame,
|
||||
headers: Array.from({ length: visibleColumns }, (_, i) => `Amount ${i + 1}`),
|
||||
dtypes: Array.from({ length: visibleColumns }, () => "int64"),
|
||||
index: Array.from({ length: count }, (_, i) => String(i + start)),
|
||||
cells: Array.from({ length: count }, (_, row) =>
|
||||
Array.from({ length: visibleColumns }, (_, column) => String((row + start + 1) * 10 + column)),
|
||||
),
|
||||
};
|
||||
return {
|
||||
name: "",
|
||||
value: JSON.stringify(JSON.stringify(result)),
|
||||
typeName: "str",
|
||||
variablesReference: 0,
|
||||
evaluateName: null,
|
||||
};
|
||||
};
|
||||
const stateModule = "/src/features/debugger/state.ts";
|
||||
const overlaysModule = "/src/features/debugger/ui/popoverStore.ts";
|
||||
const { adoptSession } = await import(/* @vite-ignore */ stateModule);
|
||||
const { openTableView } = await import(/* @vite-ignore */ overlaysModule);
|
||||
adoptSession(91, { name: "Settlement review", adapter: "debugpy", status: "paused", selectedFrame: 11 });
|
||||
openTableView("totals", 91);
|
||||
}, columns);
|
||||
const dialog = page.getByRole("dialog", { name: "Table view of totals", exact: true });
|
||||
await expect(dialog.getByRole("table")).toBeVisible();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
test("View as Table gives the grid the dialog width and puts the expression below it", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1120, height: 760 });
|
||||
const dialog = await openTable(page, 3);
|
||||
const scroll = dialog.getByRole("region", { name: "Table", exact: true });
|
||||
const grid = dialog.getByRole("table");
|
||||
const expression = dialog.getByRole("textbox", { name: "Expression", exact: true });
|
||||
const shape = dialog.getByText("Shape (220, 3)", { exact: true });
|
||||
const body = (await scroll.boundingBox())!;
|
||||
const input = (await expression.boundingBox())!;
|
||||
expect(input.y).toBeGreaterThan(body.y + body.height);
|
||||
expect((await shape.boundingBox())!.y).toBeLessThan(body.y);
|
||||
expect(Math.abs((await grid.boundingBox())!.width - (await scroll.evaluate((el) => el.clientWidth)))).toBeLessThan(1);
|
||||
expect((await dialog.boundingBox())!.width).toBeCloseTo(700, 0);
|
||||
await expect(expression).toBeFocused();
|
||||
await expect(grid).toHaveCSS("font-family", /Inter/);
|
||||
await expect(grid.getByRole("columnheader").nth(1)).toHaveCSS("text-align", "center");
|
||||
await expect(grid.getByRole("rowheader").first()).toHaveCSS("text-align", "center");
|
||||
await expect(grid.getByRole("cell").first()).toHaveCSS("text-align", /^(start|left)$/);
|
||||
});
|
||||
|
||||
test("View as Table keeps paging, slice input and Close usable in a narrow window", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 450, height: 620 });
|
||||
const dialog = await openTable(page, 36);
|
||||
const expression = dialog.getByRole("textbox", { name: "Expression", exact: true });
|
||||
const scroll = dialog.getByRole("region", { name: "Table", exact: true });
|
||||
const rows = dialog.getByRole("button", { name: "Next Rows", exact: true });
|
||||
const columns = dialog.getByRole("button", { name: "Next Columns", exact: true });
|
||||
const close = dialog.getByRole("button", { name: "Close", exact: true }).filter({ hasText: /^Close$/ });
|
||||
const input = (await expression.boundingBox())!;
|
||||
const grid = (await scroll.boundingBox())!;
|
||||
expect(input.y).toBeGreaterThan(grid.y + grid.height);
|
||||
expect(input.width).toBeCloseTo(grid.width, 0);
|
||||
for (const control of [expression, rows, columns, close]) await expect(control).toBeInViewport({ ratio: 0.98 });
|
||||
await scroll.evaluate((el) => {
|
||||
el.scrollLeft = 300;
|
||||
el.scrollTop = 150;
|
||||
});
|
||||
await expect(dialog.getByRole("rowheader").filter({ hasText: /^9$/ })).toBeInViewport({ ratio: 0.98 });
|
||||
await rows.click();
|
||||
await expect(dialog.getByText("Rows 101–200 of 220", { exact: true })).toBeVisible();
|
||||
await expect
|
||||
.poll(() => ipcCalls(page, "debug_evaluate_in"))
|
||||
.toContainEqual(expect.objectContaining({ expression: expect.stringContaining("100, 100, 0, 30") }));
|
||||
await expression.fill("totals.iloc[:2, :2]");
|
||||
await expression.press("Enter");
|
||||
const sliced = page.getByRole("dialog", { name: "Table view of totals.iloc[:2, :2]", exact: true });
|
||||
await expect(sliced.getByText("Shape (2, 2)", { exact: true })).toBeVisible();
|
||||
const slicedExpression = sliced.getByRole("textbox", { name: "Expression", exact: true });
|
||||
await slicedExpression.fill("missing_table");
|
||||
await slicedExpression.press("Enter");
|
||||
const failed = page.getByRole("dialog", { name: "Table view of missing_table", exact: true });
|
||||
const alert = failed.getByRole("alert");
|
||||
await expect(alert).toHaveText("NameError: missing_table");
|
||||
expect((await alert.boundingBox())!.y).toBeGreaterThan(
|
||||
(await failed.getByRole("textbox", { name: "Expression", exact: true }).boundingBox())!.y,
|
||||
);
|
||||
await failed
|
||||
.getByRole("button", { name: "Close", exact: true })
|
||||
.filter({ hasText: /^Close$/ })
|
||||
.click();
|
||||
await expect(failed).toHaveCount(0);
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function openEditorTabsSettings(page: Page) {
|
||||
await page.evaluate(async () => {
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
await executeAction("file.settings", "editor.general.editorTabs");
|
||||
});
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
await expect(dialog.getByRole("region", { name: "Closing Policy", exact: true })).toBeVisible();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
test("Editor Tabs aligns appearance fields and stacks closing choices at both widths", async ({ workbench: page }) => {
|
||||
const settings = await openEditorTabsSettings(page);
|
||||
const appearance = settings.getByRole("region", { name: "Appearance", exact: true });
|
||||
const placement = appearance.getByRole("button", { name: "Tab placement", exact: true });
|
||||
const closePosition = appearance.getByRole("button", { name: "Close button position", exact: true });
|
||||
const closing = settings.getByRole("region", { name: "Closing Policy", exact: true });
|
||||
const limit = closing.getByRole("textbox", { name: "Tab limit", exact: true });
|
||||
const footer = settings.getByRole("button", { name: "OK", exact: true });
|
||||
|
||||
for (const width of [1100, 580]) {
|
||||
await page.setViewportSize({ width, height: 760 });
|
||||
const placementBox = (await placement.boundingBox())!;
|
||||
const closeBox = (await closePosition.boundingBox())!;
|
||||
expect(Math.abs(placementBox.x - closeBox.x)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(placementBox.width - closeBox.width)).toBeLessThanOrEqual(1);
|
||||
await expect(placement).toBeInViewport();
|
||||
await expect(limit).toHaveValue("30");
|
||||
|
||||
for (const name of ["When the tab limit is reached", "When the current tab is closed, activate"]) {
|
||||
const choices = closing.getByRole("radiogroup", { name, exact: true }).getByRole("radio");
|
||||
const first = (await choices.first().boundingBox())!;
|
||||
const last = (await choices.last().boundingBox())!;
|
||||
expect(Math.abs(first.x - last.x)).toBeLessThanOrEqual(1);
|
||||
expect(last.y).toBeGreaterThan(first.y + first.height);
|
||||
expect(last.x + last.width).toBeLessThanOrEqual(width);
|
||||
}
|
||||
await expect(footer).toBeInViewport();
|
||||
}
|
||||
});
|
||||
|
||||
test("Editor Tabs keeps row and overflow choices independently selected and keyboard operable", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
const settings = await openEditorTabsSettings(page);
|
||||
const group = settings.getByRole("radiogroup", { name: "Show tabs in", exact: true });
|
||||
const one = group.getByRole("radio", { name: /^One row/ });
|
||||
const multiple = group.getByRole("radio", { name: "Multiple rows", exact: true });
|
||||
const scroll = group.getByRole("radio", { name: "Scroll the tabs panel", exact: true });
|
||||
const squeeze = group.getByRole("radio", { name: "Squeeze tabs", exact: true });
|
||||
await expect(one).toBeChecked();
|
||||
await expect(scroll).toBeChecked();
|
||||
const oneBox = (await one.boundingBox())!;
|
||||
const scrollBox = (await scroll.boundingBox())!;
|
||||
const multipleBox = (await multiple.boundingBox())!;
|
||||
expect(scrollBox.x).toBeGreaterThan(oneBox.x + 8);
|
||||
expect(scrollBox.y).toBeGreaterThan(oneBox.y);
|
||||
expect(Math.abs(multipleBox.x - oneBox.x)).toBeLessThanOrEqual(1);
|
||||
expect(multipleBox.y).toBeGreaterThan(scrollBox.y);
|
||||
|
||||
await scroll.press("ArrowDown");
|
||||
await expect(squeeze).toBeFocused();
|
||||
await expect(squeeze).toBeChecked();
|
||||
await expect(one).toBeChecked();
|
||||
await one.press("ArrowDown");
|
||||
await expect(multiple).toBeFocused();
|
||||
await expect(multiple).toBeChecked();
|
||||
await expect(squeeze).toBeDisabled();
|
||||
await expect(squeeze).toBeChecked();
|
||||
await multiple.press("ArrowUp");
|
||||
await expect(one).toBeChecked();
|
||||
await expect(squeeze).toBeEnabled();
|
||||
await settings.getByRole("button", { name: "OK", exact: true }).click();
|
||||
|
||||
const reopened = await openEditorTabsSettings(page);
|
||||
await expect(reopened.getByRole("radio", { name: /^One row/ })).toBeChecked();
|
||||
await expect(reopened.getByRole("radio", { name: "Squeeze tabs", exact: true })).toBeChecked();
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function editMacros(page: Page) {
|
||||
await page.evaluate(async () => {
|
||||
const actions = "/src/platform/actions.ts";
|
||||
if (!(await (await import(/* @vite-ignore */ actions)).executeAction("macro.edit"))) throw Error("Edit Macros");
|
||||
});
|
||||
}
|
||||
|
||||
test("Edit Macros keeps a balanced, resizable split for names and recorded steps", async ({ workbench: page }) => {
|
||||
await page.evaluate(async () => {
|
||||
const model = "/src/features/macros/model.ts";
|
||||
const { saveMacro } = await import(/* @vite-ignore */ model);
|
||||
saveMacro("Insert comment", [{ kind: "text", text: "Review this block" }]);
|
||||
saveMacro("Wrap selection", [
|
||||
{ kind: "key", key: "Home" },
|
||||
{ kind: "text", text: "beginProcessingCurrentSelectionImmediately();".repeat(6) },
|
||||
{ kind: "key", key: "End" },
|
||||
]);
|
||||
});
|
||||
await editMacros(page);
|
||||
|
||||
const editor = page.getByRole("dialog", { name: "Edit Macros", exact: true });
|
||||
const macros = editor.getByRole("listbox", { name: "Macros" });
|
||||
const steps = editor.getByRole("list", { name: "Recorded steps" });
|
||||
const options = editor.getByRole("toolbar", { name: "Macros" });
|
||||
const divider = editor.getByRole("separator", { name: "Macros" });
|
||||
const [initial, stepsWidth] = await editor.evaluate((dialog) => [
|
||||
dialog.querySelector('[role="listbox"]')!.getBoundingClientRect().width,
|
||||
dialog.querySelector("ol")!.getBoundingClientRect().width,
|
||||
]);
|
||||
expect(Math.abs(initial - stepsWidth)).toBeLessThanOrEqual(1);
|
||||
await expect(macros).toBeFocused();
|
||||
expect((await steps.boundingBox())!.height).toBeGreaterThan(260);
|
||||
expect((await options.boundingBox())!.y).toBeLessThan((await macros.boundingBox())!.y);
|
||||
|
||||
await macros.getByRole("option", { name: "Wrap selection" }).click();
|
||||
await expect(steps.getByText("Press Home")).toBeVisible();
|
||||
await divider.press("ArrowRight");
|
||||
await expect.poll(async () => (await macros.boundingBox())!.width).toBeGreaterThan(initial + 5);
|
||||
const resized = (await macros.boundingBox())!.width;
|
||||
await editor.locator("[data-dialog-footer]").getByRole("button", { name: "Close" }).click();
|
||||
await editMacros(page);
|
||||
await expect.poll(async () => (await macros.boundingBox())!.width).toBeCloseTo(resized, 0);
|
||||
|
||||
await page.setViewportSize({ width: 400, height: 620 });
|
||||
await macros.getByRole("option", { name: "Wrap selection" }).click();
|
||||
expect(await steps.evaluate((list) => list.scrollWidth - list.clientWidth)).toBeLessThanOrEqual(1);
|
||||
await options.getByRole("button", { name: "Rename Macro" }).click();
|
||||
const rename = page.getByRole("dialog", { name: "Rename Macro", exact: true });
|
||||
await rename.getByRole("textbox").fill("Wrap text");
|
||||
await rename.getByRole("button", { name: "Rename", exact: true }).click();
|
||||
await expect(macros.getByRole("option", { name: "Wrap text" })).toBeVisible();
|
||||
await expect(steps.getByText("Press Home")).toBeVisible();
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
import type { MavenModel } from "../src/platform/ipc";
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
const maven: MavenModel = {
|
||||
projects: [
|
||||
{
|
||||
pom: "pom.xml",
|
||||
dir: "",
|
||||
groupId: "dev.acme",
|
||||
artifactId: "billing",
|
||||
version: "1.0.0",
|
||||
packaging: "jar",
|
||||
displayName: "Billing",
|
||||
parent: null,
|
||||
modules: [],
|
||||
aggregated: false,
|
||||
plugins: [
|
||||
{
|
||||
groupId: "org.apache.maven.plugins",
|
||||
artifactId: "maven-surefire-plugin",
|
||||
version: "3.2.5",
|
||||
prefix: "surefire",
|
||||
goals: ["test"],
|
||||
},
|
||||
],
|
||||
dependencies: [],
|
||||
profiles: [],
|
||||
javaVersion: 21,
|
||||
command: "mvn",
|
||||
options: [],
|
||||
env: {},
|
||||
},
|
||||
],
|
||||
profiles: [],
|
||||
syncedAt: 1,
|
||||
stale: false,
|
||||
syncError: null,
|
||||
};
|
||||
|
||||
test("Maven plugin rows give the name priority over coordinates in narrow docks", async ({ workbench: page }) => {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async (maven) => {
|
||||
window.__ipc.handlers.build_model = () => ({ maven, gradle: [] });
|
||||
const buildModule = "/src/features/build-tools/store.ts";
|
||||
const { loadModel, setExpanded } = await import(/* @vite-ignore */ buildModule);
|
||||
await loadModel();
|
||||
setExpanded("maven", new Set(["mvn:pom.xml", "mvn:pom.xml:plugins"]));
|
||||
const dockModule = "/src/workbench/toolwindows/store.ts";
|
||||
const { showToolWindow, setToolWindowSize } = await import(/* @vite-ignore */ dockModule);
|
||||
showToolWindow("maven", true);
|
||||
setToolWindowSize("right", 190);
|
||||
}, maven);
|
||||
|
||||
const tree = page.getByRole("tree", { name: "Maven projects" });
|
||||
const coordinates = "(org.apache.maven.plugins:maven-surefire-plugin:3.2.5)";
|
||||
const plugin = tree.getByRole("treeitem", { name: `surefire ${coordinates}`, exact: true });
|
||||
const name = plugin.getByText("surefire", { exact: true });
|
||||
const metadata = plugin.getByText(coordinates, { exact: true });
|
||||
await expect(name).toBeVisible();
|
||||
await expect(metadata).toHaveAttribute("title", coordinates);
|
||||
const fit = (el: Element) => {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(el);
|
||||
return range.getBoundingClientRect().width <= el.getBoundingClientRect().width;
|
||||
};
|
||||
expect(await name.evaluate(fit)).toBe(true);
|
||||
expect(await metadata.evaluate(fit)).toBe(false);
|
||||
expect(await metadata.evaluate((el) => getComputedStyle(el).color)).not.toBe(
|
||||
await name.evaluate((el) => getComputedStyle(el).color),
|
||||
);
|
||||
|
||||
await plugin.locator("[data-tree-toggle]").click();
|
||||
await expect(tree.getByRole("treeitem", { name: "surefire:test", exact: true })).toBeVisible();
|
||||
});
|
||||
@@ -29,7 +29,14 @@ test("Find in Files keeps the scope list and pattern editor usable in a narrow w
|
||||
expect((await list.boundingBox())!.x).toBeLessThan((await name.boundingBox())!.x);
|
||||
|
||||
await page.setViewportSize({ width: 460, height: 530 });
|
||||
const fields = (await pattern.boundingBox())!;
|
||||
// The dialog relays out over a few frames after the resize; measure once it has settled.
|
||||
let fields = (await pattern.boundingBox())!;
|
||||
await expect(async () => {
|
||||
const previous = fields.y;
|
||||
await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))));
|
||||
fields = (await pattern.boundingBox())!;
|
||||
expect(fields.y).toBe(previous);
|
||||
}).toPass();
|
||||
expect(fields.y).toBeGreaterThanOrEqual((await list.boundingBox())!.y + (await list.boundingBox())!.height);
|
||||
expect(fields.width).toBeGreaterThan(250);
|
||||
await list.evaluate((el) => (el.scrollTop = el.scrollHeight));
|
||||
|
||||
@@ -75,7 +75,7 @@ for (const locale of ["en", "zh"]) {
|
||||
const path = "/src/platform/i18n.ts";
|
||||
await (await import(/* @vite-ignore */ path)).setLocale(locale);
|
||||
}, locale);
|
||||
for (const id of ["appearance", "editor.font", "general", "general.httpProxy"]) {
|
||||
for (const id of ["appearance", "editor.font", "general", "general.httpProxy", "vcs.log"]) {
|
||||
await selectPage(page, id);
|
||||
const body = page.locator("[class*='pageBody']");
|
||||
for (const width of [1000, 784, 640, 520]) {
|
||||
@@ -108,6 +108,31 @@ test("keeps Open project in options within narrow System Settings", async ({ wor
|
||||
expect(overflow).toBeLessThanOrEqual(1);
|
||||
});
|
||||
|
||||
test("Git Log settings group display and column options with aligned checkboxes", async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+,");
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
await selectPage(page, "vcs.log");
|
||||
const view = dialog.getByRole("region", { name: "View Options" });
|
||||
const columns = dialog.getByRole("region", { name: "Visible columns" });
|
||||
const tagNames = view.getByRole("checkbox", { name: "Show tag names" });
|
||||
const hash = columns.getByRole("checkbox", { name: "Hash" });
|
||||
await expect(view.getByRole("checkbox")).toHaveCount(5);
|
||||
await expect(columns.getByRole("checkbox")).toHaveCount(4);
|
||||
|
||||
for (const width of [1000, 520]) {
|
||||
await page.setViewportSize({ width, height: 760 });
|
||||
// Read both rows together once the dialog has finished opening and relaid out.
|
||||
await expect
|
||||
.poll(async () => Math.abs((await tagNames.boundingBox())!.x - (await hash.boundingBox())!.x))
|
||||
.toBeLessThan(0.5);
|
||||
}
|
||||
|
||||
await expect(hash).not.toBeChecked();
|
||||
await hash.focus();
|
||||
await page.keyboard.press("Space");
|
||||
await expect(hash).toBeChecked();
|
||||
});
|
||||
|
||||
test("settings sidebar resizes with mouse and keyboard and remembers its width", async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+,");
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
async function openDialog(page: Page, id: "find.structural" | "find.replaceStructural") {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async (id) => {
|
||||
window.__ipc.handlers.structural_languages = () => [
|
||||
{ id: "java", name: "Java" },
|
||||
{ id: "typescript", name: "TypeScript" },
|
||||
];
|
||||
window.__ipc.handlers.structural_validate = () => null;
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
await executeAction(id);
|
||||
}, id);
|
||||
}
|
||||
|
||||
test("Structural Search puts language selection beside the taller template editor", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1080, height: 720 });
|
||||
await openDialog(page, "find.structural");
|
||||
const dialog = page.getByRole("dialog", { name: "Structural Search" });
|
||||
const editor = dialog.getByRole("textbox", { name: "Search template" });
|
||||
const label = dialog.locator("label").filter({ hasText: /^Search template$/ });
|
||||
const language = dialog.getByRole("button", { name: "Language", exact: true });
|
||||
await expect(editor).toBeFocused();
|
||||
await expect(language).toHaveText("Java");
|
||||
|
||||
const { x, y, width, height } = (await editor.boundingBox())!;
|
||||
const caption = (await label.boundingBox())!;
|
||||
const picker = (await language.boundingBox())!;
|
||||
expect(Math.abs(caption.y + caption.height / 2 - (picker.y + picker.height / 2))).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(caption.x - x)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(picker.x + picker.width - (x + width))).toBeLessThanOrEqual(1);
|
||||
expect(y - (picker.y + picker.height)).toBeLessThanOrEqual(6);
|
||||
expect(Math.abs(height - 150)).toBeLessThanOrEqual(1);
|
||||
|
||||
await language.click();
|
||||
await page.getByRole("option", { name: "TypeScript" }).click();
|
||||
await editor.fill("console.log($value$)");
|
||||
await expect
|
||||
.poll(() => ipcCalls(page, "structural_validate"))
|
||||
.toContainEqual({
|
||||
query: { language: "typescript", pattern: "console.log($value$)", replacement: null, maxMatches: 0 },
|
||||
});
|
||||
await expect(dialog.getByRole("button", { name: "Find", exact: true })).toBeEnabled();
|
||||
});
|
||||
|
||||
test("Structural Replace uses editor typography and fits the template controls in a narrow window", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 400, height: 620 });
|
||||
await openDialog(page, "find.replaceStructural");
|
||||
const dialog = page.getByRole("dialog", { name: "Structural Replace" });
|
||||
const search = dialog.getByRole("textbox", { name: "Search template" });
|
||||
const replacement = dialog.getByRole("textbox", { name: "Replace template" });
|
||||
await expect(search).toBeFocused();
|
||||
await page.evaluate(async () => {
|
||||
const projectModule = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ projectModule);
|
||||
const { settings, project } = useProject.getState();
|
||||
const current = settings ?? project?.settings;
|
||||
if (!current) throw new Error("Expected project settings");
|
||||
useProject.setState({
|
||||
settings: { ...current, editor: { ...current.editor, fontFamily: "Consolas", fontSize: 17, lineHeight: 26 } },
|
||||
});
|
||||
});
|
||||
|
||||
for (const template of [search, replacement]) {
|
||||
await expect(template).toHaveCSS("font-family", /^Consolas,/);
|
||||
await expect(template).toHaveCSS("font-size", "17px");
|
||||
await expect(template).toHaveCSS("line-height", "26px");
|
||||
const box = (await template.boundingBox())!;
|
||||
expect(box.x).toBeGreaterThanOrEqual(0);
|
||||
expect(box.x + box.width).toBeLessThanOrEqual(400);
|
||||
expect(Math.abs(box.height - 105)).toBeLessThanOrEqual(1);
|
||||
}
|
||||
await expect(dialog.getByRole("radio", { name: "Whole project" })).toBeInViewport();
|
||||
await replacement.fill("Objects.equals($a$, $b$)");
|
||||
await expect(replacement).toHaveValue("Objects.equals($a$, $b$)");
|
||||
await expect(dialog.getByRole("button", { name: "Cancel" })).toBeInViewport();
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
@@ -0,0 +1,113 @@
|
||||
# Self-Hosted GitHub Actions Runners
|
||||
|
||||
Runs _N_ persistent, isolated GitHub Actions runners via Docker Compose on a single Docker named volume (`runner-persist`) without requiring repository admin Personal Access Tokens.
|
||||
|
||||
In `.github/workflows/ci.yml`, the Linux leg of `Rust (${{ matrix.os }})` routes to `["self-hosted", "openidea-selfhosted"]` on trusted events (`push`, `merge_group`, `workflow_dispatch`, and same-repo pull requests) while the `SELFHOSTED_RUNNERS` repository variable is `true`. Fork pull requests, and every run while the variable is unset, use GitHub-hosted runners.
|
||||
|
||||
> **Availability requirement:** GitHub Actions `runs-on` cannot fall back to GitHub-hosted runners when no matching self-hosted runner is online; jobs stay queued until one connects. Set `SELFHOSTED_RUNNERS=true` (**Settings → Secrets and variables → Actions → Variables**) only once the runners are up, and delete it before taking the host down.
|
||||
|
||||
## Security Constraints
|
||||
|
||||
Because this repository is public and these runners retain persistent build caches and credentials across runs, workflows and runner hosts must follow these rules:
|
||||
|
||||
- **Trusted events only:** Route jobs to `openidea-selfhosted` only for `push`, `merge_group`, `workflow_dispatch`, or `pull_request` events where `github.event.pull_request.head.repo.full_name == github.repository`. Fork pull requests must stay on GitHub-hosted runners so untrusted code never reaches persistent caches or runner credentials.
|
||||
- **Read-only `GITHUB_TOKEN`:** Jobs targeting `openidea-selfhosted` must set `permissions: { contents: read }` (least privilege).
|
||||
- **No secret-bearing jobs:** Never pass repository or organization `secrets.*` to jobs running on `openidea-selfhosted`.
|
||||
- **Never feed releases:** Artifacts or outputs from `openidea-selfhosted` runners must never be uploaded for consumption by release or nightly workflows.
|
||||
- **Container isolation:** Jobs run as the `runner` user (`RUN_AS_ROOT=false`) from a pinned image tag and digest, but the image grants that user passwordless `sudo` (CI needs it for `apt-get`), so a job can become root inside its container. The container is the isolation boundary: never mount `/var/run/docker.sock` or host directories into it, and never run it `--privileged`.
|
||||
- **Shared build state:** Same-repo pull requests and `main` share each slot's Cargo target directory, so only collaborators you trust with `main`'s build should push branches to this repository.
|
||||
- **Network isolation:** Run the Docker host on an isolated network segment away from sensitive devices or internal services.
|
||||
|
||||
## How It Works
|
||||
|
||||
On startup, each container replica acquires an exclusive `flock` on a numeric slot (`1..N`) before dropping privileges to the `runner` user, isolating its persistent state under `/persist/slot-<N>/`:
|
||||
|
||||
| Path | Purpose |
|
||||
| --------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `runner-data/` | Saved `.runner` and `.credentials` reused across container restarts (`CONFIGURED_ACTIONS_RUNNER_FILES_DIR`) |
|
||||
| `work/` | Runner workspace and repository checkouts (`RUNNER_WORKDIR`) |
|
||||
| `cargo-target/` | Pre-compiled Rust build artifacts (`CARGO_TARGET_DIR`), kept outside checkouts so `actions/checkout` cleanup does not wipe it |
|
||||
| `cargo/` | Cargo crate registry and git cache (`CARGO_HOME`) |
|
||||
| `rustup/` | Installed Rust toolchains (`RUSTUP_HOME`) |
|
||||
| `pnpm-store/` | Content-addressable `pnpm` store on the same filesystem as `work/` for fast hardlinks into `node_modules` |
|
||||
| `toolcache/` | Tools cached by `actions/setup-*` (`/opt/hostedtoolcache`) |
|
||||
| `cache/` | General `/home/runner/.cache` directory |
|
||||
|
||||
All slots also share `/persist/shared/npm-cache` for downloaded npm tarballs.
|
||||
|
||||
## Prerequisites (First-Time Registration Only)
|
||||
|
||||
Ask a repository admin to generate **one** 1-hour registration token from:
|
||||
|
||||
> **GitHub Repository → Settings → Actions → Runners → New self-hosted runner**
|
||||
|
||||
A single registration token can register multiple runner slots within its 1-hour validity window. Once registered, each slot saves its own runner credentials and reconnects across restarts without needing a token again.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Run all commands from `scripts/selfhost-runner/`:
|
||||
|
||||
1. **Initial registration** (registers slots `1..4` and saves credentials):
|
||||
|
||||
```bash
|
||||
RUNNER_TOKEN=<one-time-token> docker compose up -d
|
||||
```
|
||||
|
||||
2. **Normal start, restart, or recreate** (no token needed once slots are registered):
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
docker compose restart
|
||||
```
|
||||
|
||||
3. **Scale down** (for example `4` → `2`):
|
||||
|
||||
```bash
|
||||
RUNNER_COUNT=2 docker compose up -d
|
||||
```
|
||||
|
||||
Docker Compose does not guarantee which container replicas it removes, so scaling `4` → `2` may leave slots `3` and `4` running rather than `1` and `2`. Stopped slots keep their saved credentials and caches on disk and will be reclaimed on the next restart or scale-up.
|
||||
|
||||
4. **Scale up** (for example `4` → `6`):
|
||||
|
||||
- If slots `5..6` were previously registered:
|
||||
|
||||
```bash
|
||||
RUNNER_COUNT=6 docker compose up -d
|
||||
```
|
||||
|
||||
- If slots `5..6` have never been registered:
|
||||
|
||||
```bash
|
||||
RUNNER_COUNT=6 RUNNER_TOKEN=<new-token> docker compose up -d
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
You can pass variables on the command line or place them in a local `.env` file in this directory (git-ignored):
|
||||
|
||||
| Variable | Default | Description |
|
||||
| -------------------- | ------------------------------------- | ---------------------------------------------------------------------- |
|
||||
| `RUNNER_COUNT` | `4` | Number of concurrent runner replicas |
|
||||
| `RUNNER_NAME_PREFIX` | `openidea-runner` | Runner name prefix; registers as `<prefix>-1`, `<prefix>-2`, … |
|
||||
| `RUNNER_LABELS` | `openidea-selfhosted` | Comma-separated labels attached to each runner |
|
||||
| `REPO_URL` | `https://github.com/l0ng-ai/openidea` | Target GitHub repository URL |
|
||||
| `RUNNER_TOKEN` | _(empty)_ | One-time registration token (required only when registering new slots) |
|
||||
|
||||
## Troubleshooting & Tips
|
||||
|
||||
- **Offline expiry (> 14 days) or deleted runner:** GitHub automatically removes runners that stay offline for more than 14 days. To clear a stale slot `<N>` and re-register it:
|
||||
|
||||
```bash
|
||||
docker compose run --rm --entrypoint /bin/bash github-runner \
|
||||
-c "rm -rf /persist/slot-<N>/runner-data/*"
|
||||
RUNNER_TOKEN=<new-token> docker compose up -d
|
||||
```
|
||||
|
||||
- **Full reset** (wipes all saved runner credentials and cached build artifacts):
|
||||
|
||||
```bash
|
||||
docker compose down -v
|
||||
```
|
||||
|
||||
- **Workflow caching tips:** `CARGO_TARGET_DIR` persists automatically across runs; CI enables incremental compilation on these runners and clears a slot's target directory once it exceeds 40 GB. To also preserve in-repo `node_modules/` across runs without re-linking, pass `clean: false` to `actions/checkout` (otherwise `pnpm install` quickly re-hardlinks packages from `pnpm-store/`).
|
||||
@@ -0,0 +1,70 @@
|
||||
# Self-hosted GitHub Actions runners (persistent & scalable).
|
||||
# See README.md in this directory for setup, security constraints, scaling, and troubleshooting.
|
||||
|
||||
services:
|
||||
github-runner:
|
||||
image: myoung34/github-runner:2.338.2-ubuntu-jammy@sha256:9944eb7fe15cff8f31ce6389a1cd39f5fb32627f56bdfa8a21fb27e56e99fa1a
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
replicas: ${RUNNER_COUNT:-4}
|
||||
|
||||
environment:
|
||||
RUNNER_SCOPE: repo
|
||||
REPO_URL: ${REPO_URL:-https://github.com/l0ng-ai/openidea}
|
||||
# Only needed the first time a new slot registers; registered slots reuse saved credentials.
|
||||
RUNNER_TOKEN: ${RUNNER_TOKEN:-}
|
||||
RUNNER_NAME_PREFIX: ${RUNNER_NAME_PREFIX:-openidea-runner}
|
||||
LABELS: ${RUNNER_LABELS:-openidea-selfhosted}
|
||||
DISABLE_AUTOMATIC_DEREGISTRATION: "true"
|
||||
RUN_AS_ROOT: "false"
|
||||
|
||||
# Claim an exclusive numeric slot (1..N) via flock so each replica gets its own
|
||||
# persistent runner credentials, workspace, Cargo target/home, rustup, pnpm store, and toolcache.
|
||||
entrypoint:
|
||||
- /bin/bash
|
||||
- -ec
|
||||
- |
|
||||
mkdir -p /persist/slots /persist/shared/npm-cache /home/runner
|
||||
SLOT=1
|
||||
while true; do
|
||||
exec 99>"/persist/slots/slot-$${SLOT}.lock"
|
||||
if flock -n 99; then break; fi
|
||||
SLOT=$$((SLOT + 1))
|
||||
done
|
||||
SLOT_DIR="/persist/slot-$${SLOT}"
|
||||
mkdir -p "$${SLOT_DIR}"/{runner-data,work,cargo,cargo-target,rustup,pnpm-store,cache,toolcache}
|
||||
if [[ ! -f "$${SLOT_DIR}/runner-data/.runner" && -z "$${RUNNER_TOKEN:-}" ]]; then
|
||||
echo "ERROR: Slot $${SLOT} ($${RUNNER_NAME_PREFIX:-openidea-runner}-$${SLOT}) is not registered yet; set RUNNER_TOKEN to register it." >&2
|
||||
exit 1
|
||||
fi
|
||||
RUNNER_UID="$$(id -u runner)"
|
||||
RUNNER_GID="$$(id -g runner)"
|
||||
if [[ "$$(stat -c '%u' /persist/shared/npm-cache)" != "$${RUNNER_UID}" ]]; then
|
||||
chown -R "$${RUNNER_UID}:$${RUNNER_GID}" /persist/shared/npm-cache
|
||||
fi
|
||||
if [[ "$$(stat -c '%u' "$${SLOT_DIR}")" != "$${RUNNER_UID}" ]]; then
|
||||
chown -R "$${RUNNER_UID}:$${RUNNER_GID}" "$${SLOT_DIR}"
|
||||
fi
|
||||
chown "$${RUNNER_UID}:$${RUNNER_GID}" /persist/shared "$${SLOT_DIR}" "$${SLOT_DIR}"/{runner-data,work,cargo,cargo-target,rustup,pnpm-store,cache,toolcache}
|
||||
rm -rf /opt/hostedtoolcache /home/runner/.cache
|
||||
ln -s "$${SLOT_DIR}/toolcache" /opt/hostedtoolcache
|
||||
ln -s "$${SLOT_DIR}/cache" /home/runner/.cache
|
||||
chown -h "$${RUNNER_UID}:$${RUNNER_GID}" /opt/hostedtoolcache /home/runner/.cache
|
||||
export CONFIGURED_ACTIONS_RUNNER_FILES_DIR="$${SLOT_DIR}/runner-data"
|
||||
export RUNNER_NAME="$${RUNNER_NAME_PREFIX:-openidea-runner}-$${SLOT}"
|
||||
export RUNNER_WORKDIR="$${SLOT_DIR}/work"
|
||||
export CARGO_HOME="$${SLOT_DIR}/cargo"
|
||||
export RUSTUP_HOME="$${SLOT_DIR}/rustup"
|
||||
export CARGO_TARGET_DIR="$${SLOT_DIR}/cargo-target"
|
||||
export npm_config_store_dir="$${SLOT_DIR}/pnpm-store"
|
||||
export npm_config_cache="/persist/shared/npm-cache"
|
||||
export PATH="$${CARGO_HOME}/bin:$${PATH}"
|
||||
exec /entrypoint.sh "$$@"
|
||||
- --
|
||||
command: ["./bin/Runner.Listener", "run", "--startuptype", "service"]
|
||||
|
||||
volumes:
|
||||
- runner-persist:/persist
|
||||
|
||||
volumes:
|
||||
runner-persist:
|
||||
@@ -161,34 +161,51 @@
|
||||
padding: 14px;
|
||||
}
|
||||
.scope {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-0-5);
|
||||
container: analysis-scope / inline-size;
|
||||
min-inline-size: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
.scopeOptions {
|
||||
display: grid;
|
||||
grid-template-columns: fit-content(45%) minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: var(--space-0-5) var(--space-2);
|
||||
}
|
||||
.fieldLabel {
|
||||
padding: 0 0 4px;
|
||||
color: var(--fg-secondary);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
.radioRow {
|
||||
grid-column: 1 / -1;
|
||||
min-width: 0;
|
||||
padding-block: var(--space-0-5);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.scopeWithField {
|
||||
grid-column: 1;
|
||||
}
|
||||
.scopeControl {
|
||||
grid-column: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
padding: 3px 0;
|
||||
color: var(--fg);
|
||||
cursor: default;
|
||||
}
|
||||
.radioRow input {
|
||||
margin: 0;
|
||||
accent-color: var(--accent);
|
||||
}
|
||||
.dirRow {
|
||||
display: flex;
|
||||
gap: var(--space-1-5);
|
||||
padding: 4px 0 0 22px;
|
||||
min-width: 0;
|
||||
}
|
||||
.scopeControl > button:last-child {
|
||||
flex: none;
|
||||
}
|
||||
@container analysis-scope (max-width: 336px) {
|
||||
.scopeOptions {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.scopeControl {
|
||||
grid-column: 1;
|
||||
padding-inline-start: calc(16px + var(--space-2));
|
||||
margin-block-end: var(--space-1);
|
||||
}
|
||||
}
|
||||
.grow {
|
||||
flex: 1;
|
||||
@@ -214,21 +231,39 @@
|
||||
flex: 1 1 12ch;
|
||||
min-width: 0;
|
||||
}
|
||||
.templateSection {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-1);
|
||||
color: var(--fg);
|
||||
font-size: var(--fs-ui);
|
||||
}
|
||||
.templateHeader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
.languageSelect {
|
||||
min-width: 180px;
|
||||
max-width: 50%;
|
||||
}
|
||||
.template {
|
||||
width: 100%;
|
||||
min-height: 96px;
|
||||
height: clamp(96px, 24vh, 150px);
|
||||
min-height: 50px;
|
||||
resize: vertical;
|
||||
padding: 6px 8px;
|
||||
padding: var(--space-1-5) var(--space-2);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-control);
|
||||
background: var(--bg-input);
|
||||
background: var(--bg-editor);
|
||||
color: var(--fg-editor);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-code);
|
||||
line-height: 1.5;
|
||||
line-height: var(--lh-code);
|
||||
}
|
||||
.replaceForm .template {
|
||||
/* Leave room for the scope and dialog controls when both templates are shown. */
|
||||
height: clamp(96px, calc(50vh - 205px), 150px);
|
||||
}
|
||||
.template:focus {
|
||||
outline: none;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/** Inspect Code, Locate Duplicates and Search / Replace Structurally dialogs. */
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import clsx from "clsx";
|
||||
import {
|
||||
call,
|
||||
commands,
|
||||
@@ -10,6 +11,8 @@ import {
|
||||
type WorkspaceEdit,
|
||||
} from "@/platform/ipc";
|
||||
import { executeAction } from "@/platform/actions";
|
||||
import { editorPrefs } from "@/platform/editorSettings";
|
||||
import { monoFontFamily } from "@/platform/fonts";
|
||||
import { activeProfileId, listProfiles, validateInspections, type ProfileId } from "@/platform/inspections";
|
||||
import { basename, relativePath, useProject } from "@/platform/project";
|
||||
import { Button, Checkbox, Dialog, Input, Select, Spinner, T } from "@/ui";
|
||||
@@ -319,6 +322,15 @@ function StructuralDialog({ replace, onClose }: { replace: boolean; onClose: ()
|
||||
const [form, setForm] = useState<StructuralForm>(loadStructuralForm);
|
||||
const [scope, setScope] = useState<ScopeChoice>(() => defaultScope());
|
||||
const [busy, setBusy] = useState(false);
|
||||
const settings = useProject((s) => s.settings);
|
||||
const font = settings?.editor;
|
||||
const fallback = editorPrefs(settings).fallbackFont;
|
||||
const templateFont = {
|
||||
fontFamily:
|
||||
font?.fontFamily || fallback ? monoFontFamily(font?.fontFamily, fallback, "var(--font-mono)") : undefined,
|
||||
fontSize: font?.fontSize ?? undefined,
|
||||
lineHeight: font?.lineHeight != null ? `${font.lineHeight}px` : undefined,
|
||||
};
|
||||
const languages = useStructuralLanguages();
|
||||
// The editor's language when it has a grammar, else the first supported one.
|
||||
const language =
|
||||
@@ -357,47 +369,49 @@ function StructuralDialog({ replace, onClose }: { replace: boolean; onClose: ()
|
||||
{ label: "Cancel", role: "cancel" },
|
||||
]}
|
||||
>
|
||||
<div className={styles.form}>
|
||||
<div className={styles.fieldRow}>
|
||||
<span>
|
||||
<T>Language</T>
|
||||
</span>
|
||||
<Select
|
||||
value={language || null}
|
||||
options={options}
|
||||
onChange={(language) => setForm({ ...form, language })}
|
||||
placeholder={languages ? "No languages" : "Loading…"}
|
||||
className={styles.languageSelect}
|
||||
aria-label="Language"
|
||||
<div className={clsx(styles.form, replace && styles.replaceForm)}>
|
||||
<div className={styles.templateSection}>
|
||||
<div className={styles.templateHeader}>
|
||||
<label htmlFor="ssr-template">
|
||||
<T>Search template</T>
|
||||
</label>
|
||||
<Select
|
||||
value={language || null}
|
||||
options={options}
|
||||
onChange={(language) => setForm({ ...form, language })}
|
||||
placeholder={languages ? "No languages" : "Loading…"}
|
||||
className={styles.languageSelect}
|
||||
variant="ghost"
|
||||
aria-label="Language"
|
||||
/>
|
||||
</div>
|
||||
<textarea
|
||||
id="ssr-template"
|
||||
className={styles.template}
|
||||
style={templateFont}
|
||||
spellCheck={false}
|
||||
value={form.pattern}
|
||||
placeholder="$a$.equals($b$)"
|
||||
onChange={(e) => setForm({ ...form, pattern: e.target.value })}
|
||||
data-autofocus=""
|
||||
/>
|
||||
{error && <div className={styles.error}>{error}</div>}
|
||||
</div>
|
||||
<label className={styles.fieldLabel} htmlFor="ssr-template">
|
||||
<T>Search template</T>
|
||||
</label>
|
||||
<textarea
|
||||
id="ssr-template"
|
||||
className={styles.template}
|
||||
spellCheck={false}
|
||||
value={form.pattern}
|
||||
placeholder="$a$.equals($b$)"
|
||||
onChange={(e) => setForm({ ...form, pattern: e.target.value })}
|
||||
data-autofocus=""
|
||||
/>
|
||||
{error && <div className={styles.error}>{error}</div>}
|
||||
{replace && (
|
||||
<>
|
||||
<label className={styles.fieldLabel} htmlFor="ssr-replacement">
|
||||
<div className={styles.templateSection}>
|
||||
<label htmlFor="ssr-replacement">
|
||||
<T>Replace template</T>
|
||||
</label>
|
||||
<textarea
|
||||
id="ssr-replacement"
|
||||
className={styles.template}
|
||||
style={templateFont}
|
||||
spellCheck={false}
|
||||
value={form.replacement}
|
||||
placeholder="Objects.equals($a$, $b$)"
|
||||
onChange={(e) => setForm({ ...form, replacement: e.target.value })}
|
||||
/>
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.hint}>
|
||||
<T>Placeholders:</T> <code>$name$</code> or <code>$NAME</code> <T>match one node,</T> <code>$$$NAME</code>{" "}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/** Dialog stack of the analysis feature and the shared "Specify Scope" fields. */
|
||||
import { Fragment, type ReactNode } from "react";
|
||||
import clsx from "clsx";
|
||||
import { create } from "zustand";
|
||||
import { executeAction } from "@/platform/actions";
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { isTauri } from "@/platform/ipc";
|
||||
import { EDIT_SCOPES_ACTION, useCustomScopeList } from "@/platform/search";
|
||||
import { Button, IconButton, Input, Select, T } from "@/ui";
|
||||
import { Button, IconButton, Input, Radio, Select, T } from "@/ui";
|
||||
import { SCOPE_LABELS, currentFile, type ScopeChoice, type ScopeKind } from "./scope";
|
||||
import styles from "./Analysis.module.css";
|
||||
|
||||
@@ -62,57 +63,69 @@ export function ScopeFields({
|
||||
}) {
|
||||
const file = currentFile();
|
||||
const scopes = useCustomScopeList();
|
||||
const custom = value.custom ?? scopes[0]?.name;
|
||||
return (
|
||||
<fieldset className={styles.scope}>
|
||||
<legend className={styles.fieldLabel}>
|
||||
<T>Scope</T>
|
||||
</legend>
|
||||
{kinds.map((kind) => (
|
||||
<label key={kind} className={styles.radioRow}>
|
||||
<input
|
||||
type="radio"
|
||||
name={name}
|
||||
checked={value.kind === kind}
|
||||
disabled={kind === "file" && !file}
|
||||
onChange={() =>
|
||||
onChange({ ...value, kind, custom: kind === "custom" ? (value.custom ?? scopes[0]?.name) : value.custom })
|
||||
}
|
||||
/>
|
||||
<span>{kind === "file" && file ? tx`File '${file.split("/").pop()}'` : tx(SCOPE_LABELS[kind])}</span>
|
||||
</label>
|
||||
))}
|
||||
{value.kind === "directory" && (
|
||||
<div className={styles.dirRow}>
|
||||
<Input
|
||||
aria-label="Directory"
|
||||
value={value.directory}
|
||||
onChange={(e) => onChange({ ...value, directory: e.target.value })}
|
||||
className={styles.grow}
|
||||
/>
|
||||
<Button
|
||||
onClick={() => void browseDirectory(value.directory).then((d) => d && onChange({ ...value, directory: d }))}
|
||||
>
|
||||
<T>Browse…</T>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
{value.kind === "custom" && (
|
||||
<div className={styles.dirRow}>
|
||||
<Select<string>
|
||||
className={styles.grow}
|
||||
value={value.custom ?? null}
|
||||
options={scopes.map((s) => ({ value: s.name, label: s.name, detail: s.pattern }))}
|
||||
placeholder="No custom scopes"
|
||||
onChange={(custom) => onChange({ ...value, custom })}
|
||||
aria-label="Custom scope"
|
||||
/>
|
||||
<IconButton
|
||||
icon="more-horizontal"
|
||||
title="Edit Scopes…"
|
||||
onClick={() => void executeAction(EDIT_SCOPES_ACTION, value.custom ? { select: value.custom } : undefined)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.scopeOptions}>
|
||||
{kinds.map((kind) => {
|
||||
const selected = value.kind === kind;
|
||||
return (
|
||||
<Fragment key={kind}>
|
||||
<Radio
|
||||
name={name}
|
||||
checked={selected}
|
||||
disabled={kind === "file" && !file}
|
||||
onChange={() => onChange({ ...value, kind, custom: kind === "custom" ? custom : value.custom })}
|
||||
label={
|
||||
kind === "file" && file ? <span>{tx`File '${file.split("/").pop()}'`}</span> : SCOPE_LABELS[kind]
|
||||
}
|
||||
className={clsx(styles.radioRow, (kind === "directory" || kind === "custom") && styles.scopeWithField)}
|
||||
/>
|
||||
{kind === "directory" && (
|
||||
<div className={styles.scopeControl}>
|
||||
<Input
|
||||
aria-label="Directory"
|
||||
value={value.directory}
|
||||
disabled={!selected}
|
||||
onChange={(e) => onChange({ ...value, directory: e.target.value })}
|
||||
className={styles.grow}
|
||||
/>
|
||||
<Button
|
||||
disabled={!selected}
|
||||
onClick={() =>
|
||||
void browseDirectory(value.directory).then((d) => d && onChange({ ...value, directory: d }))
|
||||
}
|
||||
>
|
||||
<T>Browse…</T>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
{kind === "custom" && (
|
||||
<div className={styles.scopeControl}>
|
||||
<Select<string>
|
||||
className={styles.grow}
|
||||
value={(selected ? value.custom : custom) ?? null}
|
||||
options={scopes.map((s) => ({ value: s.name, label: s.name, detail: s.pattern }))}
|
||||
placeholder={scopes.length ? "Choose a scope" : "No custom scopes"}
|
||||
disabled={!selected}
|
||||
onChange={(custom) => onChange({ ...value, custom })}
|
||||
aria-label="Custom scope"
|
||||
/>
|
||||
<IconButton
|
||||
icon="more-horizontal"
|
||||
title="Edit Scopes…"
|
||||
disabled={!selected}
|
||||
onClick={() => void executeAction(EDIT_SCOPES_ACTION, custom ? { select: custom } : undefined)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</fieldset>
|
||||
);
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
mavenRoots,
|
||||
nodeIcon,
|
||||
nodeLabel,
|
||||
pluginCoordinates,
|
||||
profileChecked,
|
||||
withGradleOptions,
|
||||
gradleHasTestTask,
|
||||
@@ -310,6 +311,8 @@ function NodeRow({ node, state }: { node: BuildNode; state: TreeRowState }) {
|
||||
</span>
|
||||
);
|
||||
}
|
||||
const plugin = node.kind === "plugin" ? node.plugin : null;
|
||||
const coordinates = plugin && `(${pluginCoordinates(plugin)})`;
|
||||
const detail =
|
||||
node.kind === "profiles" && node.projectRoot
|
||||
? node.projectRoot.split("/").pop()
|
||||
@@ -321,12 +324,24 @@ function NodeRow({ node, state }: { node: BuildNode; state: TreeRowState }) {
|
||||
const skipped =
|
||||
(mavenSkipTests && node.kind === "phase" && node.phase === "test") ||
|
||||
(gradleSkipTests && node.kind === "task" && node.task.name === "test");
|
||||
const label = (
|
||||
<span className={clsx(styles.label, state.selected && styles.selectedLabel, skipped && styles.skippedGoal)}>
|
||||
{plugin?.prefix ?? nodeLabel(node)}
|
||||
</span>
|
||||
);
|
||||
return (
|
||||
<span className={styles.row}>
|
||||
<Icon name={nodeIcon(node)} size={16} className={styles.icon} />
|
||||
<span className={clsx(styles.label, state.selected && styles.selectedLabel, skipped && styles.skippedGoal)}>
|
||||
{nodeLabel(node)}
|
||||
</span>
|
||||
{coordinates ? (
|
||||
<span className={styles.pluginText}>
|
||||
{label}
|
||||
<span className={styles.detail} title={coordinates}>
|
||||
{coordinates}
|
||||
</span>
|
||||
</span>
|
||||
) : (
|
||||
label
|
||||
)}
|
||||
{detail && <span className={styles.detail}>{detail}</span>}
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -96,6 +96,18 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.pluginText {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1-5);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.pluginText > .label {
|
||||
flex: none;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
.profile {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ export function dependencyLabel(d: MavenDependency): string {
|
||||
return parts.join(":");
|
||||
}
|
||||
|
||||
export function pluginLabel(p: MavenPlugin): string {
|
||||
return `${p.prefix} (${p.groupId}:${p.artifactId}${p.version ? `:${p.version}` : ""})`;
|
||||
export function pluginCoordinates(p: MavenPlugin): string {
|
||||
return `${p.groupId}:${p.artifactId}${p.version ? `:${p.version}` : ""}`;
|
||||
}
|
||||
|
||||
/** Profile choices in different workspace members are independent. */
|
||||
@@ -363,7 +363,7 @@ export function nodeLabel(node: BuildNode): string {
|
||||
case "plugins":
|
||||
return tx("Plugins");
|
||||
case "plugin":
|
||||
return pluginLabel(node.plugin);
|
||||
return `${node.plugin.prefix} (${pluginCoordinates(node.plugin)})`;
|
||||
case "goal":
|
||||
return `${node.plugin.prefix}:${node.goal}`;
|
||||
case "dependencies":
|
||||
|
||||
@@ -241,7 +241,8 @@ describe("MemoryView", () => {
|
||||
expect(screen.getByRole("button", { name: "刷新内存视图" }).getAttribute("data-tooltip")).toBe("刷新内存视图");
|
||||
const filter = screen.getByRole("textbox", { name: "筛选类" });
|
||||
expect(filter.getAttribute("placeholder")).toBe("筛选类");
|
||||
expect(screen.getByRole("checkbox", { name: "仅显示有变化的" })).toBeTruthy();
|
||||
fireEvent.click(screen.getByRole("button", { name: "视图选项" }));
|
||||
expect(screen.getByRole("menuitemcheckbox", { name: "仅显示有变化的" })).toBeInTheDocument();
|
||||
} finally {
|
||||
await setLocale("en");
|
||||
}
|
||||
@@ -299,10 +300,15 @@ describe("MemoryView", () => {
|
||||
expect(screen.getByText("Cache$Entry")).toBeTruthy();
|
||||
|
||||
fireEvent.change(screen.getByRole("textbox", { name: "Filter classes" }), { target: { value: "" } });
|
||||
fireEvent.click(screen.getByRole("checkbox", { name: "Changed only" }));
|
||||
const options = screen.getByRole("button", { name: "View Options" });
|
||||
fireEvent.click(options);
|
||||
fireEvent.click(screen.getByRole("menuitemcheckbox", { name: "Changed only", checked: false }));
|
||||
expect(screen.getByText("Heap$Live")).toBeTruthy();
|
||||
expect(screen.queryByText("Cache$Entry")).toBeNull();
|
||||
expect(screen.queryByText("Dup")).toBeNull();
|
||||
expect(options).toHaveAttribute("aria-pressed", "true");
|
||||
fireEvent.click(options);
|
||||
expect(screen.getByRole("menuitemcheckbox", { name: "Changed only", checked: true })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("sorts by the clicked column and reports it with aria-sort", async () => {
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
}
|
||||
|
||||
.filter {
|
||||
flex: 0 1 240px;
|
||||
min-width: 80px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.banner,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Memory tab of the Debug tool window: live instance counts per class of the debugged JVM, and heap capture. */
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import clsx from "clsx";
|
||||
import { Checkbox, Icon, IconButton, Input, List, T } from "@/ui";
|
||||
import { Icon, IconButton, List, Menu, SearchField, T } from "@/ui";
|
||||
import { executeAction } from "@/platform/actions";
|
||||
import { useTx } from "@/platform/i18n";
|
||||
import type { JvmClassRow, JvmMemorySnapshot } from "@/platform/ipc";
|
||||
@@ -112,6 +112,8 @@ export function MemoryView({ session }: { session: DebugSession }) {
|
||||
const id = session.id;
|
||||
const entry = useMemory((s) => s.bySession[id]);
|
||||
const query = entry?.query ?? DEFAULT_QUERY;
|
||||
const optionsButton = useRef<HTMLButtonElement>(null);
|
||||
const [optionsOpen, setOptionsOpen] = useState(false);
|
||||
const result = entry?.result ?? null;
|
||||
const snapshot = entry?.snapshot ?? null;
|
||||
const source = snapshot?.source ?? "histogram";
|
||||
@@ -161,17 +163,37 @@ export function MemoryView({ session }: { session: DebugSession }) {
|
||||
disabled={entry?.loading || !canRefresh}
|
||||
/>
|
||||
<HeapCaptureButton session={session} />
|
||||
<Input
|
||||
<SearchField
|
||||
className={styles.filter}
|
||||
value={query.filter}
|
||||
onChange={(e) => setMemoryQuery(id, { filter: e.target.value })}
|
||||
onChange={(filter) => setMemoryQuery(id, { filter })}
|
||||
placeholder="Filter classes"
|
||||
aria-label="Filter classes"
|
||||
/>
|
||||
<Checkbox
|
||||
checked={query.changedOnly}
|
||||
onChange={(changedOnly) => setMemoryQuery(id, { changedOnly })}
|
||||
label="Changed only"
|
||||
<IconButton
|
||||
ref={optionsButton}
|
||||
icon="settings"
|
||||
title="View Options"
|
||||
size="small"
|
||||
iconSize={16}
|
||||
pressed={query.changedOnly}
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={optionsOpen}
|
||||
onClick={() => setOptionsOpen(!optionsOpen)}
|
||||
/>
|
||||
<Menu
|
||||
open={optionsOpen}
|
||||
onClose={() => setOptionsOpen(false)}
|
||||
anchor={optionsButton}
|
||||
placement="bottom-end"
|
||||
aria-label="View Options"
|
||||
items={[
|
||||
{
|
||||
label: "Changed only",
|
||||
checked: query.changedOnly,
|
||||
run: () => setMemoryQuery(id, { changedOnly: !query.changedOnly }),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
{backend && (
|
||||
|
||||
@@ -12,11 +12,6 @@ export function isTableType(typeName: string | null | undefined): boolean {
|
||||
return !!typeName && TABLE_TYPES.has(typeName);
|
||||
}
|
||||
|
||||
/** Numbers are right-aligned, as in the database grid. */
|
||||
export function isNumericDtype(dtype: string | undefined): boolean {
|
||||
return !!dtype && /^(u?int|float|complex|Int|UInt|Float)\d*$/.test(dtype);
|
||||
}
|
||||
|
||||
export const ROW_PAGE = 100;
|
||||
export const COLUMN_PAGE = 30;
|
||||
|
||||
|
||||
@@ -1,39 +1,35 @@
|
||||
.dialog {
|
||||
height: clamp(320px, 60vh, 760px);
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
/* The table scrolls under a fixed bar, not the whole dialog body. */
|
||||
/* Scroll only the grid between the toolbar and the expression field. */
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
padding: var(--space-2) var(--space-3) 0;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.bar {
|
||||
flex: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
padding-bottom: var(--space-2);
|
||||
justify-content: space-between;
|
||||
gap: var(--space-1) var(--space-2);
|
||||
}
|
||||
|
||||
.expression {
|
||||
flex: 1 1 200px;
|
||||
min-width: 0;
|
||||
height: var(--h-list-row);
|
||||
padding: 0 6px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-ui);
|
||||
color: var(--fg);
|
||||
background: var(--bg-input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-small);
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.expression:focus {
|
||||
outline: none;
|
||||
border-color: var(--focus-ring);
|
||||
.pagers {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1) var(--space-2);
|
||||
}
|
||||
|
||||
.summary,
|
||||
@@ -59,7 +55,8 @@
|
||||
.table {
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
font-family: var(--font-mono);
|
||||
min-width: 100%;
|
||||
font-family: var(--font-ui);
|
||||
font-size: var(--fs-ui);
|
||||
color: var(--fg);
|
||||
}
|
||||
@@ -77,7 +74,7 @@
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
text-align: left;
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
color: var(--fg-secondary);
|
||||
background: var(--bg-island);
|
||||
@@ -86,7 +83,8 @@
|
||||
.table .index {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
text-align: right;
|
||||
text-align: center;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-weight: normal;
|
||||
color: var(--fg-secondary);
|
||||
background: var(--bg-island);
|
||||
@@ -100,16 +98,22 @@
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.numeric {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.dtype {
|
||||
margin-left: var(--space-1);
|
||||
color: var(--fg-subtle);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
|
||||
.message {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: var(--space-3) 0;
|
||||
color: var(--fg-secondary);
|
||||
}
|
||||
|
||||
.error {
|
||||
max-height: 5em;
|
||||
overflow: auto;
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--danger);
|
||||
}
|
||||
@@ -1,19 +1,10 @@
|
||||
/** View as Table: a DataFrame / Series / ndarray of the paused frame, one page of rows and columns at a time. */
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import clsx from "clsx";
|
||||
import type { DebugSessionId } from "@/platform/ipc";
|
||||
import { Dialog, IconButton } from "@/ui";
|
||||
import { Dialog, IconButton, Input } from "@/ui";
|
||||
import { formatMessage, tx } from "@/platform/i18n";
|
||||
import { evaluate, useDebug } from "../state";
|
||||
import {
|
||||
COLUMN_PAGE,
|
||||
ROW_PAGE,
|
||||
clampWindow,
|
||||
isNumericDtype,
|
||||
parseTableResult,
|
||||
tableExpression,
|
||||
type TableResult,
|
||||
} from "../tableView";
|
||||
import { COLUMN_PAGE, ROW_PAGE, clampWindow, parseTableResult, tableExpression, type TableResult } from "../tableView";
|
||||
import styles from "./TableViewDialog.module.css";
|
||||
|
||||
export function TableViewDialog({
|
||||
@@ -63,7 +54,7 @@ export function TableViewDialog({
|
||||
};
|
||||
}, [expression, win, session, stops, frame, paused]);
|
||||
|
||||
const page = result && "page" in result ? result.page : null;
|
||||
const page = paused && result && "page" in result ? result.page : null;
|
||||
const error = !paused
|
||||
? tx("Values are available while the program is paused")
|
||||
: result && "error" in result
|
||||
@@ -114,54 +105,37 @@ export function TableViewDialog({
|
||||
open
|
||||
onClose={onClose}
|
||||
// An element, not a string: Dialog would translate a variable named like a catalog text ("tasks").
|
||||
title={<span>{initial}</span>}
|
||||
width="clamp(520px, 70vw, 1100px)"
|
||||
title={<span>{expression}</span>}
|
||||
width={700}
|
||||
minWidth={420}
|
||||
minHeight={260}
|
||||
resizable="both"
|
||||
aria-label={formatMessage(tx("Table view of {label}"), { label: initial })}
|
||||
aria-label={formatMessage(tx("Table view of {label}"), { label: expression })}
|
||||
buttons={[{ label: "Close", role: "cancel" }]}
|
||||
className={styles.dialog}
|
||||
>
|
||||
<div className={styles.content}>
|
||||
<div className={styles.bar}>
|
||||
<input
|
||||
className={styles.expression}
|
||||
value={draft}
|
||||
spellCheck={false}
|
||||
autoComplete="off"
|
||||
aria-label={tx("Expression")}
|
||||
onChange={(e) => setDraft(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key !== "Enter" || !draft.trim()) return;
|
||||
e.preventDefault();
|
||||
setExpression(draft.trim());
|
||||
setWin({ row: 0, column: 0 });
|
||||
}}
|
||||
/>
|
||||
{page && (
|
||||
{page && (
|
||||
<div className={styles.bar}>
|
||||
<span className={styles.summary}>
|
||||
{formatMessage(tx("Shape ({shape})"), { shape: page.shape.join(", ") })}
|
||||
{page.kind !== "frame" ? ` · ${page.dtypes[0]}` : ""}
|
||||
</span>
|
||||
)}
|
||||
{page &&
|
||||
pager(win.row, ROW_PAGE, page.rows, (row) => setWin({ ...win, row }), {
|
||||
range: tx("Rows {from}–{to} of {total}"),
|
||||
previous: tx("Previous Rows"),
|
||||
next: tx("Next Rows"),
|
||||
})}
|
||||
{page &&
|
||||
pager(win.column, COLUMN_PAGE, page.columns, (column) => setWin({ ...win, column }), {
|
||||
range: tx("Columns {from}–{to} of {total}"),
|
||||
previous: tx("Previous Columns"),
|
||||
next: tx("Next Columns"),
|
||||
})}
|
||||
</div>
|
||||
{error ? (
|
||||
<div className={styles.message} role="alert">
|
||||
{error}
|
||||
<div className={styles.pagers}>
|
||||
{pager(win.row, ROW_PAGE, page.rows, (row) => setWin({ ...win, row }), {
|
||||
range: tx("Rows {from}–{to} of {total}"),
|
||||
previous: tx("Previous Rows"),
|
||||
next: tx("Next Rows"),
|
||||
})}
|
||||
{pager(win.column, COLUMN_PAGE, page.columns, (column) => setWin({ ...win, column }), {
|
||||
range: tx("Columns {from}–{to} of {total}"),
|
||||
previous: tx("Previous Columns"),
|
||||
next: tx("Next Columns"),
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
) : page ? (
|
||||
)}
|
||||
{page ? (
|
||||
<div className={styles.scroll} tabIndex={0} role="region" aria-label={tx("Table")}>
|
||||
<table className={styles.table}>
|
||||
<thead>
|
||||
@@ -182,14 +156,7 @@ export function TableViewDialog({
|
||||
{page.index[r]}
|
||||
</th>
|
||||
{row.map((cell, c) => (
|
||||
<td
|
||||
key={c}
|
||||
className={clsx(
|
||||
isNumericDtype(page.kind === "frame" ? page.dtypes[c] : page.dtypes[0]) && styles.numeric,
|
||||
)}
|
||||
>
|
||||
{cell}
|
||||
</td>
|
||||
<td key={c}>{cell}</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
@@ -197,7 +164,26 @@ export function TableViewDialog({
|
||||
</table>
|
||||
</div>
|
||||
) : (
|
||||
<div className={styles.message}>{tx("Loading…")}</div>
|
||||
<div className={styles.message}>{!error && tx("Loading…")}</div>
|
||||
)}
|
||||
<Input
|
||||
className={styles.expression}
|
||||
mono
|
||||
data-autofocus=""
|
||||
value={draft}
|
||||
aria-label="Expression"
|
||||
onChange={(e) => setDraft(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key !== "Enter" || !draft.trim()) return;
|
||||
e.preventDefault();
|
||||
setExpression(draft.trim());
|
||||
setWin({ row: 0, column: 0 });
|
||||
}}
|
||||
/>
|
||||
{error && (
|
||||
<div className={styles.error} role="alert">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useState } from "react";
|
||||
import { create } from "zustand";
|
||||
import { executeAction, getAction } from "@/platform/actions";
|
||||
import { t, tx } from "@/platform/i18n";
|
||||
import { BarButton, Button, Dialog, Icon, List, T } from "@/ui";
|
||||
import { BarButton, Dialog, Icon, IconButton, List, SplitGroup, SplitHandle, SplitPanel, T } from "@/ui";
|
||||
import { confirm } from "@/workbench/messages";
|
||||
import { promptInput } from "@/workbench/inputDialogs";
|
||||
import { deleteMacro, describeStep, renameMacro, useMacros } from "./model";
|
||||
@@ -80,37 +80,55 @@ function EditMacrosDialog({ onClose }: { onClose: () => void }) {
|
||||
buttons={[{ label: t("common.close"), role: "cancel" }]}
|
||||
>
|
||||
<div className={styles.edit}>
|
||||
<div className={styles.column}>
|
||||
<List
|
||||
items={saved}
|
||||
getKey={(m) => m.name}
|
||||
activeIndex={Math.min(active, saved.length - 1)}
|
||||
onActiveChange={setActive}
|
||||
className={styles.list}
|
||||
aria-label="Macros"
|
||||
empty={
|
||||
<div className={styles.empty}>
|
||||
<T>No saved macros</T>
|
||||
</div>
|
||||
}
|
||||
renderItem={(m) => <div className={styles.row}>{m.name}</div>}
|
||||
/>
|
||||
<div className={styles.buttons}>
|
||||
<Button disabled={!macro} onClick={() => void rename()}>
|
||||
<T>Rename…</T>
|
||||
</Button>
|
||||
<Button disabled={!macro} onClick={() => void remove()}>
|
||||
<T>Delete</T>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<ol className={styles.steps} aria-label={tx("Recorded steps")}>
|
||||
{macro?.steps.map((step, i) => (
|
||||
<li key={i} className={styles.step}>
|
||||
{describeStep(step, actionTitle)}
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
<SplitGroup orientation="horizontal" storageKey="openidea.macros.split" className={styles.panes}>
|
||||
<SplitPanel id="macro-list" defaultSize="50%" minSize="25%">
|
||||
<div className={styles.toolbar} role="toolbar" aria-label={tx("Macros")}>
|
||||
<IconButton
|
||||
icon="minus"
|
||||
title="Delete Macro"
|
||||
size="small"
|
||||
disabled={!macro}
|
||||
onClick={() => void remove()}
|
||||
/>
|
||||
<IconButton
|
||||
icon="edit"
|
||||
title="Rename Macro"
|
||||
size="small"
|
||||
disabled={!macro}
|
||||
onClick={() => void rename()}
|
||||
/>
|
||||
</div>
|
||||
<List
|
||||
items={saved}
|
||||
getKey={(m) => m.name}
|
||||
activeIndex={Math.min(active, saved.length - 1)}
|
||||
onActiveChange={setActive}
|
||||
autoFocus
|
||||
className={styles.list}
|
||||
aria-label="Macros"
|
||||
empty={
|
||||
<div className={styles.empty}>
|
||||
<T>No saved macros</T>
|
||||
</div>
|
||||
}
|
||||
renderItem={(m) => (
|
||||
<div className={styles.row} title={m.name}>
|
||||
{m.name}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</SplitPanel>
|
||||
<SplitHandle aria-label={tx("Macros")} />
|
||||
<SplitPanel id="macro-steps" defaultSize="50%" minSize="25%">
|
||||
<ol className={styles.steps} aria-label={tx("Recorded steps")}>
|
||||
{macro?.steps.map((step, i) => (
|
||||
<li key={i} className={styles.step}>
|
||||
{describeStep(step, actionTitle)}
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</SplitPanel>
|
||||
</SplitGroup>
|
||||
</div>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
@@ -8,23 +8,27 @@
|
||||
background: var(--danger);
|
||||
}
|
||||
.edit {
|
||||
display: grid;
|
||||
grid-template-columns: 220px 1fr;
|
||||
gap: var(--space-3);
|
||||
height: 300px;
|
||||
padding: 14px;
|
||||
}
|
||||
.column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
min-height: 0;
|
||||
height: 300px;
|
||||
padding: var(--space-3);
|
||||
}
|
||||
.panes {
|
||||
flex: 1;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-control);
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
gap: var(--space-0-5);
|
||||
padding: var(--space-1) var(--space-2);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-control);
|
||||
}
|
||||
.row {
|
||||
padding: 0 8px;
|
||||
@@ -32,27 +36,25 @@
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.buttons {
|
||||
display: flex;
|
||||
gap: var(--space-1-5);
|
||||
}
|
||||
.empty {
|
||||
padding: 6px 8px;
|
||||
color: var(--fg-subtle);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
.steps {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
padding: 6px 8px 6px 32px;
|
||||
padding: var(--space-2) var(--space-2) var(--space-2) 28px;
|
||||
overflow: auto;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-control);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-code);
|
||||
font-family: var(--font-ui);
|
||||
font-size: var(--fs-ui);
|
||||
color: var(--fg);
|
||||
}
|
||||
.step {
|
||||
line-height: 1.6;
|
||||
min-height: var(--h-row);
|
||||
padding-block: var(--space-0-5);
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
@@ -126,6 +126,9 @@
|
||||
.stackedRadioBlock {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
.stackedRadioBlock > .radioLabel {
|
||||
white-space: normal;
|
||||
}
|
||||
.stackedRadios {
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -136,6 +139,11 @@
|
||||
.stackedRadioBlock .radioLabel + .stackedRadios {
|
||||
padding-inline-start: calc(var(--space-4) + var(--space-1));
|
||||
}
|
||||
.tabOverflowChoices {
|
||||
align-items: flex-start;
|
||||
gap: var(--space-1);
|
||||
max-width: 100%;
|
||||
}
|
||||
.radio {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useEffect, useId, useState } from "react";
|
||||
import clsx from "clsx";
|
||||
import { commands, isTauri } from "@/platform/ipc";
|
||||
import { Checkbox, Icon, Radio, type IconName } from "@/ui";
|
||||
import { SearchLabel, Select } from "../../components/Form";
|
||||
import { Row, SearchLabel, Select } from "../../components/Form";
|
||||
import { useLabelMatch, useSearchQuery, useSetting } from "../../components/context";
|
||||
import { labelMatches } from "../../model/pages";
|
||||
import { editorPage } from "./kit";
|
||||
@@ -581,6 +581,7 @@ const TABS = editorPage({
|
||||
t: "radio",
|
||||
key: `${P}.tabs.closingPolicy`,
|
||||
label: "When the tab limit is reached",
|
||||
layout: "stacked",
|
||||
options: [
|
||||
{ value: "unchanged", label: "Close non-modified files first" },
|
||||
{ value: "lru", label: "Close least recently used files" },
|
||||
@@ -590,6 +591,7 @@ const TABS = editorPage({
|
||||
t: "radio",
|
||||
key: `${P}.tabs.activateOnClose`,
|
||||
label: "When the current tab is closed, activate",
|
||||
layout: "stacked",
|
||||
options: [
|
||||
{ value: "left", label: "The tab on the left" },
|
||||
{ value: "right", label: "The tab on the right" },
|
||||
@@ -607,10 +609,11 @@ function TabRows() {
|
||||
const [overflow, setOverflow] = useSetting<string>(`${P}.tabs.oneRowOverflow`);
|
||||
const [placement] = useSetting<string>(`${P}.tabs.placement`);
|
||||
const matched = useLabelMatch("Show tabs in:");
|
||||
const name = useId();
|
||||
const rowsName = useId();
|
||||
const overflowName = useId();
|
||||
// Vertical (left / right) tabs always scroll in one column.
|
||||
const disabled = placement === "none" || placement === "left" || placement === "right";
|
||||
const radio = (label: string, checked: boolean, onChange: () => void, off = disabled) => (
|
||||
const radio = (name: string, label: string, checked: boolean, onChange: () => void, off = disabled) => (
|
||||
<label className={clsx(styles.radio, off && styles.dim)}>
|
||||
<input type="radio" name={name} checked={checked} disabled={off} onChange={onChange} />
|
||||
<SearchLabel text={label} />
|
||||
@@ -618,30 +621,36 @@ function TabRows() {
|
||||
);
|
||||
return (
|
||||
<div
|
||||
className={clsx(styles.radioBlock, matched && styles.matched)}
|
||||
className={clsx(styles.radioBlock, styles.stackedRadioBlock, matched && styles.matched)}
|
||||
role="radiogroup"
|
||||
aria-label={tx("Show tabs in")}
|
||||
>
|
||||
<div className={clsx(styles.radioLabel, disabled && styles.dim)}>
|
||||
<SearchLabel text="Show tabs in" />:
|
||||
</div>
|
||||
<div className={styles.radios}>
|
||||
{radio("One row, and if tabs don't fit:", !multiple, () => setMultiple(false))}
|
||||
<div className={styles.children} role="radiogroup" aria-label={tx("If tabs don't fit")}>
|
||||
<div className={clsx(styles.radios, styles.stackedRadios)}>
|
||||
{radio(rowsName, "One row, and if tabs don't fit:", !multiple, () => setMultiple(false))}
|
||||
<div
|
||||
className={clsx(styles.children, styles.tabOverflowChoices)}
|
||||
role="radiogroup"
|
||||
aria-label={tx("If tabs don't fit")}
|
||||
>
|
||||
{radio(
|
||||
overflowName,
|
||||
"Scroll the tabs panel",
|
||||
!multiple && overflow !== "squeeze",
|
||||
overflow !== "squeeze",
|
||||
() => setOverflow("scroll"),
|
||||
disabled || multiple,
|
||||
)}
|
||||
{radio(
|
||||
overflowName,
|
||||
"Squeeze tabs",
|
||||
!multiple && overflow === "squeeze",
|
||||
overflow === "squeeze",
|
||||
() => setOverflow("squeeze"),
|
||||
disabled || multiple,
|
||||
)}
|
||||
</div>
|
||||
{radio("Multiple rows", multiple, () => setMultiple(true))}
|
||||
{radio(rowsName, "Multiple rows", multiple, () => setMultiple(true))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -657,12 +666,8 @@ const CLOSE_POSITIONS = [
|
||||
function CloseButtonPosition() {
|
||||
const [show, setShow] = useSetting<boolean>(`${P}.tabs.showCloseButton`);
|
||||
const [position, setPosition] = useSetting<string>(`${P}.tabs.closeButtonPosition`);
|
||||
const matched = useLabelMatch("Close button position:");
|
||||
return (
|
||||
<div className={clsx(styles.check, matched && styles.matched)}>
|
||||
<span>
|
||||
<SearchLabel text="Close button position:" />
|
||||
</span>
|
||||
<Row label="Close button position">
|
||||
<Select
|
||||
value={show ? (position === "left" ? "left" : "right") : "none"}
|
||||
options={CLOSE_POSITIONS}
|
||||
@@ -672,7 +677,7 @@ function CloseButtonPosition() {
|
||||
if (v !== "none") setPosition(v);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,33 @@
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
color: var(--fg);
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
font-size: var(--fs-ui);
|
||||
}
|
||||
.section {
|
||||
|
||||
.heading {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
margin-top: 6px;
|
||||
min-height: var(--h-field);
|
||||
margin: 0 0 var(--space-1);
|
||||
color: var(--fg-strong);
|
||||
font-size: inherit;
|
||||
font-weight: 500;
|
||||
}
|
||||
.header {
|
||||
color: var(--fg-muted);
|
||||
|
||||
.heading::after {
|
||||
content: "";
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: var(--border);
|
||||
}
|
||||
.columns {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
padding-left: 18px;
|
||||
|
||||
.options {
|
||||
display: grid;
|
||||
gap: var(--space-1);
|
||||
padding-inline-start: var(--space-4);
|
||||
}
|
||||
|
||||
.options > label {
|
||||
min-height: var(--h-field);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
/** Settings › Version Control › Log: how the Git Log shows references, dates and columns. */
|
||||
import { useId, type ReactNode } from "react";
|
||||
import { Checkbox, T } from "@/ui";
|
||||
import { setLogOptions, useLogOptions, type LogOptions } from "./logOptions";
|
||||
import styles from "./LogSettingsPage.module.css";
|
||||
import { tx } from "@/platform/i18n";
|
||||
|
||||
type Flag = { [K in keyof LogOptions]: LogOptions[K] extends boolean ? K : never }[keyof LogOptions];
|
||||
|
||||
@@ -21,6 +21,18 @@ const COLUMNS: { key: Flag; label: string }[] = [
|
||||
{ key: "showGitHubChecks", label: "GitHub Commit Checks" },
|
||||
];
|
||||
|
||||
function OptionGroup({ title, children }: { title: string; children: ReactNode }) {
|
||||
const heading = useId();
|
||||
return (
|
||||
<section aria-labelledby={heading}>
|
||||
<h2 id={heading} className={styles.heading}>
|
||||
<T>{title}</T>
|
||||
</h2>
|
||||
<div className={styles.options}>{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function LogSettingsPage() {
|
||||
const o = useLogOptions();
|
||||
// Display options only: the log needs no reload.
|
||||
@@ -29,13 +41,8 @@ export function LogSettingsPage() {
|
||||
);
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
{OPTIONS.map(flag)}
|
||||
<section className={styles.section} aria-label={tx("Visible columns")}>
|
||||
<div className={styles.header}>
|
||||
<T>Visible columns:</T>
|
||||
</div>
|
||||
<div className={styles.columns}>{COLUMNS.map(flag)}</div>
|
||||
</section>
|
||||
<OptionGroup title="View Options">{OPTIONS.map(flag)}</OptionGroup>
|
||||
<OptionGroup title="Visible columns">{COLUMNS.map(flag)}</OptionGroup>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -3707,5 +3707,7 @@
|
||||
"Previous Rows": "Previous Rows",
|
||||
"Next Rows": "Next Rows",
|
||||
"Previous Columns": "Previous Columns",
|
||||
"Next Columns": "Next Columns"
|
||||
"Next Columns": "Next Columns",
|
||||
"View Options": "View Options",
|
||||
"Visible columns": "Visible columns"
|
||||
}
|
||||
@@ -4751,7 +4751,6 @@
|
||||
"Show commit time rather than author time": "Mostrar fecha y hora de la confirmación en lugar de la del autor",
|
||||
"Show references on the left": "Mostrar referencias a la izquierda",
|
||||
"Visible columns": "Columnas visibles",
|
||||
"Visible columns:": "Columnas visibles:",
|
||||
"Get from Revision": "Obtener de la revisión",
|
||||
"Replace '{path}' with its content from the revision? Local changes to it are lost.": "¿Reemplazar '{path}' con su contenido de la revisión? Los cambios locales se perderán.",
|
||||
"Replace {length} files with their content from the revision? Local changes to them are lost.": "¿Reemplazar {length} archivos con su contenido de la revisión? Los cambios locales en ellos se perderán.",
|
||||
|
||||
@@ -4606,7 +4606,6 @@
|
||||
"Show commit time rather than author time": "Afficher l'heure du commit plutôt que celle de l'auteur",
|
||||
"Show references on the left": "Afficher les références à gauche",
|
||||
"Visible columns": "Colonnes visibles",
|
||||
"Visible columns:": "Colonnes visibles :",
|
||||
"Get from Revision": "Récupérer depuis la révision",
|
||||
"Replace '{path}' with its content from the revision? Local changes to it are lost.": "Remplacer '{path}' par son contenu de la révision ? Ses modifications locales seront perdues.",
|
||||
"Replace {length} files with their content from the revision? Local changes to them are lost.": "Remplacer {length} fichiers par leur contenu de la révision ? Leurs modifications locales seront perdues.",
|
||||
|
||||
@@ -4823,7 +4823,6 @@
|
||||
"Show commit time rather than author time": "작성자 시간 대신 커밋 시간 표시",
|
||||
"Show references on the left": "왼쪽에 참조 표시",
|
||||
"Visible columns": "표시할 열",
|
||||
"Visible columns:": "표시할 열:",
|
||||
"Get from Revision": "리비전에서 가져오기",
|
||||
"Replace '{path}' with its content from the revision? Local changes to it are lost.": "'{path}'을(를) 리비전의 내용으로 바꾸시겠습니까? 해당 파일의 로컬 변경 사항은 손실됩니다.",
|
||||
"Replace {length} files with their content from the revision? Local changes to them are lost.": "파일 {length}개를 리비전의 내용으로 바꾸시겠습니까? 해당 파일의 로컬 변경 사항은 손실됩니다.",
|
||||
|
||||
@@ -4702,7 +4702,6 @@
|
||||
"Show commit time rather than author time": "Pokaż czas zatwierdzenia zamiast czasu autora",
|
||||
"Show references on the left": "Pokaż odnośniki po lewej stronie",
|
||||
"Visible columns": "Widoczne kolumny",
|
||||
"Visible columns:": "Widoczne kolumny:",
|
||||
"Get from Revision": "Pobierz z wersji",
|
||||
"Replace '{path}' with its content from the revision? Local changes to it are lost.": "Zastąpić '{path}' zawartością z tej wersji? Lokalne zmiany w tym pliku zostaną utracone.",
|
||||
"Replace {length} files with their content from the revision? Local changes to them are lost.": "Zastąpić pliki w liczbie {length} ich zawartością z tej wersji? Lokalne zmiany w nich zostaną utracone.",
|
||||
|
||||
@@ -4717,7 +4717,6 @@
|
||||
"Show commit time rather than author time": "Mostrar data/hora do commit em vez da do autor",
|
||||
"Show references on the left": "Mostrar referências à esquerda",
|
||||
"Visible columns": "Colunas visíveis",
|
||||
"Visible columns:": "Colunas visíveis:",
|
||||
"Get from Revision": "Obter da revisão",
|
||||
"Replace '{path}' with its content from the revision? Local changes to it are lost.": "Substituir '{path}' pelo seu conteúdo da revisão? Alterações locais nele serão perdidas.",
|
||||
"Replace {length} files with their content from the revision? Local changes to them are lost.": "Substituir {length} arquivos pelo seu conteúdo da revisão? Alterações locais neles serão perdidas.",
|
||||
|
||||
@@ -7428,7 +7428,6 @@
|
||||
"Show commit time rather than author time": "Yazar zamanı yerine commit zamanını göster",
|
||||
"Show references on the left": "Başvuruları solda göster",
|
||||
"Visible columns": "Görünür sütunlar",
|
||||
"Visible columns:": "Görünür sütunlar:",
|
||||
"Get from Revision": "Revizyondan Al",
|
||||
"Replace '{path}' with its content from the revision? Local changes to it are lost.": "'{path}' dosyası revizyondaki içeriğiyle değiştirilsin mi? Yerel değişiklikleri kaybolacak.",
|
||||
"Replace {length} files with their content from the revision? Local changes to them are lost.": "{length} dosya revizyondaki içerikleriyle değiştirilsin mi? Yerel değişiklikleri kaybolacak.",
|
||||
|
||||
@@ -5736,7 +5736,6 @@
|
||||
"Show commit time rather than author time": "顯示提交時間而非作者時間",
|
||||
"Show references on the left": "在左側顯示引用",
|
||||
"Visible columns": "可見欄",
|
||||
"Visible columns:": "可見欄:",
|
||||
"Get from Revision": "從修訂取得",
|
||||
"Replace '{path}' with its content from the revision? Local changes to it are lost.": "用修訂中的內容取代「{path}」?其本機更改將遺失。",
|
||||
"Replace {length} files with their content from the revision? Local changes to them are lost.": "用修訂中的內容取代 {length} 個檔案?它們的本機更改將遺失。",
|
||||
|
||||
@@ -6227,7 +6227,6 @@
|
||||
"Show commit time rather than author time": "显示提交时间而非作者时间",
|
||||
"Show references on the left": "在左侧显示引用",
|
||||
"Visible columns": "可见列",
|
||||
"Visible columns:": "可见列:",
|
||||
"Get from Revision": "从修订获取",
|
||||
"Replace '{path}' with its content from the revision? Local changes to it are lost.": "用修订中的内容替换“{path}”?其本地更改将丢失。",
|
||||
"Replace {length} files with their content from the revision? Local changes to them are lost.": "用修订中的内容替换 {length} 个文件?它们的本地更改将丢失。",
|
||||
|
||||
Reference in new issue
Заблокувати користувача