From d11c6c5bf570217f624ac64b959fd0fcd8f8913d Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 21 Dec 2020 03:19:00 -0500 Subject: [PATCH] Adds show/hide branch comparison to repos view --- package.json | 28 ++++++++++++++++++++++++++++ src/views/repositoriesView.ts | 27 ++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6a5d04f..530c14b 100644 --- a/package.json +++ b/package.json @@ -4305,6 +4305,16 @@ "category": "GitLens" }, { + "command": "gitlens.views.repositories.setShowBranchComparisonOn", + "title": "Show Branch Comparison", + "category": "GitLens" + }, + { + "command": "gitlens.views.repositories.setShowBranchComparisonOff", + "title": "Hide Branch Comparison", + "category": "GitLens" + }, + { "command": "gitlens.views.searchAndCompare.clear", "title": "Clear Results", "category": "GitLens", @@ -5585,6 +5595,14 @@ "when": "false" }, { + "command": "gitlens.views.repositories.setShowBranchComparisonOn", + "when": "false" + }, + { + "command": "gitlens.views.repositories.setShowBranchComparisonOff", + "when": "false" + }, + { "command": "gitlens.views.searchAndCompare.clear", "when": "false" }, @@ -6446,6 +6464,16 @@ "group": "5_gitlens@0" }, { + "command": "gitlens.views.repositories.setShowBranchComparisonOn", + "when": "view =~ /^gitlens\\.views\\.repositories/ && !config.gitlens.views.repositories.showBranchComparison", + "group": "5_gitlens@1" + }, + { + "command": "gitlens.views.repositories.setShowBranchComparisonOff", + "when": "view =~ /^gitlens\\.views\\.repositories/ && config.gitlens.views.repositories.showBranchComparison", + "group": "5_gitlens@1" + }, + { "submenu": "gitlens/view/searchAndCompare/new", "when": "view =~ /^gitlens\\.views\\.searchAndCompare\\b/", "group": "navigation@10" diff --git a/src/views/repositoriesView.ts b/src/views/repositoriesView.ts index b1a3164..522d5eb 100644 --- a/src/views/repositoriesView.ts +++ b/src/views/repositoriesView.ts @@ -8,7 +8,13 @@ import { ProgressLocation, window, } from 'vscode'; -import { configuration, RepositoriesViewConfig, ViewBranchesLayout, ViewFilesLayout } from '../configuration'; +import { + configuration, + RepositoriesViewConfig, + ViewBranchesLayout, + ViewFilesLayout, + ViewShowBranchComparison, +} from '../configuration'; import { ContextKeys, setContext, WorkspaceState } from '../constants'; import { Container } from '../container'; import { @@ -97,6 +103,16 @@ export class RepositoriesView extends ViewBase this.setShowAvatars(true), this); commands.registerCommand(this.getQualifiedCommand('setShowAvatarsOff'), () => this.setShowAvatars(false), this); + commands.registerCommand( + this.getQualifiedCommand('setShowBranchComparisonOn'), + () => this.setShowBranchComparison(true), + this, + ); + commands.registerCommand( + this.getQualifiedCommand('setShowBranchComparisonOff'), + () => this.setShowBranchComparison(false), + this, + ); } protected filterConfigurationChanged(e: ConfigurationChangeEvent) { @@ -548,4 +564,13 @@ export class RepositoriesView extends ViewBase