Порівняти коміти

..
Автор SHA1 Повідомлення Дата
l0ng-ai a05296c509 fix(build): keep diagnostic names and elapsed time readable 2026-11-23 05:21:43 +08:00
6 змінених файлів з 100 додано та 102 видалено

No files matched your search

+26 -4
Переглянути файл
@@ -1,8 +1,8 @@
import type { Page } from "@playwright/test";
import { expect, test } from "./fixtures";
async function showBuild(page: Page) {
await page.evaluate(async () => {
async function showBuild(page: Page, diagnosticPath: string | null = null) {
await page.evaluate(async (path) => {
const storePath = "/src/features/build/store.ts";
const layoutPath = "/src/workbench/toolwindows/store.ts";
const { useBuildRun } = await import(/* @vite-ignore */ storePath);
@@ -17,10 +17,10 @@ async function showBuild(page: Page) {
{ kind: "out", text: "Compiling TypeScript" },
{ kind: "err", text: "Expected a number" },
],
messages: [{ severity: "error", text: "Expected a number", path: null, range: null, code: null }],
messages: [{ severity: "error", text: "Expected a number", path, range: null, code: null }],
});
showToolWindow("build", true);
});
}, diagnosticPath);
const build = page.getByRole("region", { name: "Build", exact: true });
await expect(build.getByRole("log", { name: "Build output" })).toBeVisible();
return build;
@@ -35,6 +35,28 @@ test("Build gives about two thirds of the initial split to output", async ({ wor
expect(treeWidth / (treeWidth + consoleWidth)).toBeCloseTo(0.33, 2);
});
test("Build reserves room for duration and file counts beside long directory paths", async ({ workbench: page }) => {
await page.setViewportSize({ width: 760, height: 680 });
const path = "/dev/acme-api/src/services/regional-catalogs/generated/api/development/builders/catalog.ts";
const build = await showBuild(page, path);
const root = build.getByRole("treeitem", { name: /^Build Project/ });
const filename = build.getByTitle(path, { exact: true }).getByText("catalog.ts", { exact: true });
const counts = build.getByTitle(path, { exact: true }).getByText("1 error", { exact: true });
const errorSummary = root.getByText("1 error", { exact: true });
const elapsed = root.getByText("1 s 200 ms", { exact: true });
await expect(elapsed).toHaveCSS("font-size", "12px");
await expect(counts).toBeInViewport({ ratio: 1 });
const textFits = (el: Element) => {
const range = document.createRange();
range.selectNodeContents(el);
return range.getBoundingClientRect().width <= el.getBoundingClientRect().width;
};
expect(await filename.evaluate(textFits)).toBe(true);
expect(await errorSummary.evaluate(textFits)).toBe(true);
const [duration, row] = await Promise.all([elapsed.boundingBox(), root.boundingBox()]);
expect(row!.x + row!.width - duration!.x - duration!.width).toBeLessThan(12);
});
test("Build output and diagnostics respond to a console font change", async ({ workbench: page }) => {
const build = await showBuild(page);
const log = build.getByRole("log", { name: "Build output" });
-60
Переглянути файл
@@ -85,66 +85,6 @@ test("⌘K commits the checked changes with the typed message", async ({ workben
await expect(changes.getByRole("checkbox", { name: "Include build.gradle.kts in commit" })).toBeHidden();
});
test("commit options align author fields and keep the date editable in a narrow dialog", async ({
workbench: page,
}) => {
await stubRepository(page);
await page.setViewportSize({ width: 1040, height: 700 });
await page.keyboard.press("Meta+k");
const panel = page.getByRole("region", { name: "Commit", exact: true });
await panel.getByRole("button", { name: "Commit Options", exact: true }).click();
const popup = page.getByRole("dialog", { name: "Commit Options", exact: true });
const author = popup.getByRole("textbox", { name: "Author", exact: true });
const date = popup.getByLabel("Author date", { exact: true });
const clear = popup.getByRole("button", { name: "Clear author date", exact: true });
const name = "Regional Ledger Review <[email protected]>";
const time = "2024-06-04T13:20:21";
await author.fill(name);
await date.fill(time);
const authorBox = (await author.boundingBox())!;
const dateBox = (await date.boundingBox())!;
const dateLabel = (await popup.getByText("Author date", { exact: true }).boundingBox())!;
const clearBox = (await clear.boundingBox())!;
expect(authorBox.x).toBeCloseTo(dateBox.x, 0);
expect(dateLabel.y).toBeGreaterThanOrEqual(dateBox.y);
expect(dateLabel.y).toBeLessThan(dateBox.y + dateBox.height);
expect(clearBox.x + clearBox.width).toBeCloseTo(authorBox.x + authorBox.width, 0);
await expect(clear).toBeInViewport({ ratio: 1 });
await page.keyboard.press("Escape");
await expect(popup).toBeHidden();
await page.evaluate(async () => {
const projectModule = "/src/platform/project.ts";
const { useProject } = await import(/* @vite-ignore */ projectModule);
const { settings } = useProject.getState();
useProject.setState({
settings: { ...settings, vcs: { ...settings?.vcs, commit: { ...settings?.vcs?.commit, nonModal: false } } },
});
});
await page.setViewportSize({ width: 650, height: 650 });
await page.keyboard.press("Meta+k");
const dialog = page.getByRole("dialog", { name: "Commit Changes", exact: true });
const options = dialog.getByRole("group", { name: "Commit Options", exact: true });
const compactAuthor = options.getByRole("textbox", { name: "Author", exact: true });
const compactDate = options.getByLabel("Author date", { exact: true });
const compactClear = options.getByRole("button", { name: "Clear author date", exact: true });
await expect(compactAuthor).toHaveValue(name);
await expect(compactDate).toHaveValue(time);
const labelBox = (await options.getByText("Author:", { exact: true }).boundingBox())!;
const inputBox = (await compactAuthor.boundingBox())!;
expect(inputBox.x).toBeCloseTo(labelBox.x, 0);
expect(inputBox.y).toBeGreaterThanOrEqual(labelBox.y + labelBox.height);
const box = (await compactDate.boundingBox())!;
const buttonBox = (await compactClear.boundingBox())!;
expect(box.width).toBeCloseTo(inputBox.width, 0);
expect(buttonBox.y).toBeGreaterThanOrEqual(box.y + box.height);
expect(await options.evaluate((node) => node.scrollWidth - node.clientWidth)).toBeLessThanOrEqual(1);
await compactClear.click();
await expect(compactDate).toHaveValue("");
await expect(compactClear).toBeHidden();
await expect(compactAuthor).toHaveValue(name);
});
test("the Commit window gives its message preferred focus", async ({ workbench: page }) => {
await stubRepository(page);
const stripe = page.locator('[data-stripe-button="commit"]');
+30
Переглянути файл
@@ -30,6 +30,16 @@
.strong {
color: var(--fg-strong);
}
.strong,
.rootDetail,
.directory {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.row > svg {
flex: none;
}
.selected {
color: var(--fg-strong);
}
@@ -37,6 +47,26 @@
flex: none;
color: var(--fg-subtle);
}
.rootDetail {
max-width: 50%;
}
.fileLabel {
display: flex;
min-width: 0;
gap: var(--space-1-5);
}
.fileName {
flex: none;
max-width: 100%;
}
.muted.directory {
flex: 0 1 auto;
}
.duration {
margin-inline-start: auto;
font-size: var(--fs-small);
font-variant-numeric: tabular-nums;
}
.fileIcon {
flex: none;
color: var(--fg-muted);
+24 -12
Переглянути файл
@@ -67,13 +67,12 @@ function StatusIcon({ status }: { status: BuildStatus }) {
return <Icon name={name} size={14} className={styles[`status-${status}`]} />;
}
function rootDetail(status: BuildStatus, durationMs: number | null, errors: number, warnings: number): string {
function rootDetail(status: BuildStatus, errors: number, warnings: number): string {
if (status === "running") return "running…";
if (status === "cancelled") return "cancelled";
const summary = finishSummary({ success: status === "success", errors, warnings, durationMs });
return status === "success"
? `finished ${formatDuration(durationMs ?? 0)}`
: summary.replace(/^Build failed:?\s*/, "") || "failed";
if (status === "success") return tx("Finished");
const summary = finishSummary({ success: false, errors, warnings, durationMs: null });
return summary.replace(/^Build failed:?\s*/, "") || "failed";
}
export function BuildHeaderActions() {
@@ -130,15 +129,19 @@ function BuildTree() {
const renderNode = (n: BuildNode, state: TreeRowState) => {
if (n.kind === "root") {
const detail = rootDetail(n.status, n.errors, n.warnings);
const elapsed = n.status !== "running" && durationMs != null ? formatDuration(durationMs) : null;
return (
<span className={styles.row}>
<span className={styles.row} title={[n.title, detail, elapsed].filter(Boolean).join(" ")}>
<StatusIcon status={n.status} />
<span className={styles.strong}>{n.title}</span>
<span className={styles.muted}>{rootDetail(n.status, durationMs, n.errors, n.warnings)}</span>
<span className={clsx(styles.muted, styles.rootDetail)}>{detail}</span>
{elapsed && <span className={clsx(styles.muted, styles.duration)}>{elapsed}</span>}
</span>
);
}
if (n.kind === "file") {
const directory = relativeDir(root, n.path);
const errors = n.messages.filter((m) => m.severity === "error").length;
const warnings = n.messages.filter((m) => m.severity === "warning").length;
const counts = [
@@ -148,13 +151,22 @@ function BuildTree() {
.filter(Boolean)
.join(", ");
return (
<span className={styles.row}>
<span className={styles.row} title={n.path}>
<Icon name={fileIconName(basename(n.path), n.path)} size={16} className={styles.fileIcon} />
<span className={clsx(styles.strong, errors > 0 && styles.fileError, state.selected && styles.selected)}>
{basename(n.path)}
<span className={styles.fileLabel}>
<span
className={clsx(
styles.strong,
styles.fileName,
errors > 0 && styles.fileError,
state.selected && styles.selected,
)}
>
{basename(n.path)}
</span>
{directory && <span className={clsx(styles.muted, styles.directory)}>{directory}</span>}
</span>
<span className={styles.muted}>{relativeDir(root, n.path)}</span>
<span className={styles.muted}>{counts}</span>
{counts && <span className={styles.muted}>{counts}</span>}
</span>
);
}
+7 -7
Переглянути файл
@@ -33,17 +33,15 @@ export function CommitAuthorFields({
focusAuthor?: boolean;
onChange: (update: Partial<CommitAuthor>) => void;
}) {
const authorId = useId();
const authorDateId = useId();
const date = authorDate ? new Date(authorDate) : null;
return (
<div className={styles.optIdentity}>
<div className={styles.optIdentityFields}>
<label htmlFor={authorId}>
<>
<label className={styles.optField}>
<span>
<T>Author:</T>
</label>
</span>
<Input
id={authorId}
value={author}
title={tx(
preserveOriginal
@@ -55,6 +53,8 @@ export function CommitAuthorFields({
autoSelect={focusAuthor}
onChange={(e) => onChange({ author: e.target.value })}
/>
</label>
<div className={styles.optDate}>
<label htmlFor={authorDateId}>
<T>Author date</T>
</label>
@@ -81,6 +81,6 @@ export function CommitAuthorFields({
)}
</div>
</div>
</div>
</>
);
}
+13 -19
Переглянути файл
@@ -309,7 +309,7 @@
}
/* Commit Options popup (gear next to Commit). */
.options {
width: 384px;
width: 340px;
max-height: min(560px, 80vh);
overflow: auto;
padding: 4px 16px 12px;
@@ -350,35 +350,29 @@
flex: 1;
min-width: 0;
}
.optIdentity {
container-type: inline-size;
}
.optIdentityFields {
display: grid;
grid-template-columns: minmax(0, 1fr);
.optField {
display: flex;
align-items: center;
gap: var(--space-1) var(--space-2);
gap: var(--space-2);
color: var(--fg);
font-size: var(--fs-ui);
}
.optIdentityFields > label {
overflow-wrap: anywhere;
.optField > :last-child {
flex: 1;
min-width: 0;
}
@container (min-width: 328px) {
.optIdentityFields {
grid-template-columns: fit-content(32%) minmax(0, 1fr);
row-gap: var(--space-1-5);
}
.optDate {
display: flex;
flex-direction: column;
gap: var(--space-1);
color: var(--fg);
}
.optDateInput {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: var(--space-1);
}
.optDateInput input {
flex: 1 1 min(100%, 212px);
flex: 1;
min-width: 0;
}
.optLink {