Browse Source

Adds menu toggle for show/hide pr nodes

main
Eric Amodio 4 years ago
parent
commit
737af292d4
4 changed files with 135 additions and 6 deletions
  1. +86
    -2
      package.json
  2. +15
    -0
      src/views/branchesView.ts
  3. +19
    -4
      src/views/commitsView.ts
  4. +15
    -0
      src/views/remotesView.ts

+ 86
- 2
package.json View File

@ -3677,6 +3677,16 @@
"category": "GitLens"
},
{
"command": "gitlens.views.branches.setShowBranchPullRequestOn",
"title": "Show Branch Pull Requests",
"category": "GitLens"
},
{
"command": "gitlens.views.branches.setShowBranchPullRequestOff",
"title": "Hide Branch Pull Requests",
"category": "GitLens"
},
{
"command": "gitlens.views.commits.copy",
"title": "Copy",
"category": "GitLens"
@ -3741,6 +3751,16 @@
"category": "GitLens"
},
{
"command": "gitlens.views.commits.setShowBranchPullRequestOn",
"title": "Show Current Branch Pull Request",
"category": "GitLens"
},
{
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
"title": "Hide Current Branch Pull Request",
"category": "GitLens"
},
{
"command": "gitlens.views.contributors.copy",
"title": "Copy",
"category": "GitLens"
@ -3949,6 +3969,16 @@
"category": "GitLens"
},
{
"command": "gitlens.views.remotes.setShowBranchPullRequestOn",
"title": "Show Branch Pull Requests",
"category": "GitLens"
},
{
"command": "gitlens.views.remotes.setShowBranchPullRequestOff",
"title": "Hide Branch Pull Requests",
"category": "GitLens"
},
{
"command": "gitlens.views.repositories.copy",
"title": "Copy",
"category": "GitLens"
@ -4977,6 +5007,14 @@
"when": "false"
},
{
"command": "gitlens.views.branches.setShowBranchPullRequestOn",
"when": "false"
},
{
"command": "gitlens.views.branches.setShowBranchPullRequestOff",
"when": "false"
},
{
"command": "gitlens.views.commits.copy",
"when": "false"
},
@ -5021,6 +5059,14 @@
"when": "false"
},
{
"command": "gitlens.views.commits.setShowBranchPullRequestOn",
"when": "false"
},
{
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
"when": "false"
},
{
"command": "gitlens.views.contributors.copy",
"when": "false"
},
@ -5165,6 +5211,14 @@
"when": "false"
},
{
"command": "gitlens.views.remotes.setShowBranchPullRequestOn",
"when": "false"
},
{
"command": "gitlens.views.remotes.setShowBranchPullRequestOff",
"when": "false"
},
{
"command": "gitlens.views.repositories.copy",
"when": "false"
},
@ -5810,6 +5864,16 @@
"group": "1_gitlens@1"
},
{
"command": "gitlens.views.branches.setShowBranchPullRequestOn",
"when": "view =~ /^gitlens\\.views\\.branches/ && !config.gitlens.views.branches.pullRequests.enabled && !config.gitlens.views.branches.pullRequests.showForBranches",
"group": "1_gitlens@2"
},
{
"command": "gitlens.views.branches.setShowBranchPullRequestOff",
"when": "view =~ /^gitlens\\.views\\.branches/ && config.gitlens.views.branches.pullRequests.enabled && config.gitlens.views.branches.pullRequests.showForBranches",
"group": "1_gitlens@2"
},
{
"command": "gitlens.views.switchToAnotherBranch",
"when": "!gitlens:readonly && view =~ /^gitlens\\.views\\.commits/",
"group": "navigation@10"
@ -5865,6 +5929,16 @@
"group": "1_gitlens@1"
},
{
"command": "gitlens.views.commits.setShowBranchPullRequestOn",
"when": "view =~ /^gitlens\\.views\\.commits/ && !config.gitlens.views.commits.pullRequests.enabled && !config.gitlens.views.commits.pullRequests.showForBranches",
"group": "1_gitlens@2"
},
{
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
"when": "view =~ /^gitlens\\.views\\.commits/ && config.gitlens.views.commits.pullRequests.enabled && config.gitlens.views.commits.pullRequests.showForBranches",
"group": "1_gitlens@2"
},
{
"command": "gitlens.views.addAuthors",
"when": "view =~ /^gitlens\\.views\\.contributors/",
"group": "navigation@10"
@ -6035,6 +6109,16 @@
"group": "1_gitlens@0"
},
{
"command": "gitlens.views.remotes.setShowBranchPullRequestOn",
"when": "view =~ /^gitlens\\.views\\.remotes/ && !config.gitlens.views.remotes.pullRequests.enabled && !config.gitlens.views.remotes.pullRequests.showForBranches",
"group": "1_gitlens@2"
},
{
"command": "gitlens.views.remotes.setShowBranchPullRequestOff",
"when": "view =~ /^gitlens\\.views\\.remotes/ && config.gitlens.views.remotes.pullRequests.enabled && config.gitlens.views.remotes.pullRequests.showForBranches",
"group": "1_gitlens@2"
},
{
"command": "gitlens.views.repositories.setFilesLayoutToList",
"when": "view =~ /^gitlens\\.views\\.repositories/ && config.gitlens.views.repositories.files.layout == auto",
"group": "navigation@50"
@ -6223,12 +6307,12 @@
{
"command": "gitlens.views.setShowRelativeDateMarkersOn",
"when": "view =~ /^gitlens\\.views\\.(repositories|commits|fileHistory|branches|remotes|tags)/ && !config.gitlens.views.showRelativeDateMarkers",
"group": "1_gitlens@2"
"group": "1_gitlens@3"
},
{
"command": "gitlens.views.setShowRelativeDateMarkersOff",
"when": "view =~ /^gitlens\\.views\\.(repositories|commits|fileHistory|branches|remotes|tags)/ && config.gitlens.views.showRelativeDateMarkers",
"group": "1_gitlens@2"
"group": "1_gitlens@3"
},
{
"command": "gitlens.showSettingsPage#branches-view",

+ 15
- 0
src/views/branchesView.ts View File

@ -239,6 +239,16 @@ export class BranchesView extends ViewBase
() => this.setShowBranchComparison(false),
this,
);
commands.registerCommand(
this.getQualifiedCommand('setShowBranchPullRequestOn'),
() => this.setShowBranchPullRequest(true),
this,
);
commands.registerCommand(
this.getQualifiedCommand('setShowBranchPullRequestOff'),
() => this.setShowBranchPullRequest(false),
this,
);
}
protected filterConfigurationChanged(e: ConfigurationChangeEvent) {
@ -378,4 +388,9 @@ export class BranchesView extends ViewBase
enabled ? ViewShowBranchComparison.Working : false,
);
}
private async setShowBranchPullRequest(enabled: boolean) {
await configuration.updateEffective('views', this.configKey, 'pullRequests', 'showForBranches', enabled);
await configuration.updateEffective('views', this.configKey, 'pullRequests', 'enabled', enabled);
}
}

