浏览代码

Change graph to always show commit details view

main
Eric Amodio 2 年前
父节点
当前提交
0705216e52
共有 5 个文件被更改,包括 21 次插入9 次删除
  1. +5
    -2
      src/commands/gitCommands.actions.ts
  2. +5
    -0
      src/plus/webviews/graph/graphWebview.ts
  3. +1
    -1
      src/plus/webviews/timeline/timelineWebview.ts
  4. +1
    -1
      src/plus/webviews/timeline/timelineWebviewView.ts
  5. +9
    -5
      src/webviews/commitDetails/commitDetailsWebviewView.ts

+ 5
- 2
src/commands/gitCommands.actions.ts 查看文件

@ -757,8 +757,11 @@ export namespace GitActions {
}));
}
export function showDetailsView(commit: GitCommit): Promise<void> {
return Container.instance.commitDetailsView.show({ commit: commit });
export function showDetailsView(
commit: GitCommit,
options?: { pin?: boolean; preserveFocus?: boolean },
): Promise<void> {
return Container.instance.commitDetailsView.show({ ...options, commit: commit });
}
}

+ 5
- 0
src/plus/webviews/graph/graphWebview.ts 查看文件

@ -3,6 +3,7 @@ import { commitNodeType, mergeNodeType, stashNodeType } from '@gitkraken/gitkrak
import type { ColorTheme, ConfigurationChangeEvent, Disposable, Event, StatusBarItem } from 'vscode';
import { ColorThemeKind, EventEmitter, MarkdownString, StatusBarAlignment, Uri, ViewColumn, window } from 'vscode';
import { parseCommandContext } from '../../../commands/base';
import { GitActions } from '../../../commands/gitCommands.actions';
import type { GraphColumnConfig } from '../../../configuration';
import { configuration } from '../../../configuration';
import { Commands } from '../../../constants';
@ -210,6 +211,10 @@ export class GraphWebview extends WebviewBase {
}
this._onDidChangeSelection.fire({ selection: commits ?? [] });
if (commits == null) return;
void GitActions.Commit.showDetailsView(commits[0], { pin: true, preserveFocus: true });
}
private async notifyDidChangeConfig() {

+ 1
- 1
src/plus/webviews/timeline/timelineWebview.ts 查看文件

@ -148,7 +148,7 @@ export class TimelineWebview extends WebviewBase {
const commit = await repository.getCommit(params.data.id);
if (commit == null) return;
void GitActions.Commit.showDetailsView(commit);
void GitActions.Commit.showDetailsView(commit, { pin: true, preserveFocus: true });
});
break;

+ 1
- 1
src/plus/webviews/timeline/timelineWebviewView.ts 查看文件

@ -127,7 +127,7 @@ export class TimelineWebviewView extends WebviewViewBase {
const commit = await repository.getCommit(params.data.id);
if (commit == null) return;
void GitActions.Commit.showDetailsView(commit);
void GitActions.Commit.showDetailsView(commit, { pin: true, preserveFocus: true });
});
break;

+ 9
- 5
src/webviews/commitDetails/commitDetailsWebviewView.ts 查看文件

@ -80,15 +80,20 @@ export class CommitDetailsWebviewView extends WebviewViewBase
};
}
override async show(options?: { commit?: GitCommit; preserveFocus?: boolean | undefined }): Promise<void> {
override async show(options?: {
commit?: GitCommit;
pin?: boolean;
preserveFocus?: boolean | undefined;
}): Promise<void> {
if (options != null) {
let commit;
({ commit, ...options } = options);
let pin;
({ commit, pin, ...options } = options);
if (commit == null) {
commit = this.getBestCommit();
}
if (commit != null) {
this.updateCommit(commit, { pinned: true });
this.updateCommit(commit, { pinned: pin ?? true });
}
}
@ -136,12 +141,11 @@ export class CommitDetailsWebviewView extends WebviewViewBase
if (this._pinned || !this.visible) return;
const { lineTracker, commitsView, graphWebview, stashesView } = this.container;
const { lineTracker, commitsView, stashesView } = this.container;
this._visibilityDisposable = Disposable.from(
lineTracker.subscribe(this, lineTracker.onDidChangeActiveLines(this.onActiveLinesChanged, this)),
commitsView.onDidChangeVisibility(this.onCommitsViewVisibilityChanged, this),
commitsView.onDidChangeSelection(this.onCommitsViewSelectionChanged, this),
graphWebview.onDidChangeSelection(this.onGraphWebviewSelectionChanged, this),
stashesView.onDidChangeSelection(this.onStashesViewSelectionChanged, this),
);

正在加载...
取消
保存