tweak generation of propsal file a little bit
This commit is contained in:
parent
6eac98960d
commit
b48a7f385e
|
@ -186,7 +186,7 @@ function apiProposalNamesGenerator() {
|
|||
for (let file of fs.readdirSync(dtsFolder)) {
|
||||
const match = pattern.exec(file);
|
||||
if (match) {
|
||||
proposalNames.push(match[1]);
|
||||
proposalNames.push([match[1], `https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/${file}`]);
|
||||
}
|
||||
}
|
||||
const source = [
|
||||
|
@ -197,11 +197,11 @@ function apiProposalNamesGenerator() {
|
|||
'',
|
||||
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
|
||||
'',
|
||||
'const apiProposals = {',
|
||||
`${proposalNames.map(name => `\t${name}: true`).join(',\n')}`,
|
||||
'};',
|
||||
'export type ApiProposalName = keyof typeof apiProposals;',
|
||||
'export const apiProposalNames: ReadonlySet<ApiProposalName> = new Set(<ApiProposalName[]>Object.keys(apiProposals));',
|
||||
'export const allApiProposals = Object.freeze({',
|
||||
`${proposalNames.map(t => `\t${t[0]}: '${t[1]}'`).join(',\n')}`,
|
||||
'});',
|
||||
'export type ApiProposalName = keyof typeof allApiProposals;',
|
||||
'export const allApiProposalNames = <readonly ApiProposalName[]><unknown>Object.keys(allApiProposals);',
|
||||
'',
|
||||
].join('\n');
|
||||
const outFile = path.join(dtsFolder, '../vs/workbench/services/extensions/common/extensionsApiProposals.ts');
|
||||
|
|
|
@ -223,11 +223,11 @@ function apiProposalNamesGenerator() {
|
|||
try {
|
||||
|
||||
const t1 = Date.now();
|
||||
const proposalNames: string[] = [];
|
||||
const proposalNames: [name: string, url: string][] = [];
|
||||
for (let file of fs.readdirSync(dtsFolder)) {
|
||||
const match = pattern.exec(file);
|
||||
if (match) {
|
||||
proposalNames.push(match[1]);
|
||||
proposalNames.push([match[1], `https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/${file}`]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,11 +239,11 @@ function apiProposalNamesGenerator() {
|
|||
'',
|
||||
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
|
||||
'',
|
||||
'const apiProposals = {',
|
||||
`${proposalNames.map(name => `\t${name}: true`).join(',\n')}`,
|
||||
'};',
|
||||
'export type ApiProposalName = keyof typeof apiProposals;',
|
||||
'export const apiProposalNames: ReadonlySet<ApiProposalName> = new Set(<ApiProposalName[]>Object.keys(apiProposals));',
|
||||
'export const allApiProposals = Object.freeze({',
|
||||
`${proposalNames.map(t => `\t${t[0]}: '${t[1]}'`).join(',\n')}`,
|
||||
'});',
|
||||
'export type ApiProposalName = keyof typeof allApiProposals;',
|
||||
'export const allApiProposalNames = <readonly ApiProposalName[]><unknown>Object.keys(allApiProposals);',
|
||||
'',
|
||||
].join('\n');
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import { URI } from 'vs/base/common/uri';
|
|||
import { IExtensionManifestPropertiesService } from 'vs/workbench/services/extensions/common/extensionManifestPropertiesService';
|
||||
import { Logger } from 'vs/workbench/services/extensions/common/extensionPoints';
|
||||
import { dedupExtensions } from 'vs/workbench/services/extensions/common/extensionsUtil';
|
||||
import { ApiProposalName, apiProposalNames } from 'vs/workbench/services/extensions/common/extensionsApiProposals';
|
||||
import { ApiProposalName, allApiProposalNames } from 'vs/workbench/services/extensions/common/extensionsApiProposals';
|
||||
import { forEach } from 'vs/base/common/collections';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
|
@ -1143,7 +1143,7 @@ class ProposedApiController {
|
|||
if (isNonEmptyArray(productService.extensionAllowedProposedApi)) {
|
||||
for (let id of productService.extensionAllowedProposedApi) {
|
||||
const key = ExtensionIdentifier.toKey(id);
|
||||
this._productEnabledExtensions.set(key, Array.from(apiProposalNames));
|
||||
this._productEnabledExtensions.set(key, allApiProposalNames.slice());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1151,7 +1151,8 @@ class ProposedApiController {
|
|||
if (productService.extensionEnabledApiProposals) {
|
||||
forEach(productService.extensionEnabledApiProposals, entry => {
|
||||
const proposalNames = entry.value.filter(name => {
|
||||
if (!apiProposalNames.has(<ApiProposalName>name)) {
|
||||
if (!allApiProposalNames.includes(<ApiProposalName>name)) {
|
||||
_logService.warn(`Extension '${key} wants API proposal '${name}' but that proposal DOES NOT EXIST.`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
|
||||
|
||||
const apiProposals = {
|
||||
export const allApiProposals = Object.freeze({
|
||||
|
||||
};
|
||||
export type ApiProposalName = keyof typeof apiProposals;
|
||||
export const apiProposalNames: ReadonlySet<ApiProposalName> = new Set(<ApiProposalName[]>Object.keys(apiProposals));
|
||||
});
|
||||
export type ApiProposalName = keyof typeof allApiProposals;
|
||||
export const allApiProposalNames = <readonly ApiProposalName[]><unknown>Object.keys(allApiProposals);
|
||||
|
|
|
@ -12,7 +12,8 @@ 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';
|
||||
import { allApiProposals } from 'vs/workbench/services/extensions/common/extensionsApiProposals';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
|
||||
const schemaRegistry = Registry.as<IJSONContributionRegistry>(Extensions.JSONContribution);
|
||||
|
||||
|
@ -232,7 +233,8 @@ export const schema: IJSONSchema = {
|
|||
uniqueItems: true,
|
||||
items: {
|
||||
type: 'string',
|
||||
enum: Array.from(apiProposalNames)
|
||||
enum: Object.keys(allApiProposals),
|
||||
markdownEnumDescriptions: values(allApiProposals)
|
||||
}
|
||||
},
|
||||
activationEvents: {
|
||||
|
|
Loading…
Reference in a new issue