Файли
openidea/src/features/vcs/diffNavigator.ts
T
l0ng-ai b2dc59eb0f feat(diff): blank diff window, Swap Sides, and Search In Changes (#3540)
- Open Blank Diff Window: a new diff tab with two empty, editable sides;
  the editor's selection fills the left one. Text typed into either side
  survives viewer changes (mode, highlighting, Swap Sides).
- Swap Sides: a toolbar button and action for diffs whose sides the user
  picked (Compare With…, Compare Files, Compare with Clipboard, the
  command-line diff and blank diffs). Diffs of revisions keep their order.
- Search In Changes: a find bar filter in diffs that limits matches to the
  changed ranges of the searched side. It is per diff and applies to
  finding only; the replace bar searches the whole side.
2026-11-15 21:59:59 +08:00

33 рядки
1.3 KiB
TypeScript

/** The focused diff editor's chunk navigation, for actions that must not load the diff editor. */
import type { DiffViewerHost } from "./diffViewerProviders";
export interface DiffNavigator {
next(): void;
prev(): void;
jumpToSource(): void;
/** Apply the change at the caret from the left side to the right (`a`) or back (`b`). */
applyChange(source: "a" | "b"): boolean;
/** Open the next / previous file of the diff chain (changes of a commit or change list). */
file(dir: 1 | -1): void;
/** The viewer's settings as a popup menu (⇧⌘D). */
showSettings(): void;
/** IDEA's Select Opposite Diff Pane: focus the other side of a side-by-side diff; false when there is none. */
focusOpposite(): boolean;
/** IDEA's Close Diff Editor (Esc): closes the diff's editor tab; false when the diff isn't one. */
close(): boolean;
/** Swap Sides of a diff whose sides the user picked; false when it has none to swap. */
swapSides(): boolean;
/** The built panes, for diff viewer contributions' actions (null while loading). */
viewer?(): DiffViewerHost | null;
}
let focused: DiffNavigator | null = null;
export function focusedDiffNavigator(): DiffNavigator | null {
return focused;
}
export function setFocusedDiffNavigator(nav: DiffNavigator | null) {
focused = nav;
}