Skip to content

Commit

Permalink
tweak error messages when API proposal isn't available, #131165
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Nov 12, 2021
1 parent df681dc commit 112709a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/api/browser/viewsExtensionPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
}

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));
collector.warn(localize('ViewContainerRequiresProposedAPI', "View container '{0}' requires 'enabledApiProposals: [\"contribViewsRemote\"]' to be added to 'Remote'.", entry.key));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/menusExtensionPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ menusExtensionPoint.setHandler(extensions => {
}

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));
collector.error(localize('proposedAPI.invalid', "{0} is a proposed menu identifier. It requires 'package.json#enabledApiProposals: [\"{1}\"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api {2}", entry.key, menu.proposed, extension.description.identifier.value));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function parseGroupAndOrder(welcome: ViewWelcome, contribution: IExtensionPointU
let order: number | undefined;
if (welcome.group) {
if (!isProposedApiEnabled(contribution.description, 'contribViewsWelcome')) {
contribution.collector.warn(nls.localize('ViewsWelcomeExtensionPoint.proposedAPI', "The viewsWelcome contribution in '{0}' requires 'enableProposedApi' to be enabled, in order to use the 'group' proposed property.", contribution.description.identifier.value));
contribution.collector.warn(nls.localize('ViewsWelcomeExtensionPoint.proposedAPI', "The viewsWelcome contribution in '{0}' requires 'enabledApiProposals: [\"contribViewsWelcome\"]' in order to use the 'group' proposed property.", contribution.description.identifier.value));
return { group, order };
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/services/extensions/common/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function isProposedApiEnabled(extension: IExtensionDescription, proposal:

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}`);
throw new Error(`Extension '${extension.identifier.value}' CANNOT use API proposal: ${proposal}.\nAccording to its package.json#enabledApiProposals-property it wants: ${extension.enabledApiProposals?.join(', ') ?? '<none>'}.\n You MUST start in extension development mode or use the following command line switch: --enable-proposed-api ${extension.identifier.value}`);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/services/themes/common/iconExtensionPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class IconExtensionPoint {
const collector = extension.collector;

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));
collector.error(nls.localize('invalid.icons.proposedAPI', "'configuration.icons is a proposed contribution point. It requires 'package.json#enabledApiProposals: [\"contribIcons\"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api {0}", extension.description.identifier.value));
return;
}

Expand Down Expand Up @@ -181,7 +181,7 @@ export class IconFontExtensionPoint {
const collector = extension.collector;

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));
collector.error(nls.localize('invalid.iconFonts.proposedAPI', "'configuration.iconFonts is a proposed contribution point. It requires 'package.json#enabledApiProposals: [\"contribIconFonts\"]' and is and only available when running out of dev or with the following command line switch: --enable-proposed-api {0}", extension.description.identifier.value));
return;
}

Expand Down

0 comments on commit 112709a

Please sign in to comment.