+ 19
- 4
src/views/commitsView.ts View File

@ -283,6 +283,16 @@ export class CommitsView extends ViewBase {
() => this.setShowBranchComparison(false),
this,
);
commands.registerCommand(
this.getQualifiedCommand('setShowBranchPullRequestOn'),
() => this.setShowBranchPullRequest(true),
this,
);
commands.registerCommand(
this.getQualifiedCommand('setShowBranchPullRequestOff'),
() => this.setShowBranchPullRequest(false),
this,
);
}
protected filterConfigurationChanged(e: ConfigurationChangeEvent) {
@ -375,6 +385,12 @@ export class CommitsView extends ViewBase {
return configuration.updateEffective('views', this.configKey, 'files', 'layout', layout);
}
private setMyCommitsOnly(enabled: boolean) {
void setCommandContext(CommandContext.ViewsCommitsMyCommitsOnly, enabled);
this.state.myCommitsOnly = enabled;
void this.refresh(true);
}
private setShowAvatars(enabled: boolean) {
return configuration.updateEffective('views', this.configKey, 'avatars', enabled);
}
@ -388,9 +404,8 @@ export class CommitsView extends ViewBase {
);
}
private setMyCommitsOnly(enabled: boolean) {
void setCommandContext(CommandContext.ViewsCommitsMyCommitsOnly, enabled);
this.state.myCommitsOnly = enabled;
void this.refresh(true);
private async setShowBranchPullRequest(enabled: boolean) {
await configuration.updateEffective('views', this.configKey, 'pullRequests', 'showForBranches', enabled);
await configuration.updateEffective('views', this.configKey, 'pullRequests', 'enabled', enabled);
}
}

+ 15
- 0
src/views/remotesView.ts View File

@ -219,6 +219,16 @@ export class RemotesView extends ViewBase {
);
commands.registerCommand(this.getQualifiedCommand('setShowAvatarsOn'), () => this.setShowAvatars(true), this);
commands.registerCommand(this.getQualifiedCommand('setShowAvatarsOff'), () => this.setShowAvatars(false), this);
commands.registerCommand(
this.getQualifiedCommand('setShowBranchPullRequestOn'),
() => this.setShowBranchPullRequest(true),
this,
);
commands.registerCommand(
this.getQualifiedCommand('setShowBranchPullRequestOff'),
() => this.setShowBranchPullRequest(false),
this,
);
}
protected filterConfigurationChanged(e: ConfigurationChangeEvent) {
@ -409,4 +419,9 @@ export class RemotesView extends ViewBase {
private setShowAvatars(enabled: boolean) {
return configuration.updateEffective('views', this.configKey, 'avatars', enabled);
}
private async setShowBranchPullRequest(enabled: boolean) {
await configuration.updateEffective('views', this.configKey, 'pullRequests', 'showForBranches', enabled);
await configuration.updateEffective('views', this.configKey, 'pullRequests', 'enabled', enabled);
}
}

Loading…
Cancel
Save