Browse Source

Adds visibility to re-show line/repos views

Adds Hide Repositories View command
Adds Hide Line History View command
Adds Show/Hide Repositories View command to Commits view menu
Adds Show/Hide Line History View command to File History view menu
main
Eric Amodio 4 years ago
parent
commit
4c788f4536
3 changed files with 75 additions and 7 deletions
  1. +45
    -7
      package.json
  2. +2
    -0
      src/commands/common.ts
  3. +28
    -0
      src/commands/showView.ts

+ 45
- 7
package.json View File

@ -2654,6 +2654,11 @@
"category": "GitLens"
},
{
"command": "gitlens.hideLineHistoryView",
"title": "Hide Line History View",
"category": "GitLens"
},
{
"command": "gitlens.showRemotesView",
"title": "Show Remotes View",
"category": "GitLens"
@ -2664,6 +2669,11 @@
"category": "GitLens"
},
{
"command": "gitlens.hideRepositoriesView",
"title": "Hide Repositories View",
"category": "GitLens"
},
{
"command": "gitlens.showSearchAndCompareView",
"title": "Show Search And Compare Commits View",
"category": "GitLens"
@ -4538,6 +4548,10 @@
"when": "gitlens:enabled"
},
{
"command": "gitlens.hideLineHistoryView",
"when": "gitlens:enabled && config.gitlens.views.lineHistory.enabled"
},
{
"command": "gitlens.showRemotesView",
"when": "gitlens:enabled"
},
@ -4546,6 +4560,10 @@
"when": "gitlens:enabled"
},
{
"command": "gitlens.hideRepositoriesView",
"when": "gitlens:enabled && config.gitlens.views.repositories.enabled"
},
{
"command": "gitlens.showSearchAndCompareView",
"when": "gitlens:enabled"
},
@ -6164,6 +6182,16 @@
"group": "5_gitlens@2"
},
{
"command": "gitlens.showRepositoriesView",
"when": "view =~ /^gitlens\\.views\\.commits/ && !config.gitlens.views.repositories.enabled",
"group": "8_gitlens@0"
},
{
"command": "gitlens.hideRepositoriesView",
"when": "view =~ /^gitlens\\.views\\.commits/ && config.gitlens.views.repositories.enabled",
"group": "8_gitlens@0"
},
{
"command": "gitlens.views.addAuthors",
"when": "view =~ /^gitlens\\.views\\.contributors/",
"group": "navigation@10"
@ -6264,6 +6292,16 @@
"group": "5_gitlens@0"
},
{
"command": "gitlens.showLineHistoryView",
"when": "view =~ /^gitlens\\.views\\.fileHistory/ && !config.gitlens.views.lineHistory.enabled",
"group": "8_gitlens@0"
},
{
"command": "gitlens.hideLineHistoryView",
"when": "view =~ /^gitlens\\.views\\.fileHistory/ && config.gitlens.views.lineHistory.enabled",
"group": "8_gitlens@0"
},
{
"command": "gitlens.views.lineHistory.setEditorFollowingOn",
"when": "view =~ /^gitlens\\.views\\.lineHistory/ && !gitlens:views:lineHistory:editorFollowing",
"group": "navigation@10"
@ -8329,13 +8367,6 @@
],
"scm": [
{
"id": "gitlens.views.repositories",
"name": "Repositories",
"when": "!gitlens:disabled && config.gitlens.views.repositories.enabled",
"contextualTitle": "GitLens",
"icon": "images/views/repositories.svg"
},
{
"id": "gitlens.views.commits",
"name": "Commits",
"when": "!gitlens:disabled",
@ -8344,6 +8375,13 @@
"visibility": "visible"
},
{
"id": "gitlens.views.repositories",
"name": "Repositories",
"when": "!gitlens:disabled && config.gitlens.views.repositories.enabled",
"contextualTitle": "GitLens",
"icon": "images/views/repositories.svg"
},
{
"id": "gitlens.views.fileHistory",
"name": "File History",
"when": "!gitlens:disabled",

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

@ -71,6 +71,8 @@ export enum Commands {
ExternalDiff = 'gitlens.externalDiff',
ExternalDiffAll = 'gitlens.externalDiffAll',
FetchRepositories = 'gitlens.fetchRepositories',
HideLineHistoryView = 'gitlens.hideLineHistoryView',
HideRepositoriesView = 'gitlens.hideRepositoriesView',
InviteToLiveShare = 'gitlens.inviteToLiveShare',
OpenChangedFiles = 'gitlens.openChangedFiles',
OpenBranchesOnRemote = 'gitlens.openBranchesOnRemote',

+ 28
- 0
src/commands/showView.ts View File

@ -64,3 +64,31 @@ export class ShowViewCommand extends Command {
return Promise.resolve(undefined);
}
}
@command()
export class HideViewCommand extends Command {
constructor() {
super([Commands.HideLineHistoryView, Commands.HideRepositoriesView]);
}
protected preExecute(context: CommandContext) {
return this.execute(context.command as Commands);
}
async execute(command: Commands) {
switch (command) {
case Commands.HideLineHistoryView:
if (Container.config.views.lineHistory.enabled) {
await configuration.updateEffective('views', 'lineHistory', 'enabled', false);
}
break;
case Commands.HideRepositoriesView:
if (Container.config.views.repositories.enabled) {
await configuration.updateEffective('views', 'repositories', 'enabled', false);
}
break;
}
return Promise.resolve(undefined);
}
}

Loading…
Cancel
Save