дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 09:41:34 +02:00
fix(vcs): show file names in staging diff headings
Цей коміт міститься в:
1 джерело
76d67145f5
коміт
20862a1f7b
4 files changed
+54
-7
No files matched your search
@@ -102,6 +102,9 @@ 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();
|
||||
|
||||
@@ -187,6 +187,9 @@ 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);
|
||||
@@ -557,6 +560,11 @@ 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}
|
||||
|
||||
@@ -27,6 +27,29 @@
|
||||
.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);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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";
|
||||
@@ -11,6 +12,7 @@ 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";
|
||||
|
||||
@@ -129,6 +131,7 @@ function present(
|
||||
export function ThreePaneDiff({
|
||||
path,
|
||||
labels,
|
||||
titlePaths,
|
||||
model,
|
||||
controls,
|
||||
onEditors,
|
||||
@@ -138,6 +141,7 @@ 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;
|
||||
@@ -222,13 +226,22 @@ export function ThreePaneDiff({
|
||||
}, [labels, local, index, path, ready]);
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
<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 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>
|
||||
{model?.binary ? (
|
||||
<div className={styles.status}>{tx("Binary content")}</div>
|
||||
|
||||
Reference in new issue
Заблокувати користувача