diff --git a/src/vs/workbench/api/browser/viewsExtensionPoint.ts b/src/vs/workbench/api/browser/viewsExtensionPoint.ts index 4ad9fee8a91..fda5c018445 100644 --- a/src/vs/workbench/api/browser/viewsExtensionPoint.ts +++ b/src/vs/workbench/api/browser/viewsExtensionPoint.ts @@ -405,7 +405,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution { return; } - if (entry.key === 'remote' && !isProposedApiEnabled(extension.description, undefined)) { + if (entry.key === 'remote' && !isProposedApiEnabled(extension.description, 'contribViewsRemote')) { collector.warn(localize('ViewContainerRequiresProposedAPI', "View container '{0}' requires 'enableProposedApi' turned on to be added to 'Remote'.", entry.key)); return; } diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 6f343668646..00e0d4f9e3a 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -600,7 +600,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I return >extHostMessageService.showMessage(extension, Severity.Error, message, rest[0], >rest.slice(1)); }, showQuickPick(items: any, options?: vscode.QuickPickOptions, token?: vscode.CancellationToken): any { - return extHostQuickOpen.showQuickPick(items, isProposedApiEnabled(extension, undefined), options, token); + return extHostQuickOpen.showQuickPick(items, options, token); }, showWorkspaceFolderPick(options?: vscode.WorkspaceFolderPickOptions) { return extHostQuickOpen.showWorkspaceFolderPick(options); @@ -689,7 +689,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I return extHostUrls.registerUriHandler(extension.identifier, handler); }, createQuickPick(): vscode.QuickPick { - return extHostQuickOpen.createQuickPick(extension.identifier, isProposedApiEnabled(extension, undefined)); + return extHostQuickOpen.createQuickPick(extension.identifier); }, createInputBox(): vscode.InputBox { return extHostQuickOpen.createInputBox(extension.identifier); diff --git a/src/vs/workbench/api/common/extHostQuickOpen.ts b/src/vs/workbench/api/common/extHostQuickOpen.ts index f5ec6a46edc..eb1c05c36a6 100644 --- a/src/vs/workbench/api/common/extHostQuickOpen.ts +++ b/src/vs/workbench/api/common/extHostQuickOpen.ts @@ -22,16 +22,16 @@ import { ThemeIcon as ThemeIconUtils } from 'vs/platform/theme/common/themeServi export type Item = string | QuickPickItem; export interface ExtHostQuickOpen { - showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Promise, enableProposedApi: boolean, options: QuickPickOptions & { canPickMany: true; }, token?: CancellationToken): Promise; - showQuickPick(itemsOrItemsPromise: string[] | Promise, enableProposedApi: boolean, options?: QuickPickOptions, token?: CancellationToken): Promise; - showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Promise, enableProposedApi: boolean, options?: QuickPickOptions, token?: CancellationToken): Promise; - showQuickPick(itemsOrItemsPromise: Item[] | Promise, enableProposedApi: boolean, options?: QuickPickOptions, token?: CancellationToken): Promise; + showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Promise, options: QuickPickOptions & { canPickMany: true; }, token?: CancellationToken): Promise; + showQuickPick(itemsOrItemsPromise: string[] | Promise, options?: QuickPickOptions, token?: CancellationToken): Promise; + showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Promise, options?: QuickPickOptions, token?: CancellationToken): Promise; + showQuickPick(itemsOrItemsPromise: Item[] | Promise, options?: QuickPickOptions, token?: CancellationToken): Promise; showInput(options?: InputBoxOptions, token?: CancellationToken): Promise; showWorkspaceFolderPick(options?: WorkspaceFolderPickOptions, token?: CancellationToken): Promise - createQuickPick(extensionId: ExtensionIdentifier, enableProposedApi: boolean): QuickPick; + createQuickPick(extensionId: ExtensionIdentifier): QuickPick; createInputBox(extensionId: ExtensionIdentifier): InputBox; } @@ -56,10 +56,10 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx this._commands = commands; } - showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Promise, enableProposedApi: boolean, options: QuickPickOptions & { canPickMany: true; }, token?: CancellationToken): Promise; - showQuickPick(itemsOrItemsPromise: string[] | Promise, enableProposedApi: boolean, options?: QuickPickOptions, token?: CancellationToken): Promise; - showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Promise, enableProposedApi: boolean, options?: QuickPickOptions, token?: CancellationToken): Promise; - showQuickPick(itemsOrItemsPromise: Item[] | Promise, enableProposedApi: boolean, options?: QuickPickOptions, token: CancellationToken = CancellationToken.None): Promise { + showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Promise, options: QuickPickOptions & { canPickMany: true; }, token?: CancellationToken): Promise; + showQuickPick(itemsOrItemsPromise: string[] | Promise, options?: QuickPickOptions, token?: CancellationToken): Promise; + showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Promise, options?: QuickPickOptions, token?: CancellationToken): Promise; + showQuickPick(itemsOrItemsPromise: Item[] | Promise, options?: QuickPickOptions, token: CancellationToken = CancellationToken.None): Promise { // clear state from last invocation this._onDidSelectItem = undefined; @@ -192,7 +192,7 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx // ---- QuickInput - createQuickPick(extensionId: ExtensionIdentifier, enableProposedApi: boolean): QuickPick { + createQuickPick(extensionId: ExtensionIdentifier): QuickPick { const session: ExtHostQuickPick = new ExtHostQuickPick(extensionId, () => this._sessions.delete(session._id)); this._sessions.set(session._id, session); return session; diff --git a/src/vs/workbench/api/common/menusExtensionPoint.ts b/src/vs/workbench/api/common/menusExtensionPoint.ts index 5ee2881e6f8..36a97b077cb 100644 --- a/src/vs/workbench/api/common/menusExtensionPoint.ts +++ b/src/vs/workbench/api/common/menusExtensionPoint.ts @@ -17,14 +17,14 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService'; import { Iterable } from 'vs/base/common/iterator'; import { index } from 'vs/base/common/arrays'; import { isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions'; +import { ApiProposalName } from 'vs/workbench/services/extensions/common/extensionsApiProposals'; interface IAPIMenu { readonly key: string; readonly id: MenuId; readonly description: string; - readonly proposed?: boolean; // defaults to false + readonly proposed?: ApiProposalName; readonly supportsSubmenus?: boolean; // defaults to true - readonly deprecationMessage?: string; } const apiMenus: IAPIMenu[] = [ @@ -85,17 +85,11 @@ const apiMenus: IAPIMenu[] = [ id: MenuId.DebugToolBar, description: localize('menus.debugToolBar', "The debug toolbar menu") }, - { - key: 'menuBar/file', - id: MenuId.MenubarFileMenu, - description: localize('menus.file', "The top level file menu"), - proposed: true - }, { key: 'menuBar/home', id: MenuId.MenubarHomeMenu, description: localize('menus.home', "The home indicator context menu (web only)"), - proposed: true, + proposed: 'contribMenuBarHome', supportsSubmenus: false }, { @@ -133,14 +127,6 @@ const apiMenus: IAPIMenu[] = [ id: MenuId.SCMChangeContext, description: localize('menus.changeTitle', "The Source Control inline change menu") }, - { - key: 'statusBar/windowIndicator', - id: MenuId.StatusBarWindowIndicatorMenu, - description: localize('menus.statusBarWindowIndicator', "The window indicator menu in the status bar"), - proposed: true, - supportsSubmenus: false, - deprecationMessage: localize('menus.statusBarWindowIndicator.deprecated', "Use menu 'statusBar/remoteIndicator' instead."), - }, { key: 'statusBar/remoteIndicator', id: MenuId.StatusBarRemoteIndicatorMenu, @@ -198,19 +184,19 @@ const apiMenus: IAPIMenu[] = [ key: 'notebook/cell/executePrimary', id: MenuId.NotebookCellExecutePrimary, description: localize('notebook.cell.executePrimary', "The contributed primary notebook cell execution button"), - proposed: true + proposed: 'notebookEditor' }, { key: 'interactive/toolbar', id: MenuId.InteractiveToolbar, description: localize('interactive.toolbar', "The contributed interactive toolbar menu"), - proposed: true + proposed: 'notebookEditor' }, { key: 'interactive/cell/title', id: MenuId.InteractiveCellTitle, description: localize('interactive.cell.title', "The contributed interactive cell title menu"), - proposed: true + proposed: 'notebookEditor' }, { key: 'testing/item/context', @@ -263,7 +249,7 @@ const apiMenus: IAPIMenu[] = [ id: MenuId.InlineCompletionsActions, description: localize('inlineCompletions.actions', "The actions shown when hovering on an inline completion"), supportsSubmenus: false, - proposed: true + proposed: 'inlineCompletions' }, ]; @@ -451,8 +437,7 @@ namespace schema { description: localize('vscode.extension.contributes.menus', "Contributes menu items to the editor"), type: 'object', properties: index(apiMenus, menu => menu.key, menu => ({ - description: menu.proposed ? `(${localize('proposed', "Proposed API")}) ${menu.description}` : menu.description, - deprecationMessage: menu.deprecationMessage, + markdownDescription: menu.proposed ? localize('proposed', "Proposed API, requires `enabledApiProposal: [\"{0}\"]` - {1}", menu.proposed, menu.description) : menu.description, type: 'array', items: menu.supportsSubmenus === false ? menuItem : { oneOf: [menuItem, submenuItem] } })), @@ -634,7 +619,7 @@ commandsExtensionPoint.setHandler(extensions => { title, source: extension.description.displayName ?? extension.description.name, shortTitle, - tooltip: isProposedApiEnabled(extension.description, undefined) ? title : undefined, + tooltip: title, category, precondition: ContextKeyExpr.deserialize(enablement), icon: absoluteIcon @@ -764,7 +749,7 @@ menusExtensionPoint.setHandler(extensions => { return; } - if (menu.proposed && !isProposedApiEnabled(extension.description, undefined)) { + if (menu.proposed && !isProposedApiEnabled(extension.description, menu.proposed)) { collector.error(localize('proposedAPI.invalid', "{0} is a proposed menu identifier and is only available when running out of dev or with the following command line switch: --enable-proposed-api {1}", entry.key, extension.description.identifier.value)); return; } diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index dff2881e612..488f5665aa9 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -498,7 +498,7 @@ export class RemoteViewPaneContainer extends FilterViewPaneContainer implements } private _handleRemoteInfoExtensionPoint(extension: IExtensionPointUser, helpInformation: HelpInformation[]) { - if (!isProposedApiEnabled(extension.description, undefined)) { + if (!isProposedApiEnabled(extension.description, 'contribRemoteHelp')) { return; } diff --git a/src/vs/workbench/services/extensions/common/extensions.ts b/src/vs/workbench/services/extensions/common/extensions.ts index 02ab47e2c30..3ef6cdd288e 100644 --- a/src/vs/workbench/services/extensions/common/extensions.ts +++ b/src/vs/workbench/services/extensions/common/extensions.ts @@ -134,17 +134,14 @@ export interface IExtensionHost { dispose(): void; } -export function isProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName | undefined): boolean { - if (!proposal) { - return Boolean(extension.enableProposedApi); - } +export function isProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): boolean { if (extension.enabledApiProposals?.includes(proposal)) { return true; } return Boolean(extension.enableProposedApi); } -export function checkProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName | undefined): void { +export function checkProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): void { if (!isProposedApiEnabled(extension, proposal)) { throw new Error(`[${extension.identifier.value}]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api ${extension.identifier.value}`); } diff --git a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts index 974d2a3bdab..1ccca4a1ffc 100644 --- a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts +++ b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts @@ -7,6 +7,12 @@ export const allApiProposals = Object.freeze({ authSession: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts', + contribIconFonts: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribIconFonts.d.ts', + contribIcons: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribIcons.d.ts', + contribLabelFormatterWorkspaceTooltip: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts', + contribMenuBarHome: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts', + contribRemoteHelp: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribRemoteHelp.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', customEditorMove: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorMove.d.ts', diffCommand: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffCommand.d.ts', diff --git a/src/vs/workbench/services/extensions/node/proxyResolver.ts b/src/vs/workbench/services/extensions/node/proxyResolver.ts index ac2ea9c022c..8b6e10d7ae1 100644 --- a/src/vs/workbench/services/extensions/node/proxyResolver.ts +++ b/src/vs/workbench/services/extensions/node/proxyResolver.ts @@ -15,7 +15,6 @@ import { URI } from 'vs/base/common/uri'; import { ILogService } from 'vs/platform/log/common/log'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { LogLevel, createHttpPatch, ProxyResolveEvent, createProxyResolver, createTlsPatch, ProxySupportSetting } from 'vscode-proxy-agent'; -import { isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions'; export function connectProxyResolver( extHostWorkspace: IExtHostWorkspaceProvider, @@ -130,9 +129,6 @@ function configureModuleLoading(extensionService: ExtHostExtensionService, looku } if (!cache[request]) { let mod = modules.default; - if (ext && isProposedApiEnabled(ext, undefined)) { - mod = (modules as any)[(ext).proxySupport] || modules.onRequest; - } cache[request] = { ...mod }; // Copy to work around #93167. } return cache[request]; diff --git a/src/vs/workbench/services/label/common/labelService.ts b/src/vs/workbench/services/label/common/labelService.ts index 509be770cf7..05b4c9776c2 100644 --- a/src/vs/workbench/services/label/common/labelService.ts +++ b/src/vs/workbench/services/label/common/labelService.ts @@ -84,7 +84,7 @@ class ResourceLabelFormattersHandler implements IWorkbenchContribution { constructor(@ILabelService labelService: ILabelService) { resourceLabelFormattersExtPoint.setHandler((extensions, delta) => { delta.added.forEach(added => added.value.forEach(formatter => { - if (!isProposedApiEnabled(added.description, undefined) && formatter.formatting.workspaceTooltip) { + if (!isProposedApiEnabled(added.description, 'contribLabelFormatterWorkspaceTooltip') && formatter.formatting.workspaceTooltip) { // workspaceTooltip is only proposed formatter.formatting.workspaceTooltip = undefined; } diff --git a/src/vs/workbench/services/themes/common/iconExtensionPoint.ts b/src/vs/workbench/services/themes/common/iconExtensionPoint.ts index addcda618e8..67bd0f3f868 100644 --- a/src/vs/workbench/services/themes/common/iconExtensionPoint.ts +++ b/src/vs/workbench/services/themes/common/iconExtensionPoint.ts @@ -126,7 +126,7 @@ export class IconExtensionPoint { const extensionValue = extension.value; const collector = extension.collector; - if (!isProposedApiEnabled(extension.description, undefined)) { + if (!isProposedApiEnabled(extension.description, 'contribIcons')) { collector.error(nls.localize('invalid.icons.proposedAPI', "'configuration.icons is a proposed contribution point and only available when running out of dev or with the following command line switch: --enable-proposed-api {0}", extension.description.identifier.value)); return; } @@ -180,7 +180,7 @@ export class IconFontExtensionPoint { const extensionValue = extension.value; const collector = extension.collector; - if (!isProposedApiEnabled(extension.description, undefined)) { + if (!isProposedApiEnabled(extension.description, 'contribIconFonts')) { collector.error(nls.localize('invalid.iconFonts.proposedAPI', "'configuration.iconFonts is a proposed contribution point and only available when running out of dev or with the following command line switch: --enable-proposed-api {0}", extension.description.identifier.value)); return; } diff --git a/src/vscode-dts/vscode.proposed.contribIconFonts.d.ts b/src/vscode-dts/vscode.proposed.contribIconFonts.d.ts new file mode 100644 index 00000000000..dbfa93e4200 --- /dev/null +++ b/src/vscode-dts/vscode.proposed.contribIconFonts.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * 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 `iconFonts`-contribution point diff --git a/src/vscode-dts/vscode.proposed.contribIcons.d.ts b/src/vscode-dts/vscode.proposed.contribIcons.d.ts new file mode 100644 index 00000000000..04f4fdc41e0 --- /dev/null +++ b/src/vscode-dts/vscode.proposed.contribIcons.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * 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 `icons`-contribution point diff --git a/src/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts b/src/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts new file mode 100644 index 00000000000..90814eb2211 --- /dev/null +++ b/src/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * 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 `workspaceTooltip`-property of the `resourceLabelFormatters` contribution poain diff --git a/src/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts b/src/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts new file mode 100644 index 00000000000..caa0ff228da --- /dev/null +++ b/src/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * 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 `menuBar/home` menu diff --git a/src/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts b/src/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts new file mode 100644 index 00000000000..f577e0daa2e --- /dev/null +++ b/src/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * 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 `remoteHelp`-contribution point diff --git a/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts b/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts new file mode 100644 index 00000000000..b1e6ca3d77b --- /dev/null +++ b/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * 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 `remote`-property of the `views`-contribution diff --git a/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts b/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts index 035b8f1f8b5..616694ebb7d 100644 --- a/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts +++ b/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts @@ -3,4 +3,4 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// empty place holder declaration for the `viewsWelcome`-contribution point +// empty placeholder declaration for the `viewsWelcome`-contribution point