Browse Source

Adds Show Revision Details command to editor toolbar

main
Eric Amodio 6 years ago
parent
commit
dbeddcb207
3 changed files with 31 additions and 5 deletions
  1. +20
    -2
      package.json
  2. +3
    -2
      src/commands/common.ts
  3. +8
    -1
      src/commands/showQuickCommitDetails.ts

+ 20
- 2
package.json View File

@ -1707,6 +1707,15 @@
"category": "GitLens" "category": "GitLens"
}, },
{ {
"command": "gitlens.showQuickRevisionDetails",
"title": "Show Revision Details",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-commit.svg",
"light": "images/light/icon-commit.svg"
}
},
{
"command": "gitlens.showQuickFileHistory", "command": "gitlens.showQuickFileHistory",
"title": "Show File History", "title": "Show File History",
"category": "GitLens" "category": "GitLens"
@ -2403,7 +2412,11 @@
}, },
{ {
"command": "gitlens.showQuickCommitFileDetails", "command": "gitlens.showQuickCommitFileDetails",
"when": "editorTextFocus && gitlens:activeFileStatus =~ /blameable/"
"when": "gitlens:activeFileStatus =~ /blameable/"
},
{
"command": "gitlens.showQuickRevisionDetails",
"when": "gitlens:activeFileStatus =~ /revision/"
}, },
{ {
"command": "gitlens.showQuickFileHistory", "command": "gitlens.showQuickFileHistory",
@ -2855,12 +2868,17 @@
"command": "gitlens.diffWithPrevious", "command": "gitlens.diffWithPrevious",
"alt": "gitlens.diffWithRevision", "alt": "gitlens.diffWithRevision",
"when": "!isInDiffEditor && gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare", "when": "!isInDiffEditor && gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare",
"group": "navigation@98"
"group": "navigation@97"
}, },
{ {
"command": "gitlens.diffWithPreviousInDiff", "command": "gitlens.diffWithPreviousInDiff",
"alt": "gitlens.diffWithRevision", "alt": "gitlens.diffWithRevision",
"when": "isInDiffEditor && gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare", "when": "isInDiffEditor && gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare",
"group": "navigation@97"
},
{
"command": "gitlens.showQuickRevisionDetails",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git",
"group": "navigation@98" "group": "navigation@98"
}, },
{ {

+ 3
- 2
src/commands/common.ts View File

@ -58,12 +58,13 @@ export enum Commands {
ShowFileHistoryExplorer = 'gitlens.showFileHistoryExplorer', ShowFileHistoryExplorer = 'gitlens.showFileHistoryExplorer',
ShowLineHistoryExplorer = 'gitlens.showLineHistoryExplorer', ShowLineHistoryExplorer = 'gitlens.showLineHistoryExplorer',
ShowLastQuickPick = 'gitlens.showLastQuickPick', ShowLastQuickPick = 'gitlens.showLastQuickPick',
ShowQuickBranchHistory = 'gitlens.showQuickBranchHistory',
ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails', ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails',
ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails', ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails',
ShowQuickFileHistory = 'gitlens.showQuickFileHistory',
ShowQuickBranchHistory = 'gitlens.showQuickBranchHistory',
ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory', ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory',
ShowQuickFileHistory = 'gitlens.showQuickFileHistory',
ShowQuickRepoStatus = 'gitlens.showQuickRepoStatus', ShowQuickRepoStatus = 'gitlens.showQuickRepoStatus',
ShowQuickRevisionDetails = 'gitlens.showQuickRevisionDetails',
ShowQuickStashList = 'gitlens.showQuickStashList', ShowQuickStashList = 'gitlens.showQuickStashList',
ShowRepositoriesExplorer = 'gitlens.showRepositoriesExplorer', ShowRepositoriesExplorer = 'gitlens.showRepositoriesExplorer',
ShowResultsExplorer = 'gitlens.showResultsExplorer', ShowResultsExplorer = 'gitlens.showResultsExplorer',

+ 8
- 1
src/commands/showQuickCommitDetails.ts View File

@ -37,10 +37,17 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
} }
constructor() { constructor() {
super(Commands.ShowQuickCommitDetails);
super([Commands.ShowQuickCommitDetails, Commands.ShowQuickRevisionDetails]);
} }
protected async preExecute(context: CommandContext, args: ShowQuickCommitDetailsCommandArgs = {}): Promise<any> { protected async preExecute(context: CommandContext, args: ShowQuickCommitDetailsCommandArgs = {}): Promise<any> {
if (context.command === Commands.ShowQuickRevisionDetails && context.editor !== undefined) {
args = { ...args };
const gitUri = await GitUri.fromUri(context.editor.document.uri);
args.sha = gitUri.sha;
}
if (context.type === 'viewItem') { if (context.type === 'viewItem') {
args = { ...args }; args = { ...args };
args.sha = context.node.uri.sha; args.sha = context.node.uri.sha;

Loading…
Cancel
Save