дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-22 01:20:46 +02:00
Порівняти коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
841c158a26 | ||
|
|
97ffd9aae9 |
No files matched your search
@@ -46,6 +46,41 @@ test("a narrow diff keeps navigation, settings and the difference count visible"
|
||||
await expect(toolbar).toContainText("1 of 1 differences");
|
||||
});
|
||||
|
||||
test("a medium-width diff keeps its full status beside the viewer tools", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 490, height: 650 });
|
||||
await page.evaluate(async () => {
|
||||
const layoutPath = "/src/workbench/toolwindows/store.ts";
|
||||
const inputPath = "/src/features/vcs/diffInput.ts";
|
||||
const { hideAllToolWindows } = await import(layoutPath);
|
||||
const { openDiff, withChain } = await import(inputPath);
|
||||
hideAllToolWindows();
|
||||
localStorage.setItem("openidea.vcs.diffOptions", JSON.stringify({ mode: "split", collapse: false }));
|
||||
const files = ["a.ts", "b.ts"].map((name) => ({
|
||||
path: `/dev/acme-api/${name}`,
|
||||
left: { type: "text", text: "const rate = 0.05;\r\n", label: "Before" },
|
||||
right: { type: "text", text: "const rate = 0.05;\n", label: "After", editable: true },
|
||||
}));
|
||||
await openDiff(withChain(files, 0));
|
||||
});
|
||||
|
||||
const toolbar = page.getByRole("toolbar", { name: "Diff", exact: true });
|
||||
const status = toolbar.getByText("Contents differ only in line separators", { exact: true });
|
||||
const settings = toolbar.getByRole("button", { name: "Settings", exact: true });
|
||||
await expect(status).toBeVisible();
|
||||
expect((await toolbar.boundingBox())!.width).toBeGreaterThan(380);
|
||||
await expect.poll(() => status.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThan(2);
|
||||
const message = (await status.boundingBox())!;
|
||||
const gear = (await settings.boundingBox())!;
|
||||
expect(gear.x).toBeGreaterThanOrEqual(message.x + message.width);
|
||||
expect(Math.abs(gear.y + gear.height / 2 - message.y - message.height / 2)).toBeLessThan(2);
|
||||
|
||||
await expect(toolbar.getByRole("button", { name: "Compare Next File", exact: true })).toBeVisible();
|
||||
await expect(toolbar.getByRole("button", { name: "Unified Viewer", exact: true })).toBeHidden();
|
||||
await settings.click();
|
||||
await page.getByRole("menuitemcheckbox", { name: "Unified Viewer", exact: true }).click();
|
||||
await expect(toolbar.locator("..").locator(".cm-editor")).toHaveCount(1);
|
||||
});
|
||||
|
||||
test("combined diff file actions stay visible beside a long name in a narrow pane", async ({ workbench: page }) => {
|
||||
const longName = "OrderHistoryCustomerNotificationDeliveryPreferencesValidationDefaults.txt";
|
||||
const directory = "/dev/acme-api/src/main/orders/preferences";
|
||||
|
||||
@@ -37,6 +37,21 @@ test("type-ahead jumps to a matching node", async ({ workbench: page }) => {
|
||||
await expect(tree.locator('[role="treeitem"][aria-selected="true"]')).toHaveText("README.md");
|
||||
});
|
||||
|
||||
test("Rename targets a file or folder directly from its context menu", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 720, height: 480 });
|
||||
const menu = page.getByRole("menu", { name: "Context menu" });
|
||||
const dialog = page.getByRole("dialog", { name: "Rename", exact: true });
|
||||
for (const name of ["README.md", "src"]) {
|
||||
const row = page.getByRole("treeitem", { name, exact: true });
|
||||
await row.click({ button: "right" });
|
||||
await menu.getByRole("menuitem", { name: /^Rename…/ }).click();
|
||||
await expect(dialog.getByRole("textbox", { name: "New name" })).toHaveValue(name);
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect(dialog).toHaveCount(0);
|
||||
await expect(row).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test("the file deletion form keeps its option and buttons visible in a narrow window", async ({ workbench: page }) => {
|
||||
const file = page.getByRole("treeitem", { name: "README.md", exact: true });
|
||||
await file.click({ button: "right" });
|
||||
|
||||
@@ -348,10 +348,10 @@ describe("debug tool window", () => {
|
||||
|
||||
describe("variables the adapter computes after the stop", () => {
|
||||
const tick = () => act(() => new Promise((resolve) => setTimeout(resolve, 0)));
|
||||
const setup = (current = session) => {
|
||||
const setup = () => {
|
||||
adapterData.library = "Collecting data…";
|
||||
adapterData.scopes.mockClear();
|
||||
useDebug.setState({ sessions: { 1: current }, active: 1, stopSeq: 1, variablesEpoch: 0 });
|
||||
useDebug.setState({ sessions: { 1: session }, active: 1, stopSeq: 1, variablesEpoch: 0 });
|
||||
return render(<DebugToolWindow />);
|
||||
};
|
||||
|
||||
@@ -396,42 +396,22 @@ describe("variables the adapter computes after the stop", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("groups variable and watch context menu actions", async () => {
|
||||
it("offers Remove All Watches on a watch's context menu", async () => {
|
||||
useDebug.setState({ watches: ["count + 1", "label.upper()"] });
|
||||
const menu = (text: string) => {
|
||||
fireEvent.contextMenu(screen.getByText(text).closest("[role=treeitem]")!);
|
||||
const items = useContextMenuStore.getState().menu?.items ?? [];
|
||||
act(() => hideContextMenu());
|
||||
return items;
|
||||
return items.flatMap((i) => ("label" in i && i.label ? [i] : []));
|
||||
};
|
||||
const layout = (items: ReturnType<typeof menu>) =>
|
||||
items.map((item) => (item.kind === "separator" ? "|" : item.label));
|
||||
try {
|
||||
setup({ ...session, caps: { dataBreakpoints: true } as DebugSession["caps"] });
|
||||
setup();
|
||||
await screen.findByText("label.upper()");
|
||||
await screen.findByText("'hi'");
|
||||
expect(layout(menu("label"))).toEqual([
|
||||
"Set Value…",
|
||||
"Copy Value",
|
||||
"Copy Name",
|
||||
"|",
|
||||
"Add to Watches",
|
||||
"Add Field Watchpoint",
|
||||
"|",
|
||||
"Jump to Source",
|
||||
]);
|
||||
expect(menu("label").map((i) => i.label)).not.toContain("Remove All Watches");
|
||||
const items = menu("count + 1");
|
||||
expect(layout(items)).toEqual([
|
||||
"Remove Watch",
|
||||
"Remove All Watches",
|
||||
"|",
|
||||
"Set Value…",
|
||||
"Copy Value",
|
||||
"Copy Name",
|
||||
"|",
|
||||
"Jump to Source",
|
||||
]);
|
||||
const removeAll = items.find((i) => "label" in i && i.label === "Remove All Watches");
|
||||
expect(items.map((i) => i.label)).toContain("Remove Watch");
|
||||
const removeAll = items.find((i) => i.label === "Remove All Watches");
|
||||
expect(removeAll).toBeTruthy();
|
||||
act(() => (removeAll as { run: () => void }).run());
|
||||
expect(useDebug.getState().watches).toEqual([]);
|
||||
|
||||
@@ -390,38 +390,36 @@ export function VariablesView({
|
||||
};
|
||||
|
||||
const onContextMenu = (node: VarNode | null, _sel: Set<string>, e: React.MouseEvent) => {
|
||||
if (!node || node.kind === "message" || node.kind === "scope") return;
|
||||
if (!node || node.kind === "message") return;
|
||||
e.preventDefault();
|
||||
const items: MenuItem[] = [];
|
||||
if (editable(node))
|
||||
items.push(
|
||||
{ label: "Set Value…", icon: "edit", shortcut: "F2", run: () => startEdit(node) },
|
||||
{ kind: "separator" },
|
||||
);
|
||||
if (node.kind === "watch")
|
||||
items.push(
|
||||
{ label: "Remove Watch", icon: "minus", run: () => removeWatch(node.name) },
|
||||
{ label: "Remove All Watches", run: removeAllWatches },
|
||||
{ kind: "separator" },
|
||||
);
|
||||
if (editable(node)) items.push({ label: "Set Value…", icon: "edit", shortcut: "F2", run: () => startEdit(node) });
|
||||
items.push(
|
||||
{ label: "Copy Value", icon: "copy", run: () => void copyValue(node) },
|
||||
{ label: "Copy Name", run: () => void writeClipboardText(node.name) },
|
||||
);
|
||||
|
||||
const watchActions: MenuItem[] = [];
|
||||
const expression = node.evaluateName;
|
||||
if (node.kind === "var" && expression)
|
||||
watchActions.push({ label: "Add to Watches", icon: "eye", run: () => addWatch(expression) });
|
||||
if (canWatch(node))
|
||||
watchActions.push({
|
||||
label: "Add Field Watchpoint",
|
||||
icon: "breakpoint-field",
|
||||
run: () => void addWatchpointFor(session!, node),
|
||||
});
|
||||
if (watchActions.length) items.push({ kind: "separator" }, ...watchActions);
|
||||
|
||||
items.push(
|
||||
{ kind: "separator" },
|
||||
{ label: "Jump to Source", shortcut: "F4", run: () => void jumpToDeclaration(node) },
|
||||
);
|
||||
showContextMenu(e, items);
|
||||
if (node.kind !== "scope") {
|
||||
items.push({ label: "Copy Value", icon: "copy", run: () => void copyValue(node) });
|
||||
items.push({ label: "Copy Name", run: () => void writeClipboardText(node.name) });
|
||||
if (node.kind === "var" && node.evaluateName)
|
||||
items.push({ label: "Add to Watches", icon: "eye", run: () => addWatch(node.evaluateName!) });
|
||||
if (canWatch(node))
|
||||
items.push({
|
||||
label: "Add Field Watchpoint",
|
||||
icon: "breakpoint-field",
|
||||
run: () => void addWatchpointFor(session!, node),
|
||||
});
|
||||
items.push(
|
||||
{ kind: "separator" },
|
||||
{ label: "Jump to Source", shortcut: "F4", run: () => void jumpToDeclaration(node) },
|
||||
);
|
||||
}
|
||||
if (items.length) showContextMenu(e, items);
|
||||
};
|
||||
|
||||
const onKeyDown = (e: KeyboardEvent) => {
|
||||
|
||||
@@ -134,7 +134,7 @@ describe("project view context menu", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("follows IDEA's order for a file", () => {
|
||||
it("groups clipboard, search, file changes, formatting and history actions for a file", () => {
|
||||
const items = contextMenuItems([node(`${ROOT}/src/a.py`)]);
|
||||
expect(labels(items)).toEqual([
|
||||
"New",
|
||||
@@ -143,17 +143,18 @@ describe("project view context menu", () => {
|
||||
"Copy",
|
||||
"Copy Path/Reference…",
|
||||
"Paste",
|
||||
"-",
|
||||
"Jump to Source",
|
||||
"-",
|
||||
"Find Usages",
|
||||
"Find in Files…",
|
||||
"Replace in Files…",
|
||||
"-",
|
||||
"Rename…",
|
||||
"Refactor",
|
||||
"Delete…",
|
||||
"-",
|
||||
"Reformat Code",
|
||||
"Optimize Imports",
|
||||
"Delete…",
|
||||
"-",
|
||||
"Run 'a'",
|
||||
"-",
|
||||
@@ -161,11 +162,11 @@ describe("project view context menu", () => {
|
||||
"Open In",
|
||||
"-",
|
||||
"Local History",
|
||||
"Git",
|
||||
"Reload from Disk",
|
||||
"-",
|
||||
"Git",
|
||||
"-",
|
||||
"Compare With…",
|
||||
"-",
|
||||
"File Color",
|
||||
]);
|
||||
expect(sub(items, "Refactor")).toEqual(["Rename…", "Move File…", "Copy File…", "-", "Safe Delete…"]);
|
||||
@@ -270,7 +271,8 @@ describe("project view context menu", () => {
|
||||
|
||||
it("shows Mark Directory as for folders, without file-only items", () => {
|
||||
const l = labels(contextMenuItems([node(`${ROOT}/src`, true)]));
|
||||
expect(l).toContain("Mark Directory as");
|
||||
expect(l.slice(l.indexOf("Rename…"), l.indexOf("Rename…") + 4)).toEqual(["Rename…", "Refactor", "Delete…", "-"]);
|
||||
expect(l.slice(-4)).toEqual(["Compare With…", "-", "Mark Directory as", "File Color"]);
|
||||
expect(sub(contextMenuItems([node(`${ROOT}/src`, true)]), "Refactor")).toContain("Move Directory…");
|
||||
for (const fileOnly of ["Find Usages", "Optimize Imports", "Run 'a'", "Open in Right Split"])
|
||||
expect(l).not.toContain(fileOnly);
|
||||
@@ -322,6 +324,7 @@ describe("project view context menu", () => {
|
||||
it("keeps the project root menu short and disables what cannot apply", () => {
|
||||
const items = contextMenuItems([node(ROOT, true, true)]);
|
||||
const l = labels(items);
|
||||
expect(l).not.toContain("Rename…");
|
||||
expect(l).not.toContain("Refactor");
|
||||
expect(l).not.toContain("Mark Directory as");
|
||||
const resolved = resolveMenuItems(items);
|
||||
@@ -339,6 +342,7 @@ describe("project view context menu", () => {
|
||||
|
||||
it("offers Compare Files for two files", () => {
|
||||
const l = labels(contextMenuItems([node(`${ROOT}/a.py`), node(`${ROOT}/b.py`)]));
|
||||
expect(l).not.toContain("Rename…");
|
||||
expect(l).toContain("Compare Files");
|
||||
expect(l).not.toContain("Compare With…");
|
||||
});
|
||||
|
||||
@@ -160,12 +160,7 @@ function submenu(id: string, label: string, entries: Entry[], icon?: string): Me
|
||||
return { id, label, icon, submenu: items };
|
||||
}
|
||||
|
||||
/**
|
||||
* IDEA's ProjectViewPopupMenu: New / clipboard / find / Refactor / edit /
|
||||
* Run group / Open In / Local History / Git / Compare / Mark Directory as.
|
||||
* Items that cannot apply to the selection are hidden (or disabled, like IDEA's
|
||||
* clipboard group), so the project root and Scratches get a shorter menu.
|
||||
*/
|
||||
/** Project view actions available for the selected files and directories. */
|
||||
export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
if (nodes.some((n) => n.readOnly)) return libraryMenuItems(nodes.filter((n) => !n.group));
|
||||
const lead = nodes[0] ?? null;
|
||||
@@ -205,7 +200,7 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
{ kind: "separator" },
|
||||
);
|
||||
|
||||
// Cut / Copy / Copy Path/Reference… / Paste
|
||||
// Clipboard and opening files.
|
||||
push(
|
||||
{
|
||||
id: "cut",
|
||||
@@ -247,11 +242,6 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
disabled: !canPaste(),
|
||||
run: () => void paste(folder),
|
||||
},
|
||||
{ kind: "separator" },
|
||||
);
|
||||
|
||||
// Jump to Source / Find Usages / Find in Files… / Replace in Files…
|
||||
push(
|
||||
files.length > 0 && {
|
||||
id: "jumpToSource",
|
||||
label: "Jump to Source",
|
||||
@@ -259,6 +249,10 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
shortcut: keyLabel("project.open"),
|
||||
run: () => files.forEach((f) => void openFile(f.path)),
|
||||
},
|
||||
{ kind: "separator" },
|
||||
);
|
||||
|
||||
push(
|
||||
inWorkspace &&
|
||||
singleFile && {
|
||||
id: "findUsages",
|
||||
@@ -271,16 +265,17 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
{ kind: "separator" },
|
||||
);
|
||||
|
||||
// Refactor ›
|
||||
const rename: Entry = single &&
|
||||
!single.root && {
|
||||
id: "rename",
|
||||
label: "Rename…",
|
||||
shortcut: keyLabel("project.rename"),
|
||||
run: () => void openRenameDialog(single),
|
||||
};
|
||||
push(
|
||||
rename,
|
||||
submenu("refactor", "Refactor", [
|
||||
single &&
|
||||
!single.root && {
|
||||
id: "rename",
|
||||
label: "Rename…",
|
||||
shortcut: keyLabel("project.rename"),
|
||||
run: () => void openRenameDialog(single),
|
||||
},
|
||||
rename,
|
||||
nonRoot.length > 0 && {
|
||||
id: "move",
|
||||
label: nonRoot.length === 1 ? (nonRoot[0]!.dir ? "Move Directory…" : "Move File…") : "Move…",
|
||||
@@ -301,10 +296,16 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
run: () => void deleteSelection(nodes),
|
||||
},
|
||||
]),
|
||||
{
|
||||
id: "delete",
|
||||
label: "Delete…",
|
||||
shortcut: keyLabel("project.delete"),
|
||||
disabled: !nonRoot.length,
|
||||
run: () => void deleteSelection(nodes),
|
||||
},
|
||||
{ kind: "separator" },
|
||||
);
|
||||
|
||||
// Reformat Code (one file at once, directories or several files through its dialog) / Optimize Imports / Delete…
|
||||
push(
|
||||
nodes.some((n) => !n.group) &&
|
||||
getAction(singleFile ? "code.reformatFile" : "code.reformatFiles") && {
|
||||
@@ -320,13 +321,6 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
shortcut: keyLabel("project.optimizeImports"),
|
||||
run: () => void delegate("code.optimizeImportsFile", { path: singleFile.path }),
|
||||
},
|
||||
{
|
||||
id: "delete",
|
||||
label: "Delete…",
|
||||
shortcut: keyLabel("project.delete"),
|
||||
disabled: !nonRoot.length,
|
||||
run: () => void deleteSelection(nodes),
|
||||
},
|
||||
{ kind: "separator" },
|
||||
);
|
||||
|
||||
@@ -367,21 +361,12 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
{ kind: "separator" },
|
||||
);
|
||||
|
||||
// Local History › / Reload from Disk
|
||||
push(
|
||||
single &&
|
||||
submenu("history", "Local History", [
|
||||
delegated("vcs.localHistory", single.path, "Show History"),
|
||||
delegated("localHistory.putLabel", undefined, "Put Label…"),
|
||||
]),
|
||||
{
|
||||
id: "reload",
|
||||
label: "Reload from Disk",
|
||||
icon: "refresh",
|
||||
shortcut: keyLabel("project.reloadFromDisk"),
|
||||
run: () => void reloadFromDisk(nodes),
|
||||
},
|
||||
{ kind: "separator" },
|
||||
);
|
||||
|
||||
// Git › (`vcsAvailable` also covers repositories nested below a non-Git project root)
|
||||
@@ -432,10 +417,20 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
],
|
||||
"branch",
|
||||
),
|
||||
{ kind: "separator" },
|
||||
);
|
||||
}
|
||||
|
||||
push(
|
||||
{
|
||||
id: "reload",
|
||||
label: "Reload from Disk",
|
||||
icon: "refresh",
|
||||
shortcut: keyLabel("project.reloadFromDisk"),
|
||||
run: () => void reloadFromDisk(nodes),
|
||||
},
|
||||
{ kind: "separator" },
|
||||
);
|
||||
|
||||
const compare = compareTarget(nodes);
|
||||
if (compare)
|
||||
push(
|
||||
@@ -445,6 +440,8 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
|
||||
}),
|
||||
);
|
||||
|
||||
push({ kind: "separator" });
|
||||
|
||||
// An attached project keeps its own excluded folders; its other roles aren't applied yet.
|
||||
const attached = !inProject && single?.dir ? attachedProjectOf(single.path) : null;
|
||||
if ((inProject || attached) && single?.dir && !single.root && !single.placeholder) {
|
||||
|
||||
@@ -13,11 +13,13 @@
|
||||
}
|
||||
.toolbar {
|
||||
flex: none;
|
||||
height: var(--h-header);
|
||||
min-height: var(--h-header);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
gap: var(--space-0-5);
|
||||
padding: 0 6px;
|
||||
padding: var(--space-0-5) var(--space-1-5);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.toolbar > * {
|
||||
@@ -29,16 +31,32 @@
|
||||
margin: 0 4px;
|
||||
background: var(--border-strong);
|
||||
}
|
||||
.toolbar > .count {
|
||||
.toolbar > .statusTools {
|
||||
flex-shrink: 1;
|
||||
min-width: 0;
|
||||
margin-left: auto;
|
||||
padding: 0 6px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: var(--space-0-5);
|
||||
min-inline-size: 0;
|
||||
max-inline-size: 100%;
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
.statusTools > :not(.count) {
|
||||
flex: none;
|
||||
}
|
||||
.count {
|
||||
min-inline-size: 0;
|
||||
max-inline-size: 100%;
|
||||
padding-inline: var(--space-1-5);
|
||||
color: var(--fg-subtle);
|
||||
font-size: var(--fs-small);
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
overflow-wrap: anywhere;
|
||||
text-align: end;
|
||||
}
|
||||
.count:empty {
|
||||
display: none;
|
||||
}
|
||||
/* Narrow (a side-docked preview): the whitespace / highlighting pickers stay in the gear menu. */
|
||||
@container diff-editor (max-width: 640px) {
|
||||
@@ -46,23 +64,11 @@
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@container diff-editor (max-width: 380px) {
|
||||
.toolbar {
|
||||
height: auto;
|
||||
min-height: var(--h-header);
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
padding-block: var(--space-0-5);
|
||||
}
|
||||
@container diff-editor (max-width: 520px) {
|
||||
.toolbar > .sep,
|
||||
.toolbar > .inlineOption {
|
||||
display: none;
|
||||
}
|
||||
.toolbar > .count {
|
||||
flex: 1 1 auto;
|
||||
order: 1;
|
||||
text-align: end;
|
||||
}
|
||||
}
|
||||
.labels {
|
||||
flex: none;
|
||||
|
||||
@@ -1525,65 +1525,67 @@ export function DiffEditor({
|
||||
)}
|
||||
<span className={styles.sep} />
|
||||
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void reload()} />
|
||||
<span className={styles.count}>
|
||||
{binary && tx("Binary content")}
|
||||
{!ready || binary
|
||||
? ""
|
||||
: chunkInfo.count === 0
|
||||
? identical
|
||||
? modeChange
|
||||
? tx`File mode changed: ${modeChange.from} → ${modeChange.to}`
|
||||
: tx("Contents are identical")
|
||||
: eolOnly
|
||||
? tx("Contents differ only in line separators")
|
||||
: chunkInfo.whitespaceOnly
|
||||
? tx("Whitespace-only changes")
|
||||
: tx("No differences")
|
||||
: chunkInfo.current >= 0
|
||||
? tx`${chunkInfo.current + 1} of ${chunkInfo.count} differences`
|
||||
: chunkInfo.count === 1
|
||||
? tx`${chunkInfo.count} difference`
|
||||
: tx`${chunkInfo.count} differences`}
|
||||
{ready && !binary && chunkInfo.count > 0 && chunkInfo.whitespaceOnly && tx(" · Whitespace-only changes")}
|
||||
{ready &&
|
||||
!binary &&
|
||||
chunkInfo.moves > 0 &&
|
||||
(chunkInfo.moves === 1 ? tx(" · 1 moved block") : tx` · ${chunkInfo.moves} moved blocks`)}
|
||||
</span>
|
||||
{contribs.map((c, i) => c.Toolbar && <c.Toolbar key={i} host={viewer} />)}
|
||||
{toolbarActions}
|
||||
{canExternal && (
|
||||
<div className={styles.statusTools}>
|
||||
<span className={styles.count}>
|
||||
{binary && tx("Binary content")}
|
||||
{!ready || binary
|
||||
? ""
|
||||
: chunkInfo.count === 0
|
||||
? identical
|
||||
? modeChange
|
||||
? tx`File mode changed: ${modeChange.from} → ${modeChange.to}`
|
||||
: tx("Contents are identical")
|
||||
: eolOnly
|
||||
? tx("Contents differ only in line separators")
|
||||
: chunkInfo.whitespaceOnly
|
||||
? tx("Whitespace-only changes")
|
||||
: tx("No differences")
|
||||
: chunkInfo.current >= 0
|
||||
? tx`${chunkInfo.current + 1} of ${chunkInfo.count} differences`
|
||||
: chunkInfo.count === 1
|
||||
? tx`${chunkInfo.count} difference`
|
||||
: tx`${chunkInfo.count} differences`}
|
||||
{ready && !binary && chunkInfo.count > 0 && chunkInfo.whitespaceOnly && tx(" · Whitespace-only changes")}
|
||||
{ready &&
|
||||
!binary &&
|
||||
chunkInfo.moves > 0 &&
|
||||
(chunkInfo.moves === 1 ? tx(" · 1 moved block") : tx` · ${chunkInfo.moves} moved blocks`)}
|
||||
</span>
|
||||
{contribs.map((c, i) => c.Toolbar && <c.Toolbar key={i} host={viewer} />)}
|
||||
{toolbarActions}
|
||||
{canExternal && (
|
||||
<IconButton
|
||||
icon="external-tools"
|
||||
title="Show Diff in External Tool"
|
||||
size="small"
|
||||
onClick={() => void showInExternalTool()}
|
||||
/>
|
||||
)}
|
||||
{getAction("vcs.showDiffInNewWindow") && auxiliaryWindow()?.kind !== "diff" && (
|
||||
<IconButton
|
||||
icon="external-link"
|
||||
title="Show Diff in New Window"
|
||||
size="small"
|
||||
onClick={() => void executeAction("vcs.showDiffInNewWindow", data)}
|
||||
/>
|
||||
)}
|
||||
{auxiliaryWindow()?.kind === "diff" && getAction("vcs.showDiffInEditorTab") && (
|
||||
<IconButton
|
||||
icon="editor-only"
|
||||
title="Show Diff in Editor Tab"
|
||||
size="small"
|
||||
onClick={() => void executeAction("vcs.showDiffInEditorTab")}
|
||||
/>
|
||||
)}
|
||||
<IconButton
|
||||
icon="external-tools"
|
||||
title="Show Diff in External Tool"
|
||||
icon="settings"
|
||||
title="Settings"
|
||||
shortcut={shortcutLabel("diff.showSettings")}
|
||||
size="small"
|
||||
onClick={() => void showInExternalTool()}
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => showSettings(e.currentTarget)}
|
||||
/>
|
||||
)}
|
||||
{getAction("vcs.showDiffInNewWindow") && auxiliaryWindow()?.kind !== "diff" && (
|
||||
<IconButton
|
||||
icon="external-link"
|
||||
title="Show Diff in New Window"
|
||||
size="small"
|
||||
onClick={() => void executeAction("vcs.showDiffInNewWindow", data)}
|
||||
/>
|
||||
)}
|
||||
{auxiliaryWindow()?.kind === "diff" && getAction("vcs.showDiffInEditorTab") && (
|
||||
<IconButton
|
||||
icon="editor-only"
|
||||
title="Show Diff in Editor Tab"
|
||||
size="small"
|
||||
onClick={() => void executeAction("vcs.showDiffInEditorTab")}
|
||||
/>
|
||||
)}
|
||||
<IconButton
|
||||
icon="settings"
|
||||
title="Settings"
|
||||
shortcut={shortcutLabel("diff.showSettings")}
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => showSettings(e.currentTarget)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{viewMode === "split" ? (
|
||||
<div className={labels}>
|
||||
|
||||
Reference in new issue
Заблокувати користувача