дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
feat(vcs): add Preview Diff toggle to the Commit tool window (#1615)
A Preview Diff toggle in the Commit tool window's changes toolbar (and View Options › Show Diff Preview) shows the selected file's working-tree diff in an embedded, resizable pane: beside the changes and the commit message when the window is bottom-docked, below them when side-docked, as in the Local Changes tab. Off by default and remembered; empty states when nothing or several files are selected, or there are no changes. Co-authored-by: Inf1mum <[email protected]>
Цей коміт міститься в:
1 джерело
800949b7b5
коміт
4830f42168
4 files changed
+201
-7
No files matched your search
@@ -18,6 +18,8 @@ interface CommitState {
|
||||
groupByStaging: boolean;
|
||||
/** Whether the Git window's Local Changes tab previews the selection's diff. */
|
||||
diffPreview: boolean;
|
||||
/** Whether the Commit tool window previews the selection's diff beside the changes (#1599). */
|
||||
commitDiffPreview: boolean;
|
||||
/** User overrides of the inclusion checkboxes (absolute path → state). */
|
||||
checks: Map<string, CheckState>;
|
||||
/** Changed blocks left out of the commit (absolute path → `hunkKeys`) of `hunks` files. */
|
||||
@@ -48,6 +50,7 @@ export const useCommit = create<CommitState>(() => ({
|
||||
groupByDir: readBool("openidea.vcs.groupByDir", false),
|
||||
groupByStaging: readBool("openidea.vcs.groupByStaging", false),
|
||||
diffPreview: readBool("openidea.vcs.diffPreview", true),
|
||||
commitDiffPreview: readBool("openidea.vcs.commitDiffPreview", false),
|
||||
checks: new Map(),
|
||||
excludedHunks: new Map(),
|
||||
selection: [],
|
||||
@@ -95,6 +98,15 @@ export function setDiffPreview(v: boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
export function setCommitDiffPreview(v: boolean) {
|
||||
useCommit.setState({ commitDiffPreview: v });
|
||||
try {
|
||||
localStorage.setItem("openidea.vcs.commitDiffPreview", String(v));
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
const historyKey = () => `openidea.vcs.commitMessages:${useVcs.getState().root ?? ""}`;
|
||||
const MAX_HISTORY = 20;
|
||||
|
||||
|
||||
Reference in new issue
Заблокувати користувача