|
1 |
| -import type { Command, Selection } from 'vscode'; |
| 1 | +import type { Command, Selection, TextDocumentShowOptions } from 'vscode'; |
2 | 2 | import { MarkdownString, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
|
3 | 3 | import type { DiffWithPreviousCommandArgs } from '../../commands/diffWithPrevious';
|
| 4 | +import type { OpenFileAtRevisionCommandArgs } from '../../commands/openFileAtRevision'; |
4 | 5 | import { Schemes } from '../../constants';
|
5 | 6 | import { Commands } from '../../constants.commands';
|
6 | 7 | import type { TreeViewRefFileNodeTypes } from '../../constants.views';
|
@@ -176,14 +177,30 @@ export abstract class CommitFileNodeBase<
|
176 | 177 | line = this.options?.selection?.active.line ?? 0;
|
177 | 178 | }
|
178 | 179 |
|
| 180 | + const showOptions: TextDocumentShowOptions = { |
| 181 | + preserveFocus: true, |
| 182 | + preview: true, |
| 183 | + }; |
| 184 | + |
| 185 | + const filesConfig = this.view.config.files; |
| 186 | + if ('openDiffOnClick' in filesConfig && filesConfig.openDiffOnClick === false) { |
| 187 | + const commandArgs: OpenFileAtRevisionCommandArgs = { |
| 188 | + revisionUri: GitUri.fromFile(this.file, this.commit.repoPath, this.ref.ref), |
| 189 | + line: line, |
| 190 | + showOptions: showOptions, |
| 191 | + }; |
| 192 | + return { |
| 193 | + title: 'Open File', |
| 194 | + command: Commands.OpenFileAtRevision, |
| 195 | + arguments: [commandArgs], |
| 196 | + }; |
| 197 | + } |
| 198 | + |
179 | 199 | const commandArgs: DiffWithPreviousCommandArgs = {
|
180 | 200 | commit: this.commit,
|
181 | 201 | uri: GitUri.fromFile(this.file, this.commit.repoPath),
|
182 | 202 | line: line,
|
183 |
| - showOptions: { |
184 |
| - preserveFocus: true, |
185 |
| - preview: true, |
186 |
| - }, |
| 203 | + showOptions: showOptions, |
187 | 204 | };
|
188 | 205 | return {
|
189 | 206 | title: 'Open Changes with Previous Revision',
|
|
0 commit comments