Переглянути джерело

Updates Show Commit Details command to open view

main
Eric Amodio 2 роки тому
джерело
коміт
14a12b8bb5
3 змінених файлів з 37 додано та 17 видалено
  1. +12
    -11
      package.json
  2. +20
    -1
      src/commands/showCommitsInView.ts
  3. +5
    -5
      src/webviews/apps/settings/partials/code-lens.html

+ 12
- 11
package.json Переглянути файл

@ -381,7 +381,7 @@
"Toggles file changes from the commit",
"Compares the current committed file with the previous commit",
"Reveals the commit in the Side Bar",
"Searches for the commit",
"Shows the commit details",
"Shows a commit details quick pick menu",
"Shows a commit file details quick pick menu",
"Shows a file history quick pick menu",
@ -548,7 +548,7 @@
"Compares the current line commit with the previous",
"Compares the current line commit with the working tree",
"Reveals the commit in the Side Bar",
"Searches for the commit",
"Shows the commit details",
"Shows a commit details quick pick menu",
"Shows a commit file details quick pick menu",
"Shows a file history quick pick menu",
@ -4446,8 +4446,9 @@
},
{
"command": "gitlens.showCommitInView",
"title": "Search for Commit in Side Bar",
"category": "GitLens"
"title": "Show Commit Details",
"category": "GitLens",
"icon": "$(eye)"
},
{
"command": "gitlens.showCommitsInView",
@ -9462,10 +9463,9 @@
"group": "2_gitlens_quickopen@1"
},
{
"command": "gitlens.openCommitOnRemote",
"when": "viewItem =~ /gitlens:commit\\b/ && gitlens:hasRemotes",
"group": "3_gitlens_explore@0",
"alt": "gitlens.copyRemoteCommitUrl"
"command": "gitlens.showCommitInView",
"when": "viewItem =~ /gitlens:commit\\b/",
"group": "3_gitlens_explore@0"
},
{
"command": "gitlens.revealCommitInView",
@ -9473,9 +9473,10 @@
"group": "3_gitlens_explore@1"
},
{
"command": "gitlens.showCommitInView",
"when": "viewItem =~ /gitlens:commit\\b/",
"group": "3_gitlens_explore@2"
"command": "gitlens.openCommitOnRemote",
"when": "viewItem =~ /gitlens:commit\\b/ && gitlens:hasRemotes",
"group": "3_gitlens_explore@2",
"alt": "gitlens.copyRemoteCommitUrl"
},
{
"submenu": "gitlens/commit/copy",

+ 20
- 1
src/commands/showCommitsInView.ts Переглянути файл

@ -8,7 +8,8 @@ import { Logger } from '../logger';
import { showFileNotUnderSourceControlWarningMessage, showGenericErrorMessage } from '../messages';
import { command } from '../system/command';
import { filterMap } from '../system/iterable';
import { ActiveEditorCommand, getCommandUri } from './base';
import type { CommandContext } from './base';
import { ActiveEditorCommand, getCommandUri, isCommandContextViewNodeHasCommit } from './base';
export interface ShowCommitsInViewCommandArgs {
refs?: string[];
@ -21,6 +22,18 @@ export class ShowCommitsInViewCommand extends ActiveEditorCommand {
super([Commands.ShowCommitInView, Commands.ShowCommitsInView]);
}
protected override preExecute(context: CommandContext, args?: ShowCommitsInViewCommandArgs) {
if (context.type === 'viewItem') {
args = { ...args };
if (isCommandContextViewNodeHasCommit(context)) {
args.refs = [context.node.commit.sha];
args.repoPath = context.node.commit.repoPath;
}
}
return this.execute(context.editor, context.uri, args);
}
async execute(editor?: TextEditor, uri?: Uri, args?: ShowCommitsInViewCommandArgs) {
args = { ...args };
@ -58,6 +71,12 @@ export class ShowCommitsInViewCommand extends ActiveEditorCommand {
}
}
if (args.refs.length === 1) {
return this.container.commitDetailsView.show({
commit: { ref: args.refs[0], refType: 'revision', repoPath: args.repoPath!, name: '' },
});
}
return executeGitCommand({
command: 'search',
state: {

+ 5
- 5
src/webviews/apps/settings/partials/code-lens.html Переглянути файл

@ -80,12 +80,12 @@
<option value="gitlens.revealCommitInView">
reveals the commit in the Side Bar
</option>
<option value="gitlens.showCommitsInView">searches for the commit</option>
<option value="gitlens.showCommitsInView">shows details of the commit</option>
<option value="gitlens.showQuickCommitDetails">
shows details of the commit
shows quick pick details of the commit
</option>
<option value="gitlens.showQuickCommitFileDetails">
shows file details of the commit (default)
shows quick pick file details of the commit (default)
</option>
<option value="gitlens.showQuickFileHistory">
shows the current file history
@ -166,10 +166,10 @@
searches for commits within the range
</option>
<option value="gitlens.showQuickCommitDetails">
shows details of the commit
shows quick pick details of the commit
</option>
<option value="gitlens.showQuickCommitFileDetails">
show file details of the commit
show quick pick file details of the commit
</option>
<option value="gitlens.showQuickFileHistory">
shows the current file history

Завантаження…
Відмінити
Зберегти