提交 8f8bbff3 编写于 作者: J Joao

fixes #33325

上级 c39302ab
......@@ -440,6 +440,11 @@
}
],
"scm/title": [
{
"command": "git.init",
"group": "navigation",
"when": "config.git.enabled && !scmProvider && gitOpenRepositoryCount == 0"
},
{
"command": "git.commit",
"group": "navigation",
......
......@@ -28,13 +28,18 @@ export class SCMMenus implements IDisposable {
private disposables: IDisposable[] = [];
constructor(
private provider: ISCMProvider,
private provider: ISCMProvider | undefined,
@IContextKeyService contextKeyService: IContextKeyService,
@IMenuService private menuService: IMenuService
) {
this.contextKeyService = contextKeyService.createScoped();
const scmProviderKey = this.contextKeyService.createKey<string | undefined>('scmProvider', void 0);
scmProviderKey.set(provider.contextValue);
if (provider) {
scmProviderKey.set(provider.contextValue);
} else {
scmProviderKey.set('');
}
this.titleMenu = this.menuService.createMenu(MenuId.SCMTitle, this.contextKeyService);
this.disposables.push(this.titleMenu);
......
......@@ -479,6 +479,7 @@ class InstallAdditionalSCMProvidersAction extends Action {
export class SCMViewlet extends PersistentViewsViewlet {
private menus: SCMMenus;
private disposables: IDisposable[] = [];
constructor(
......@@ -501,6 +502,9 @@ export class SCMViewlet extends PersistentViewsViewlet {
) {
super(VIEWLET_ID, ViewLocation.SCM, 'scm', true,
telemetryService, storageService, instantiationService, themeService, contextService, contextKeyService, contextMenuService, extensionService);
this.menus = instantiationService.createInstance(SCMMenus, undefined);
this.menus.onDidChangeTitle(this.updateTitleArea, this, this.disposables);
}
private onDidAddRepository(repository: ISCMRepository): void {
......@@ -553,17 +557,23 @@ export class SCMViewlet extends PersistentViewsViewlet {
return this.views[0].getActions();
}
return [];
return this.menus.getTitleActions();
}
getSecondaryActions(): IAction[] {
let result: IAction[] = [];
let result: IAction[];
if (this.showHeaderInTitleArea() && this.views.length === 1) {
result = [
...this.views[0].getSecondaryActions(),
new Separator()
];
} else {
result = this.menus.getTitleSecondaryActions();
if (result.length > 0) {
result.push(new Separator());
}
}
result.push(this.instantiationService.createInstance(InstallAdditionalSCMProvidersAction));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册