Browse Source

Opens file/diff to side if graph/rebase is active

main
Eric Amodio 1 year ago
parent
commit
2e2e7d06ec
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      src/webviews/commitDetails/commitDetailsWebviewView.ts

+ 11
- 4
src/webviews/commitDetails/commitDetailsWebviewView.ts View File

@ -1,10 +1,11 @@
import type {
CancellationToken,
ConfigurationChangeEvent,
TextDocumentShowOptions,
TreeViewSelectionChangeEvent,
TreeViewVisibilityChangeEvent,
} from 'vscode';
import { CancellationTokenSource, Disposable, Uri, window } from 'vscode';
import { CancellationTokenSource, Disposable, Uri, ViewColumn, window } from 'vscode';
import { serializeAutolink } from '../../annotations/autolinks';
import type { CopyShaToClipboardCommandArgs } from '../../commands';
import { executeGitCommand, GitActions } from '../../commands/gitCommands.actions';
@ -848,7 +849,7 @@ export class CommitDetailsWebviewView extends WebviewViewBase
void GitActions.Commit.openChangesWithWorking(file.path, commit, {
preserveFocus: true,
preview: true,
...params.showOptions,
...this.getShowOptions(params),
});
}
@ -862,7 +863,7 @@ export class CommitDetailsWebviewView extends WebviewViewBase
void GitActions.Commit.openChanges(file.path, commit, {
preserveFocus: true,
preview: true,
...params.showOptions,
...this.getShowOptions(params),
});
}
@ -876,7 +877,7 @@ export class CommitDetailsWebviewView extends WebviewViewBase
void GitActions.Commit.openFile(file.path, commit, {
preserveFocus: true,
preview: true,
...params.showOptions,
...this.getShowOptions(params),
});
}
@ -888,6 +889,12 @@ export class CommitDetailsWebviewView extends WebviewViewBase
void GitActions.Commit.openFileOnRemote(file.path, commit);
}
private getShowOptions(params: FileActionParams): TextDocumentShowOptions | undefined {
return getContext('gitlens:webview:graph:active') || getContext('gitlens:webview:rebaseEditor:active')
? { ...params.showOptions, viewColumn: ViewColumn.Beside }
: params.showOptions;
}
}
// async function summaryModel(commit: GitCommit): Promise<CommitSummary> {

Loading…
Cancel
Save