|
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'; |
@@ -175,14 +176,30 @@ export abstract class CommitFileNodeBase< |
175 | 176 | line = this.options?.selection?.active.line ?? 0; |
176 | 177 | } |
177 | 178 |
|
| 179 | + const showOptions: TextDocumentShowOptions = { |
| 180 | + preserveFocus: true, |
| 181 | + preview: true, |
| 182 | + }; |
| 183 | + |
| 184 | + const filesConfig = this.view.config.files; |
| 185 | + if ('openDiffOnClick' in filesConfig && filesConfig.openDiffOnClick === false) { |
| 186 | + const commandArgs: OpenFileAtRevisionCommandArgs = { |
| 187 | + revisionUri: GitUri.fromFile(this.file, this.commit.repoPath, this.ref.ref), |
| 188 | + line: line, |
| 189 | + showOptions: showOptions, |
| 190 | + }; |
| 191 | + return { |
| 192 | + title: 'Open File', |
| 193 | + command: Commands.OpenFileAtRevision, |
| 194 | + arguments: [commandArgs], |
| 195 | + }; |
| 196 | + } |
| 197 | + |
178 | 198 | const commandArgs: DiffWithPreviousCommandArgs = { |
179 | 199 | commit: this.commit, |
180 | 200 | uri: GitUri.fromFile(this.file, this.commit.repoPath), |
181 | 201 | line: line, |
182 | | - showOptions: { |
183 | | - preserveFocus: true, |
184 | | - preview: true, |
185 | | - }, |
| 202 | + showOptions: showOptions, |
186 | 203 | }; |
187 | 204 | return { |
188 | 205 | title: 'Open Changes with Previous Revision', |
|
0 commit comments