From 60adad854109484c0c07176b9738f0e92bfc1884 Mon Sep 17 00:00:00 2001 From: Eric Amodio <eamodio@gmail.com> Date: Wed, 6 Jan 2021 00:57:40 -0500 Subject: [PATCH] Closes #1156 - adds quick open file history --- CHANGELOG.md | 6 ++++ package.json | 46 +++++++++++++++++++++----- src/commands/common.ts | 1 + src/commands/showQuickFileHistory.ts | 2 +- src/webviews/apps/settings/partials/menus.html | 16 ++++++--- 5 files changed, 58 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05f274d..9fb9676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Added + +- Adds a new _Quick Open File History_ command to all places where _Open File History_ already exists — closes [#1156](https://github.com/eamodio/vscode-gitlens/issues/1156) + ## [11.1.3] - 2021-01-05 ### Fixed diff --git a/package.json b/package.json index ba6cad9..a2cd2af 100644 --- a/package.json +++ b/package.json @@ -133,6 +133,7 @@ "onCommand:gitlens.showQuickRevisionDetailsInDiffLeft", "onCommand:gitlens.showQuickRevisionDetailsInDiffRight", "onCommand:gitlens.showQuickFileHistory", + "onCommand:gitlens.quickOpenFileHistory", "onCommand:gitlens.showQuickBranchHistory", "onCommand:gitlens.showQuickRepoHistory", "onCommand:gitlens.showQuickRepoStatus", @@ -3128,6 +3129,11 @@ "category": "GitLens" }, { + "command": "gitlens.quickOpenFileHistory", + "title": "Quick Open File History", + "category": "GitLens" + }, + { "command": "gitlens.showQuickBranchHistory", "title": "Show Branch History", "category": "GitLens" @@ -4963,6 +4969,10 @@ "when": "gitlens:activeFileStatus =~ /tracked/" }, { + "command": "gitlens.quickOpenFileHistory", + "when": "gitlens:activeFileStatus =~ /tracked/" + }, + { "command": "gitlens.showQuickBranchHistory", "when": "gitlens:enabled" }, @@ -5981,6 +5991,11 @@ "group": "2_gitlens@5" }, { + "command": "gitlens.quickOpenFileHistory", + "when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editor.history", + "group": "2_gitlens@6" + }, + { "submenu": "gitlens/editor/annotations", "when": "editorTextFocus && gitlens:activeFileStatus =~ /blameable/ && config.gitlens.menus.editor.blame", "group": "2_gitlens_1@5" @@ -6151,6 +6166,11 @@ "command": "gitlens.showFileHistoryInView", "when": "gitlens:enabled && config.gitlens.menus.editorTab.history", "group": "2_gitlens@4" + }, + { + "command": "gitlens.quickOpenFileHistory", + "when": "gitlens:enabled && config.gitlens.menus.editorTab.history", + "group": "2_gitlens@5" } ], "explorer/context": [ @@ -6174,7 +6194,12 @@ { "command": "gitlens.showFileHistoryInView", "when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled && config.gitlens.menus.explorer.history", - "group": "4_gitlens@3" + "group": "4_timeline@2" + }, + { + "command": "gitlens.quickOpenFileHistory", + "when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled && config.gitlens.menus.explorer.history", + "group": "4_timeline@3" }, { "command": "gitlens.copyRemoteFileUrlToClipboard", @@ -6237,21 +6262,16 @@ { "command": "gitlens.openFileOnRemote", "when": "gitlens:enabled && gitlens:hasRemotes && scmProvider == git && scmResourceGroup =~ /^(workingTree|index|merge)$/ && config.gitlens.menus.scmItem.remote", - "group": "navigation@97", + "group": "navigation@96", "alt": "gitlens.copyRemoteFileUrlToClipboard" }, { "command": "gitlens.openFileOnRemoteFrom", "when": "gitlens:enabled && gitlens:hasRemotes && scmProvider == git && scmResourceGroup =~ /^(workingTree|index|merge)$/ && config.gitlens.menus.scmItem.remote", - "group": "navigation@98", + "group": "navigation@97", "alt": "gitlens.copyRemoteFileUrlFrom" }, { - "command": "gitlens.showFileHistoryInView", - "when": "gitlens:enabled && scmProvider == git && scmResourceGroup =~ /^(workingTree|index|merge)$/ && config.gitlens.menus.scmItem.history", - "group": "navigation@99" - }, - { "command": "gitlens.stashSaveFiles", "when": "gitlens:enabled && !gitlens:readonly && scmProvider == git && scmResourceGroup =~ /^(workingTree|index)$/ && config.gitlens.menus.scmItem.stash", "group": "1_modification@2" @@ -6260,6 +6280,16 @@ "command": "gitlens.copyRemoteFileUrlToClipboard", "when": "gitlens:enabled && gitlens:hasRemotes && scmProvider == git && scmResourceGroup =~ /^(workingTree|index|merge)$/ && config.gitlens.menus.scmItem.clipboard", "group": "2_gitlens@1" + }, + { + "command": "gitlens.showFileHistoryInView", + "when": "gitlens:enabled && scmProvider == git && scmResourceGroup =~ /^(workingTree|index|merge)$/ && config.gitlens.menus.scmItem.history", + "group": "4_timeline@2" + }, + { + "command": "gitlens.quickOpenFileHistory", + "when": "gitlens:enabled && scmProvider == git && scmResourceGroup =~ /^(workingTree|index|merge)$/ && config.gitlens.menus.scmItem.history", + "group": "4_timeline@3" } ], "timeline/item/context": [ diff --git a/src/commands/common.ts b/src/commands/common.ts index b3a6d18..a677997 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -97,6 +97,7 @@ export enum Commands { PullRepositories = 'gitlens.pullRepositories', PushRepositories = 'gitlens.pushRepositories', GitCommands = 'gitlens.gitCommands', + QuickOpenFileHistory = 'gitlens.quickOpenFileHistory', RefreshHover = 'gitlens.refreshHover', ResetRemoteConnectionAuthorization = 'gitlens.resetRemoteConnectionAuthorization', ResetSuppressedWarnings = 'gitlens.resetSuppressedWarnings', diff --git a/src/commands/showQuickFileHistory.ts b/src/commands/showQuickFileHistory.ts index bad1e4e..15d6de8 100644 --- a/src/commands/showQuickFileHistory.ts +++ b/src/commands/showQuickFileHistory.ts @@ -21,7 +21,7 @@ export interface ShowQuickFileHistoryCommandArgs { @command() export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand { constructor() { - super([Commands.ShowFileHistoryInView, Commands.ShowQuickFileHistory]); + super([Commands.ShowFileHistoryInView, Commands.ShowQuickFileHistory, Commands.QuickOpenFileHistory]); } protected preExecute(context: CommandContext, args?: ShowQuickFileHistoryCommandArgs) { diff --git a/src/webviews/apps/settings/partials/menus.html b/src/webviews/apps/settings/partials/menus.html index 19a1648..7d6b22c 100644 --- a/src/webviews/apps/settings/partials/menus.html +++ b/src/webviews/apps/settings/partials/menus.html @@ -77,7 +77,9 @@ data-setting-type="object" disabled /> - <label for="menus.editor.history">Add <i>Open File History</i> command</label> + <label for="menus.editor.history" + >Add <i>Open File History</i> and <i>Quick Open File History</i> commands</label + > </div> </div> @@ -179,7 +181,9 @@ data-setting-type="object" disabled /> - <label for="menus.editorTab.history">Add <i>Open File History</i> command</label> + <label for="menus.editorTab.history" + >Add <i>Open File History</i> and <i>Quick Open File History</i> commands</label + > </div> </div> </div> @@ -301,7 +305,9 @@ data-setting-type="object" disabled /> - <label for="menus.explorer.history">Add <i>Open File History</i> command</label> + <label for="menus.explorer.history" + >Add <i>Open File History</i> and <i>Quick Open File History</i> commands</label + > </div> </div> @@ -501,7 +507,9 @@ data-setting-type="object" disabled /> - <label for="menus.scmItem.history">Add <i>Open File History</i> command</label> + <label for="menus.scmItem.history" + >Add <i>Open File History</i> and <i>Quick Open File History</i> commands</label + > </div> </div>