declare proposed API properties for package.json and link them with actual proposal names

This commit is contained in:
Johannes Rieken 2021-11-10 12:34:07 +01:00
parent 50978960a0
commit fe6b867b00
No known key found for this signature in database
GPG key ID: 96634B5AF12F8798
4 changed files with 20 additions and 3 deletions

View file

@ -197,9 +197,10 @@ function apiProposalNamesGenerator() {
'',
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
'',
'export const apiProposals = {',
'const apiProposals = {',
`${proposalNames.map(name => `\t${name}: true`).join(',\n')}`,
'};',
'export const apiProposalNames = Object.freeze(Object.keys(apiProposals));',
'export type ApiProposalName = keyof typeof apiProposals;',
'',
].join('\n');

View file

@ -239,9 +239,10 @@ function apiProposalNamesGenerator() {
'',
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
'',
'export const apiProposals = {',
'const apiProposals = {',
`${proposalNames.map(name => `\t${name}: true`).join(',\n')}`,
'};',
'export const apiProposalNames = Object.freeze(Object.keys(apiProposals));',
'export type ApiProposalName = keyof typeof apiProposals;',
'',
].join('\n');

View file

@ -5,7 +5,8 @@
// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
export const apiProposals = {
const apiProposals = {
};
export const apiProposalNames = Object.freeze(Object.keys(apiProposals));
export type ApiProposalName = keyof typeof apiProposals;

View file

@ -12,6 +12,7 @@ import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/c
import { Registry } from 'vs/platform/registry/common/platform';
import { IMessage } from 'vs/workbench/services/extensions/common/extensions';
import { ExtensionIdentifier, IExtensionDescription, EXTENSION_CATEGORIES, ExtensionKind } from 'vs/platform/extensions/common/extensions';
import { apiProposalNames } from 'vs/workbench/services/extensions/common/extensionsApiProposals';
const schemaRegistry = Registry.as<IJSONContributionRegistry>(Extensions.JSONContribution);
@ -221,6 +222,19 @@ export const schema: IJSONSchema = {
type: 'boolean',
description: nls.localize('vscode.extension.preview', 'Sets the extension to be flagged as a Preview in the Marketplace.'),
},
enableProposedApi: {
type: 'boolean',
deprecationMessage: nls.localize('vscode.extension.enableProposedApi.deprecated', 'Use `enabledApiProposals` instead.'),
},
enabledApiProposals: {
markdownDescription: nls.localize('vscode.extension.enabledApiProposals', 'Enable API proposals to try them out. Only valid **during development**. Extensions **cannot be published** with this property. For more details visit: https://code.visualstudio.com/api/advanced-topics/using-proposed-api'),
type: 'array',
uniqueItems: true,
items: {
type: 'string',
enum: apiProposalNames.slice()
}
},
activationEvents: {
description: nls.localize('vscode.extension.activationEvents', 'Activation events for the VS Code extension.'),
type: 'array',