Skip to content

Commit 33daacd

Browse files
authored
fix #1006 (#1007)
1 parent dba04c7 commit 33daacd

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/package.ts

+3
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ export interface VSIX {
193193
extensionPack: string;
194194
extensionKind: string;
195195
localizedLanguages: string;
196+
enabledApiProposals: string;
196197
preRelease: boolean;
197198
sponsorLink: string;
198199
pricing: string;
@@ -541,6 +542,7 @@ export class ManifestProcessor extends BaseProcessor {
541542
.map(loc => loc.localizedLanguageName ?? loc.languageName ?? loc.languageId)
542543
.join(',')
543544
: '',
545+
enabledApiProposals: manifest.enabledApiProposals ? manifest.enabledApiProposals.join(',') : '',
544546
preRelease: !!this.options.preRelease,
545547
sponsorLink: manifest.sponsor?.url || '',
546548
};
@@ -1461,6 +1463,7 @@ export async function toVsixManifest(vsix: VSIX): Promise<string> {
14611463
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="${escape(vsix.extensionPack)}" />
14621464
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="${escape(vsix.extensionKind)}" />
14631465
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="${escape(vsix.localizedLanguages)}" />
1466+
<Property Id="Microsoft.VisualStudio.Code.EnabledApiProposals" Value="${escape(vsix.enabledApiProposals)}" />
14641467
${vsix.preRelease ? `<Property Id="Microsoft.VisualStudio.Code.PreRelease" Value="${escape(vsix.preRelease)}" />` : ''}
14651468
${vsix.sponsorLink
14661469
? `<Property Id="Microsoft.VisualStudio.Code.SponsorLink" Value="${escape(vsix.sponsorLink)}" />`

src/test/package.test.ts

+26
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,32 @@ describe('toVsixManifest', () => {
19121912
const xmlManifest = await parseXmlManifest(raw);
19131913
assertProperty(xmlManifest, 'Microsoft.VisualStudio.Services.Content.Pricing', 'Trial');
19141914
});
1915+
1916+
it('should expose enabledApiProposals as properties', () => {
1917+
const manifest = {
1918+
name: 'test',
1919+
publisher: 'mocha',
1920+
version: '0.0.1',
1921+
engines: Object.create(null),
1922+
enabledApiProposals: [
1923+
'foo',
1924+
'bar@2'
1925+
],
1926+
};
1927+
1928+
return _toVsixManifest(manifest, [])
1929+
.then(parseXmlManifest)
1930+
.then(result => {
1931+
const properties = result.PackageManifest.Metadata[0].Properties[0].Property;
1932+
const enabledApiProposalsProp = properties.filter(p => p.$.Id === 'Microsoft.VisualStudio.Code.EnabledApiProposals');
1933+
assert.strictEqual(enabledApiProposalsProp.length, 1);
1934+
1935+
const enabledApiProposals = enabledApiProposalsProp[0].$.Value.split(',');
1936+
assert.strictEqual(enabledApiProposals.length, 2);
1937+
assert.strictEqual(enabledApiProposals[0], 'foo');
1938+
assert.strictEqual(enabledApiProposals[1], 'bar@2');
1939+
});
1940+
});
19151941
});
19161942

19171943
describe('qna', () => {

0 commit comments

Comments
 (0)