Parcourir la source

Adds show/hide branch comparison to repos view

main
Eric Amodio il y a 4 ans
Parent
révision
d11c6c5bf5
2 fichiers modifiés avec 54 ajouts et 1 suppressions
  1. +28
    -0
      package.json
  2. +26
    -1
      src/views/repositoriesView.ts

+ 28
- 0
package.json Voir le fichier

@ -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"

+ 26
- 1
src/views/repositoriesView.ts Voir le fichier

@ -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
);
commands.registerCommand(this.getQualifiedCommand('setShowAvatarsOn'), () => 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
private setShowAvatars(enabled: boolean) {
return configuration.updateEffective('views', this.configKey, 'avatars', enabled);
}
private setShowBranchComparison(enabled: boolean) {
return configuration.updateEffective(
'views',
this.configKey,
'showBranchComparison',
enabled ? ViewShowBranchComparison.Working : false,
);
}
}

Chargement…
Annuler
Enregistrer