Skip to content

Commit 928bf3e

Browse files
committed
Fixes gitkraken#1651 - search & compare opens file instead of diff
1 parent e0a0136 commit 928bf3e

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- Changes _Search & Compare_ to default to open file instead of diff
12+
- Closes [#1651](https://github.com/gitkraken/vscode-gitlens/issues/1651)
13+
914
## [14.2.0] - 2023-08-04
1015

1116
### Added

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ A big thanks to the people that have contributed to this project 🙏❤️:
422422
- Zyck ([@qzyse2017](https://github.com/qzyse2017)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=qzyse2017)
423423
- Yonatan Greenfeld ([@YonatanGreenfeld](https://github.com/YonatanGreenfeld)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=YonatanGreenfeld)
424424
- WofWca ([@WofWca](https://github.com/WofWca)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=WofWca)
425+
- Svaught598 ([@Svaught598](https://github.com/svaught598)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=Svaught598)
425426

426427
Also special thanks to the people that have provided support, testing, brainstorming, etc:
427428

src/views/nodes/commitFileNode.ts

+7-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Command, Selection } from 'vscode';
22
import { MarkdownString, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
3-
import type { DiffWithPreviousCommandArgs } from '../../commands';
3+
import type { OpenFileAtRevisionCommandArgs } from '../../commands';
44
import { Commands, Schemes } from '../../constants';
55
import { StatusFileFormatter } from '../../git/formatters/statusFormatter';
66
import { GitUri } from '../../git/gitUri';
@@ -161,26 +161,14 @@ export class CommitFileNode<
161161
}
162162

163163
override getCommand(): Command | undefined {
164-
let line;
165-
if (this.commit.lines.length) {
166-
line = this.commit.lines[0].line - 1;
167-
} else {
168-
line = this._options.selection?.active.line ?? 0;
169-
}
170-
171-
const commandArgs: DiffWithPreviousCommandArgs = {
172-
commit: this.commit,
173-
uri: GitUri.fromFile(this.file, this.commit.repoPath),
174-
line: line,
175-
showOptions: {
176-
preserveFocus: true,
177-
preview: true,
178-
},
164+
const commandArgs: OpenFileAtRevisionCommandArgs = {
165+
revisionUri: GitUri.fromFile(this.file, this.uri.repoPath!, this.ref.ref),
179166
};
167+
180168
return {
181-
title: 'Open Changes with Previous Revision',
182-
command: Commands.DiffWithPrevious,
183-
arguments: [undefined, commandArgs],
169+
title: 'Open File',
170+
command: Commands.OpenFileAtRevision,
171+
arguments: [commandArgs],
184172
};
185173
}
186174
}

0 commit comments

Comments
 (0)