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

..
Автор SHA1 Повідомлення Дата
l0ng-ai 809a618087 fix(search): keep scope names and patterns readable in the editor dialog 2026-11-22 23:44:00 +08:00
9 змінених файлів з 126 додано та 77 видалено

No files matched your search

Створено
+4 -4
Переглянути файл
@@ -2361,9 +2361,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
[[package]]
name = "form_urlencoded"
version = "1.2.3"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
dependencies = [
"percent-encoding",
]
@@ -10827,9 +10827,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
version = "2.5.9"
version = "2.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
dependencies = [
"form_urlencoded",
"idna",
+59
Переглянути файл
@@ -0,0 +1,59 @@
import { expect, test } from "./fixtures";
test("Find in Files keeps the scope list and pattern editor usable in a narrow window", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1040, height: 700 });
const longName = "Regional settlement reconciliation sources for month-end audit and publication";
await page.evaluate(async (longName) => {
const search = "/src/platform/search.ts";
const { saveCustomScopes } = await import(/* @vite-ignore */ search);
saveCustomScopes(
Array.from({ length: 26 }, (_, i) => ({
name: i ? `Reconciliation scope ${i + 1}` : longName,
pattern: i ? `file:src/scope-${i + 1}//*` : "file:src/reconciliation//*",
})),
);
}, longName);
await page.keyboard.press("Meta+Shift+F");
const find = page.getByRole("dialog", { name: "Find in Files", exact: true });
await find.getByRole("tab", { name: "Scope", exact: true }).click();
const openScopes = find.getByRole("button", { name: "Edit Scopes…", exact: true });
await openScopes.click();
const dialog = page.getByRole("dialog", { name: "Scopes", exact: true });
const list = dialog.getByRole("list", { name: "Scopes", exact: true });
const name = dialog.getByRole("textbox", { name: "Name:", exact: true });
const pattern = dialog.getByRole("textbox", { name: "Pattern:", exact: true });
await expect(pattern).toHaveValue("file:src/reconciliation//*");
expect(await list.evaluate((el) => el.scrollHeight - el.clientHeight)).toBeGreaterThan(100);
await expect(list.getByRole("button", { name: longName })).toHaveAttribute("title", longName);
expect((await list.boundingBox())!.x).toBeLessThan((await name.boundingBox())!.x);
await page.setViewportSize({ width: 460, height: 530 });
const fields = (await pattern.boundingBox())!;
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));
expect((await pattern.boundingBox())!.y).toBeCloseTo(fields.y, 0);
const toolbar = dialog.getByRole("toolbar", { name: "Scopes actions" });
const add = toolbar.getByRole("button", { name: "Add Scope", exact: true });
const ok = dialog.getByRole("button", { name: "OK", exact: true });
await expect(add).toBeInViewport({ ratio: 1 });
await expect(ok).toBeInViewport({ ratio: 1 });
await name.fill("Unsaved selection");
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
await openScopes.click();
await expect(name).toHaveValue(longName);
await add.click();
const draft = list.getByRole("button", { name: "Unnamed", exact: true });
await expect(draft).toHaveAttribute("aria-current", "true");
await expect(draft).toBeInViewport({ ratio: 1 });
await expect(ok).toBeDisabled();
await name.fill("Release inputs");
await pattern.fill("file:src/release//*");
await ok.click();
await expect(dialog).toBeHidden();
await openScopes.click();
await list.getByRole("button", { name: "Release inputs", exact: true }).click();
await expect(pattern).toHaveValue("file:src/release//*");
});
-3
Переглянути файл
@@ -102,9 +102,6 @@ test("edits the staged version and keeps an unsaved draft when the index changes
await expect(headPane).toContainText("val committed = 0");
await expect(indexPane).toContainText("val external = 3");
await expect(localPane).not.toBeEmpty();
const indexHeading = page.getByTitle(`Staged (index) ${path}`, { exact: true });
await expect(indexHeading.getByText("build.gradle.kts", { exact: true })).toBeVisible();
await expect(indexHeading.getByText("Staged (index)", { exact: true })).toBeVisible();
const working = await localPane.textContent();
await page.getByRole("button", { name: "Unstage Change", exact: true }).click();
+2 -2
Переглянути файл
@@ -26,12 +26,12 @@ describe("the Language smoke workflow", () => {
const { files, problems } = await smokeInputs(repo, workflow);
expect(problems).toEqual([]);
expect(describeUnselected(await unselected(workflow, [...files.keys()]), files)).toBe("");
}, 20000);
});
it("runs every language when a crate the smoke runs changes", async () => {
const crates = rustSmokeInputs(repo);
expect(describeUnselected(await unselected(workflow, [...crates.keys()]), crates)).toBe("");
}, 20000);
});
});
const dirs: string[] = [];
+45 -14
Переглянути файл
@@ -1,26 +1,32 @@
.body {
display: grid;
grid-template-columns: 200px 1fr;
min-height: 300px;
grid-template-columns: 200px minmax(0, 1fr);
grid-template-rows: minmax(0, 1fr);
height: clamp(240px, 55vh, 360px);
border: 1px solid var(--border);
border-radius: var(--radius-small);
overflow: hidden;
}
.side {
display: flex;
flex-direction: column;
min-width: 0;
border-right: 1px solid var(--border);
min-height: 0;
border-inline-end: 1px solid var(--border);
}
.toolbar {
display: flex;
flex: none;
gap: var(--space-0-5);
padding: 4px;
padding: var(--space-1);
border-bottom: 1px solid var(--border);
}
.list {
flex: 1;
min-height: 0;
margin: 0;
padding: 4px;
padding: var(--space-1);
scroll-padding-block: var(--space-1);
list-style: none;
overflow: auto;
}
@@ -29,13 +35,16 @@
align-items: center;
width: 100%;
height: var(--h-list-row);
padding: 0 8px;
padding: 0 var(--space-2);
border: 0;
border-radius: var(--radius-row);
background: none;
color: var(--fg);
font-size: var(--fs-ui);
text-align: left;
text-align: start;
}
.item > span {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@@ -47,16 +56,25 @@
background: var(--bg-list-selected);
}
.empty {
padding: 8px;
padding: var(--space-2);
color: var(--fg-muted);
font-size: var(--fs-ui);
}
.form {
display: flex;
flex-direction: column;
gap: var(--space-1-5);
padding: 10px 14px;
display: grid;
grid-template-columns: max-content minmax(0, 1fr);
align-items: center;
align-content: start;
gap: var(--space-2) var(--space-3);
padding: var(--space-3);
min-width: 0;
min-height: 0;
overflow: auto;
}
.form > .error,
.form > .empty,
.help {
grid-column: 1 / -1;
}
.label {
color: var(--fg-muted);
@@ -65,10 +83,11 @@
.error {
color: var(--danger);
font-size: var(--fs-small);
overflow-wrap: anywhere;
}
.help {
margin: 6px 0 0;
padding-left: 16px;
margin: 0;
padding-inline-start: var(--space-4);
color: var(--fg-muted);
font-size: var(--fs-small);
line-height: 1.6;
@@ -77,3 +96,15 @@
font-family: var(--font-mono);
color: var(--fg);
}
@media (max-width: 540px) {
.body {
grid-template-columns: minmax(0, 1fr);
grid-template-rows: minmax(84px, 1fr) minmax(0, auto);
height: clamp(240px, 65vh, 360px);
}
.side {
border-inline-end: 0;
border-bottom: 1px solid var(--border);
}
}
+9 -3
Переглянути файл
@@ -3,7 +3,7 @@
* file pattern, saved per project (`@/platform/search`) and offered wherever
* named scopes are (Find in Files, the analyses' Specify Scope).
*/
import { useEffect, useId, useState } from "react";
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
import clsx from "clsx";
import { create } from "zustand";
import { tx, txTemplate, useTx, useTxTemplate } from "@/platform/i18n";
@@ -88,6 +88,10 @@ function ScopesDialog() {
const select = useScopesDialog.getState().select;
return Math.max(0, select ? scopes.findIndex((s) => s.name === select) : 0);
});
const selectedRow = useRef<HTMLButtonElement>(null);
useLayoutEffect(() => {
selectedRow.current?.scrollIntoView({ block: "nearest" });
}, [index, scopes.length]);
const current = scopes[index] ?? null;
const patternError = usePatternError(current?.pattern ?? "");
const problem = scopesProblem(scopes);
@@ -124,7 +128,7 @@ function ScopesDialog() {
>
<div className={styles.body}>
<div className={styles.side}>
<div className={styles.toolbar}>
<div className={styles.toolbar} role="toolbar" aria-label={tr("Scopes actions")}>
<IconButton icon="plus" title="Add Scope" size="small" onClick={add} />
<IconButton icon="minus" title="Remove Scope" size="small" disabled={!current} onClick={remove} />
</div>
@@ -134,11 +138,13 @@ function ScopesDialog() {
<li key={i}>
<button
type="button"
ref={i === index ? selectedRow : undefined}
className={clsx(styles.item, i === index && styles.itemOn)}
aria-current={i === index || undefined}
title={s.name}
onClick={() => setIndex(i)}
>
{s.name || tr("Unnamed")}
<span>{s.name || tr("Unnamed")}</span>
</button>
</li>
))}
-8
Переглянути файл
@@ -187,9 +187,6 @@ export function StagingDiff({
return { ...loaded, index: base, model: compareThreeTexts([head, liveIndex, liveLocal]) };
}, [loaded, local, localText, indexDoc, indexState.base, indexState.text, metadataLoading]);
const snapshot = useRangeSnapshot(data.stagingRange, full);
const headSide = snapshot?.head ?? versions?.left ?? data.left;
const headTitlePath = (headSide.type === "rev" && headSide.path) || data.path;
const indexTitlePath = snapshot?.indexPath ?? indexPath ?? data.path;
const [error, setError] = useState("");
const [busy, setBusy] = useState(false);
const [selected, setSelected] = useState(-1);
@@ -560,11 +557,6 @@ export function StagingDiff({
<ThreePaneDiff
path={data.path}
labels={labels}
titlePaths={[
headTitlePath === indexTitlePath ? undefined : headTitlePath,
indexTitlePath,
data.path === indexTitlePath ? undefined : data.path,
]}
model={snapshot?.model ?? null}
controls={controls}
onEditors={onEditors}
-23
Переглянути файл
@@ -27,29 +27,6 @@
.pane + .pane {
border-left: 1px solid var(--border);
}
.versionLabels {
font-size: var(--fs-ui);
}
.versionLabels > span,
.labelFile {
display: flex;
align-items: center;
gap: var(--space-1);
}
.labelFile {
min-width: 0;
color: var(--fg-strong);
}
.labelFile > svg {
flex: none;
}
.labelFilename {
overflow: hidden;
text-overflow: ellipsis;
}
.versionLabels .versionName {
flex: none;
}
.absent {
color: var(--fg-subtle);
}
+7 -20
Переглянути файл
@@ -4,7 +4,6 @@ import { Decoration, EditorView, gutter } from "@codemirror/view";
import { Chunk } from "@codemirror/merge";
import { diffSideExtensions, embeddedEditorExtensions, remoteChange, type DocumentAttachment } from "@/editor/api";
import { tx } from "@/platform/i18n";
import { Icon, fileIconName } from "@/ui";
import { documentTooltips, firstLineOf, languageFor, viewerBase } from "./cm";
import { diffDocument, exposeHunkButtons, HunkButtons, type HunkButton } from "./diffControls";
import { ideaDiffConfig } from "./diffOptions";
@@ -12,7 +11,6 @@ import { syncMergeScroll } from "./mergeScroll";
import { diffRangeView, setDiffRange } from "./diffRangeView";
import type { DiffRange } from "./stagingRange";
import type { StagedDocument } from "./stagedDocument";
import { baseName } from "./model";
import diffStyles from "./DiffEditor.module.css";
import styles from "./ThreePaneDiff.module.css";
@@ -131,7 +129,6 @@ function present(
export function ThreePaneDiff({
path,
labels,
titlePaths,
model,
controls,
onEditors,
@@ -141,7 +138,6 @@ export function ThreePaneDiff({
}: {
path: string;
labels: ThreePanes<string>;
titlePaths?: ThreePanes<string | undefined>;
model: ReturnType<typeof compareThreeTexts> | null;
controls?: (change: ThreePaneChange) => HunkControl[];
onEditors?: (views: ThreePanes<EditorView> | null) => void;
@@ -226,22 +222,13 @@ export function ThreePaneDiff({
}, [labels, local, index, path, ready]);
return (
<div className={styles.root}>
<div className={titlePaths ? `${styles.labels} ${styles.versionLabels}` : styles.labels}>
{labels.map((label, i) => {
const file = titlePaths?.[i];
return (
<span key={i} title={file ? `${label} ${file}` : label}>
{file && (
<span className={styles.labelFile}>
<Icon name={fileIconName(file)} size={16} />
<span className={styles.labelFilename}>{baseName(file)}</span>
</span>
)}
<span className={styles.versionName}>{label}</span>
{model?.texts[i] === null && <span className={styles.absent}> {tx("(does not exist)")}</span>}
</span>
);
})}
<div className={styles.labels}>
{labels.map((label, i) => (
<span key={i} title={label}>
{label}
{model?.texts[i] === null && <span className={styles.absent}> {tx("(does not exist)")}</span>}
</span>
))}
</div>
{model?.binary ? (
<div className={styles.status}>{tx("Binary content")}</div>