Skip to content

Commit b26b050

Browse files
authored
SCM - Add "Reopen Closed Repositories..." action to the "Source control Repositories" view title bar (microsoft#203512)
1 parent 6c21641 commit b26b050

File tree

7 files changed

+27
-4
lines changed

7 files changed

+27
-4
lines changed

extensions/git/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"contribSourceControlHistoryItemGroupMenu",
1919
"contribSourceControlHistoryItemMenu",
2020
"contribSourceControlInputBoxMenu",
21+
"contribSourceControlTitleMenu",
2122
"contribViewsWelcome",
2223
"diffCommand",
2324
"editSessionIdentityProvider",
@@ -94,6 +95,7 @@
9495
{
9596
"command": "git.reopenClosedRepositories",
9697
"title": "%command.reopenClosedRepositories%",
98+
"icon": "$(repo)",
9799
"category": "Git",
98100
"enablement": "!operationInProgress && git.closedRepositoryCount != 0"
99101
},
@@ -1448,6 +1450,13 @@
14481450
"when": "scmProvider == git"
14491451
}
14501452
],
1453+
"scm/sourceControl/title": [
1454+
{
1455+
"command": "git.reopenClosedRepositories",
1456+
"group": "navigation@1",
1457+
"when": "scmProvider == git && git.closedRepositoryCount > 0"
1458+
}
1459+
],
14511460
"scm/sourceControl": [
14521461
{
14531462
"command": "git.close",

src/vs/platform/actions/common/actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export class MenuId {
120120
static readonly SCMResourceGroupContext = new MenuId('SCMResourceGroupContext');
121121
static readonly SCMSourceControl = new MenuId('SCMSourceControl');
122122
static readonly SCMSourceControlInline = new MenuId('SCMSourceControlInline');
123+
static readonly SCMSourceControlTitle = new MenuId('SCMSourceControlTitle');
123124
static readonly SCMTitle = new MenuId('SCMTitle');
124125
static readonly SearchContext = new MenuId('SearchContext');
125126
static readonly SearchActionMenu = new MenuId('SearchActionContext');

src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class SCMRepositoriesViewPane extends ViewPane {
5757
@IThemeService themeService: IThemeService,
5858
@ITelemetryService telemetryService: ITelemetryService
5959
) {
60-
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
60+
super({ ...options, titleMenuId: MenuId.SCMSourceControlTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
6161
}
6262

6363
protected override renderBody(container: HTMLElement): void {

src/vs/workbench/contrib/scm/browser/scmViewPane.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ViewPane, IViewPaneOptions, ViewAction } from 'vs/workbench/browser/par
1111
import { append, $, Dimension, asCSSUrl, trackFocus, clearNode, prepend } from 'vs/base/browser/dom';
1212
import { IListVirtualDelegate, IIdentityProvider } from 'vs/base/browser/ui/list/list';
1313
import { ISCMHistoryItem, ISCMHistoryItemChange, ISCMHistoryProviderCacheEntry, SCMHistoryItemChangeTreeElement, SCMHistoryItemGroupTreeElement, SCMHistoryItemTreeElement, SCMViewSeparatorElement } from 'vs/workbench/contrib/scm/common/history';
14-
import { ISCMResourceGroup, ISCMResource, InputValidationType, ISCMRepository, ISCMInput, IInputValidation, ISCMViewService, ISCMViewVisibleRepositoryChangeEvent, ISCMService, SCMInputChangeReason, VIEW_PANE_ID, ISCMActionButton, ISCMActionButtonDescriptor, ISCMRepositorySortKey, REPOSITORIES_VIEW_PANE_ID, ISCMInputValueProviderContext, ISCMProvider } from 'vs/workbench/contrib/scm/common/scm';
14+
import { ISCMResourceGroup, ISCMResource, InputValidationType, ISCMRepository, ISCMInput, IInputValidation, ISCMViewService, ISCMViewVisibleRepositoryChangeEvent, ISCMService, SCMInputChangeReason, VIEW_PANE_ID, ISCMActionButton, ISCMActionButtonDescriptor, ISCMRepositorySortKey, ISCMInputValueProviderContext, ISCMProvider } from 'vs/workbench/contrib/scm/common/scm';
1515
import { ResourceLabels, IResourceLabel, IFileLabelOptions } from 'vs/workbench/browser/labels';
1616
import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
1717
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -1639,8 +1639,7 @@ abstract class RepositorySortAction extends ViewAction<SCMViewPane> {
16391639
group: '1_sort'
16401640
},
16411641
{
1642-
id: MenuId.ViewTitle,
1643-
when: ContextKeyExpr.equals('view', REPOSITORIES_VIEW_PANE_ID),
1642+
id: MenuId.SCMSourceControlTitle,
16441643
group: '1_sort',
16451644
},
16461645
]

src/vs/workbench/services/actions/common/menusExtensionPoint.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ const apiMenus: IAPIMenu[] = [
124124
id: MenuId.SCMSourceControl,
125125
description: localize('menus.scmSourceControl', "The Source Control menu")
126126
},
127+
{
128+
key: 'scm/sourceControl/title',
129+
id: MenuId.SCMSourceControlTitle,
130+
description: localize('menus.scmSourceControlTitle', "The Source Control title menu"),
131+
proposed: 'contribSourceControlTitleMenu'
132+
},
127133
{
128134
key: 'scm/resourceState/context',
129135
id: MenuId.SCMResourceContext,

src/vs/workbench/services/extensions/common/extensionsApiProposals.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const allApiProposals = Object.freeze({
3636
contribSourceControlHistoryItemGroupMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryItemGroupMenu.d.ts',
3737
contribSourceControlHistoryItemMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts',
3838
contribSourceControlInputBoxMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts',
39+
contribSourceControlTitleMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts',
3940
contribStatusBarItems: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts',
4041
contribViewsRemote: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts',
4142
contribViewsWelcome: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts',
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
// empty placeholder declaration for the `scm/sourceControl/title`-menu contribution point
7+
// https://github.com/microsoft/vscode/issues/203511

0 commit comments

Comments
 (0)