Skip to content

Commit 750266f

Browse files
committed
menu: add proposed api check
1 parent b900b27 commit 750266f

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/vs/workbench/api/common/menusExtensionPoint.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ namespace schema {
4949
return undefined;
5050
}
5151

52+
export function isProposedAPI(menuId: MenuId): boolean {
53+
switch (menuId) {
54+
case MenuId.StatusBarWindowIndicatorMenu:
55+
case MenuId.MenubarFileMenu:
56+
return true;
57+
}
58+
return false;
59+
}
60+
5261
export function isValidMenuItems(menu: IUserFriendlyMenuItem[], collector: ExtensionMessageCollector): boolean {
5362
if (!Array.isArray(menu)) {
5463
collector.error(localize('requirearray', "menu items must be an array"));
@@ -359,6 +368,11 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyM
359368
return;
360369
}
361370

371+
if (schema.isProposedAPI(menu) && !extension.description.enableProposedApi) {
372+
collector.error(localize('proposedAPI.invalid', "{0} is a proposed menu identifierand is only available when running out of dev or with the following command line switch: --enable-proposed-api ${extension.identifier.value}", menu));
373+
return;
374+
}
375+
362376
for (let item of entry.value) {
363377
let command = MenuRegistry.getCommand(item.command);
364378
let alt = item.alt && MenuRegistry.getCommand(item.alt);

0 commit comments

Comments
 (0)