SCM - Add "Reopen Closed Repositories..." action to the "Source control Repositories" view title bar (#203512)

This commit is contained in:
Ladislau Szomoru 2024-01-26 10:50:25 +01:00 committed by GitHub
parent 6c21641885
commit b26b05031e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 27 additions and 4 deletions

View file

@ -18,6 +18,7 @@
"contribSourceControlHistoryItemGroupMenu",
"contribSourceControlHistoryItemMenu",
"contribSourceControlInputBoxMenu",
"contribSourceControlTitleMenu",
"contribViewsWelcome",
"diffCommand",
"editSessionIdentityProvider",
@ -94,6 +95,7 @@
{
"command": "git.reopenClosedRepositories",
"title": "%command.reopenClosedRepositories%",
"icon": "$(repo)",
"category": "Git",
"enablement": "!operationInProgress && git.closedRepositoryCount != 0"
},
@ -1448,6 +1450,13 @@
"when": "scmProvider == git"
}
],
"scm/sourceControl/title": [
{
"command": "git.reopenClosedRepositories",
"group": "navigation@1",
"when": "scmProvider == git && git.closedRepositoryCount > 0"
}
],
"scm/sourceControl": [
{
"command": "git.close",

View file

@ -120,6 +120,7 @@ export class MenuId {
static readonly SCMResourceGroupContext = new MenuId('SCMResourceGroupContext');
static readonly SCMSourceControl = new MenuId('SCMSourceControl');
static readonly SCMSourceControlInline = new MenuId('SCMSourceControlInline');
static readonly SCMSourceControlTitle = new MenuId('SCMSourceControlTitle');
static readonly SCMTitle = new MenuId('SCMTitle');
static readonly SearchContext = new MenuId('SearchContext');
static readonly SearchActionMenu = new MenuId('SearchActionContext');

View file

@ -57,7 +57,7 @@ export class SCMRepositoriesViewPane extends ViewPane {
@IThemeService themeService: IThemeService,
@ITelemetryService telemetryService: ITelemetryService
) {
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
super({ ...options, titleMenuId: MenuId.SCMSourceControlTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
}
protected override renderBody(container: HTMLElement): void {

View file

@ -11,7 +11,7 @@ import { ViewPane, IViewPaneOptions, ViewAction } from 'vs/workbench/browser/par
import { append, $, Dimension, asCSSUrl, trackFocus, clearNode, prepend } from 'vs/base/browser/dom';
import { IListVirtualDelegate, IIdentityProvider } from 'vs/base/browser/ui/list/list';
import { ISCMHistoryItem, ISCMHistoryItemChange, ISCMHistoryProviderCacheEntry, SCMHistoryItemChangeTreeElement, SCMHistoryItemGroupTreeElement, SCMHistoryItemTreeElement, SCMViewSeparatorElement } from 'vs/workbench/contrib/scm/common/history';
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';
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';
import { ResourceLabels, IResourceLabel, IFileLabelOptions } from 'vs/workbench/browser/labels';
import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@ -1639,8 +1639,7 @@ abstract class RepositorySortAction extends ViewAction<SCMViewPane> {
group: '1_sort'
},
{
id: MenuId.ViewTitle,
when: ContextKeyExpr.equals('view', REPOSITORIES_VIEW_PANE_ID),
id: MenuId.SCMSourceControlTitle,
group: '1_sort',
},
]

View file

@ -124,6 +124,12 @@ const apiMenus: IAPIMenu[] = [
id: MenuId.SCMSourceControl,
description: localize('menus.scmSourceControl', "The Source Control menu")
},
{
key: 'scm/sourceControl/title',
id: MenuId.SCMSourceControlTitle,
description: localize('menus.scmSourceControlTitle', "The Source Control title menu"),
proposed: 'contribSourceControlTitleMenu'
},
{
key: 'scm/resourceState/context',
id: MenuId.SCMResourceContext,

View file

@ -36,6 +36,7 @@ export const allApiProposals = Object.freeze({
contribSourceControlHistoryItemGroupMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryItemGroupMenu.d.ts',
contribSourceControlHistoryItemMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts',
contribSourceControlInputBoxMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts',
contribSourceControlTitleMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts',
contribStatusBarItems: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts',
contribViewsRemote: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts',
contribViewsWelcome: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts',

View file

@ -0,0 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// empty placeholder declaration for the `scm/sourceControl/title`-menu contribution point
// https://github.com/microsoft/vscode/issues/203511