Skip to content

Commit 03baef1

Browse files
authored
Support registering views to the secondary side bar (#261619)
* Support registering views to the secondary side bar * rename to secondarySideBar * Rename 'auxiliarybar' to 'secondarySidebar'
1 parent cbca646 commit 03baef1

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

src/vs/platform/extensions/common/extensionsApiProposals.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ const _allApiProposals = {
141141
contribRemoteHelp: {
142142
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts',
143143
},
144+
contribSecondarySideBar: {
145+
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSecondarySideBar.d.ts',
146+
},
144147
contribShareMenu: {
145148
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribShareMenu.d.ts',
146149
},

src/vs/workbench/api/browser/viewsExtensionPoint.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { VIEWLET_ID as EXPLORER } from '../../contrib/files/common/files.js';
2424
import { VIEWLET_ID as REMOTE } from '../../contrib/remote/browser/remoteExplorer.js';
2525
import { VIEWLET_ID as SCM } from '../../contrib/scm/common/scm.js';
2626
import { WebviewViewPane } from '../../contrib/webviewView/browser/webviewViewPane.js';
27-
import { isProposedApiEnabled } from '../../services/extensions/common/extensions.js';
27+
import { checkProposedApiEnabled, isProposedApiEnabled } from '../../services/extensions/common/extensions.js';
2828
import { ExtensionMessageCollector, ExtensionsRegistry, IExtensionPoint, IExtensionPointUser } from '../../services/extensions/common/extensionsRegistry.js';
2929
import { ILogService } from '../../../platform/log/common/log.js';
3030
import { IExtensionFeatureTableRenderer, IRenderedData, ITableData, IRowData, IExtensionFeaturesRegistry, Extensions as ExtensionFeaturesRegistryExtensions } from '../../services/extensionManagement/common/extensionFeatures.js';
@@ -70,6 +70,11 @@ export const viewsContainersContribution: IJSONSchema = {
7070
description: localize('views.container.panel', "Contribute views containers to Panel"),
7171
type: 'array',
7272
items: viewsContainerSchema
73+
},
74+
'secondarySidebar': {
75+
description: localize('views.container.secondarySidebar', "Contribute views containers to Secondary Side Bar"),
76+
type: 'array',
77+
items: viewsContainerSchema
7378
}
7479
},
7580
additionalProperties: false
@@ -301,6 +306,8 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
301306
const viewContainersRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry);
302307
let activityBarOrder = CUSTOM_VIEWS_START_ORDER + viewContainersRegistry.all.filter(v => !!v.extensionId && viewContainersRegistry.getViewContainerLocation(v) === ViewContainerLocation.Sidebar).length;
303308
let panelOrder = 5 + viewContainersRegistry.all.filter(v => !!v.extensionId && viewContainersRegistry.getViewContainerLocation(v) === ViewContainerLocation.Panel).length + 1;
309+
// offset by 100 because the chat view container used to have order 100 (now 1). Due to caching, we still need to account for the original order value
310+
let auxiliaryBarOrder = 100 + viewContainersRegistry.all.filter(v => !!v.extensionId && viewContainersRegistry.getViewContainerLocation(v) === ViewContainerLocation.AuxiliaryBar).length + 1;
304311
for (const { value, collector, description } of extensionPoints) {
305312
Object.entries(value).forEach(([key, value]) => {
306313
if (!this.isValidViewsContainer(value, collector)) {
@@ -313,6 +320,10 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
313320
case 'panel':
314321
panelOrder = this.registerCustomViewContainers(value, description, panelOrder, existingViewContainers, ViewContainerLocation.Panel);
315322
break;
323+
case 'secondarySideBar':
324+
checkProposedApiEnabled(description, 'contribSecondarySideBar');
325+
auxiliaryBarOrder = this.registerCustomViewContainers(value, description, auxiliaryBarOrder, existingViewContainers, ViewContainerLocation.AuxiliaryBar);
326+
break;
316327
}
317328
});
318329
}

src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const chatViewContainer: ViewContainer = Registry.as<IViewContainersRegistry>(Vi
4141
ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [CHAT_SIDEBAR_PANEL_ID, { mergeViewWithContainerWhenSingleView: true }]),
4242
storageId: CHAT_SIDEBAR_PANEL_ID,
4343
hideIfEmpty: true,
44-
order: 100,
44+
order: 1,
4545
}, ViewContainerLocation.AuxiliaryBar, { isDefault: true, doNotRegisterOpenCommand: true });
4646

4747
const chatViewDescriptor: IViewDescriptor[] = [{
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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 `secondarySideBar`-contribution point

0 commit comments

Comments
 (0)