Просмотр исходного кода

Adds show/hide branch comparison to repos view

main
Eric Amodio 4 лет назад
Родитель
Сommit
d11c6c5bf5
2 измененных файлов: 54 добавлений и 1 удалений
  1. +28
    -0
      package.json
  2. +26
    -1
      src/views/repositoriesView.ts

+ 28
- 0
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"

+ 26
- 1
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
);
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,
);
}
}

Загрузка…
Отмена
Сохранить