Файли
openidea/src/features/vcs/conflictBanner.ts
T
ntbang0901 c2fa6f37ab feat(vcs): make unresolved merge conflicts visible wherever they come from (#905)
Conflicts left by stash pop or an automatic stash now get the same editor banner (File has unresolved merge conflicts, Resolve conflicts…) as merge conflicts. Complete conflict markers are reported as errors in every language and listed in Problems (severity under Settings › Editor › Inspections › Version Control). The toolbar shows Resolve/Continue and Abort next to the branch while conflicts or an interrupted operation exist, and the Commit view and Branches popup offer Resolve Conflicts even when no operation is in progress.

Co-authored-by: ntbang0901 <[email protected]>
2026-11-03 23:39:26 +08:00

31 рядки
1.1 KiB
TypeScript

/**
* The notice above a file that has unresolved merge conflicts, as IntelliJ shows it
* ("File has unresolved merge conflicts" with Resolve conflicts…). It follows Git's own
* record of the conflict, so it appears whatever the file's text holds and whether or not
* a merge, rebase or stash is still in progress.
*/
import { registerEditorBanner } from "@/workbench/contributions";
import { openMergeEditor } from "./conflictsUi";
import { effectiveKind, stripSlash } from "./model";
import { useVcs } from "./store";
export function activate(): () => void {
return registerEditorBanner({
id: "vcs.conflict",
order: -5,
useBanner: (path) => {
const conflicted = useVcs((s) => {
const file = s.byPath.get(stripSlash(path));
return !!file && effectiveKind(file) === "conflicted";
});
return conflicted
? {
text: "File has unresolved merge conflicts",
level: "warning",
actions: [{ label: "Resolve conflicts…", run: () => openMergeEditor(path) }],
}
: null;
},
});
}