Bladeren bron

Change graph to always show commit details view

main
Eric Amodio 2 jaren geleden
bovenliggende
commit
0705216e52
5 gewijzigde bestanden met toevoegingen van 21 en 9 verwijderingen
  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 Bestand weergeven

@ -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 Bestand weergeven

@ -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 Bestand weergeven

@ -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 Bestand weergeven

@ -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 Bestand weergeven

@ -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),
);

Laden…
Annuleren
Opslaan