mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
menu: add proposed api check
This commit is contained in:
@@ -49,6 +49,15 @@ namespace schema {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function isProposedAPI(menuId: MenuId): boolean {
|
||||
switch (menuId) {
|
||||
case MenuId.StatusBarWindowIndicatorMenu:
|
||||
case MenuId.MenubarFileMenu:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isValidMenuItems(menu: IUserFriendlyMenuItem[], collector: ExtensionMessageCollector): boolean {
|
||||
if (!Array.isArray(menu)) {
|
||||
collector.error(localize('requirearray', "menu items must be an array"));
|
||||
@@ -359,6 +368,11 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyM
|
||||
return;
|
||||
}
|
||||
|
||||
if (schema.isProposedAPI(menu) && !extension.description.enableProposedApi) {
|
||||
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));
|
||||
return;
|
||||
}
|
||||
|
||||
for (let item of entry.value) {
|
||||
let command = MenuRegistry.getCommand(item.command);
|
||||
let alt = item.alt && MenuRegistry.getCommand(item.alt);
|
||||
|
||||
Reference in New Issue
Block a user