Browse Source

Ensures "Open Details" opens the right view

main
Eric Amodio 1 year ago
parent
commit
136d43e3fe
2 changed files with 13 additions and 0 deletions
  1. +8
    -0
      src/git/actions/commit.ts
  2. +5
    -0
      src/plus/webviews/graph/graphWebview.ts

+ 8
- 0
src/git/actions/commit.ts View File

@ -593,6 +593,14 @@ export function showDetailsView(
return Container.instance.commitDetailsView.show({ preserveFocus: preserveFocus }, opts);
}
export function showGraphDetailsView(
commit: GitRevisionReference | GitCommit,
options?: { pin?: boolean; preserveFocus?: boolean; preserveVisibility?: boolean },
): Promise<void> {
const { preserveFocus, ...opts } = { ...options, commit: commit };
return Container.instance.graphDetailsView.show({ preserveFocus: preserveFocus }, opts);
}
export async function showInCommitGraph(
commit: GitRevisionReference | GitCommit,
options?: { preserveFocus?: boolean },

+ 5
- 0
src/plus/webviews/graph/graphWebview.ts View File

@ -18,6 +18,7 @@ import { getContext, onDidChangeContext } from '../../../context';
import type { CommitSelectedEvent } from '../../../eventBus';
import { PlusFeatures } from '../../../features';
import * as BranchActions from '../../../git/actions/branch';
import { showGraphDetailsView } from '../../../git/actions/commit';
import * as ContributorActions from '../../../git/actions/contributor';
import * as RepoActions from '../../../git/actions/repository';
import * as StashActions from '../../../git/actions/stash';
@ -2123,6 +2124,10 @@ export class GraphWebviewProvider implements WebviewProvider {
const ref = this.getGraphItemRef(item, 'revision');
if (ref == null) return Promise.resolve();
if (this.host.isView()) {
return void showGraphDetailsView(ref, { preserveFocus: true, preserveVisibility: false });
}
return executeCommand<ShowCommitsInViewCommandArgs>(Commands.ShowInDetailsView, {
repoPath: ref.repoPath,
refs: [ref.ref],

Loading…
Cancel
Save