Skip to content

Commit

Permalink
fix #1006 (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored Jun 19, 2024
1 parent dba04c7 commit 33daacd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export interface VSIX {
extensionPack: string;
extensionKind: string;
localizedLanguages: string;
enabledApiProposals: string;
preRelease: boolean;
sponsorLink: string;
pricing: string;
Expand Down Expand Up @@ -541,6 +542,7 @@ export class ManifestProcessor extends BaseProcessor {
.map(loc => loc.localizedLanguageName ?? loc.languageName ?? loc.languageId)
.join(',')
: '',
enabledApiProposals: manifest.enabledApiProposals ? manifest.enabledApiProposals.join(',') : '',
preRelease: !!this.options.preRelease,
sponsorLink: manifest.sponsor?.url || '',
};
Expand Down Expand Up @@ -1461,6 +1463,7 @@ export async function toVsixManifest(vsix: VSIX): Promise<string> {
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="${escape(vsix.extensionPack)}" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="${escape(vsix.extensionKind)}" />
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="${escape(vsix.localizedLanguages)}" />
<Property Id="Microsoft.VisualStudio.Code.EnabledApiProposals" Value="${escape(vsix.enabledApiProposals)}" />
${vsix.preRelease ? `<Property Id="Microsoft.VisualStudio.Code.PreRelease" Value="${escape(vsix.preRelease)}" />` : ''}
${vsix.sponsorLink
? `<Property Id="Microsoft.VisualStudio.Code.SponsorLink" Value="${escape(vsix.sponsorLink)}" />`
Expand Down
26 changes: 26 additions & 0 deletions src/test/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1912,6 +1912,32 @@ describe('toVsixManifest', () => {
const xmlManifest = await parseXmlManifest(raw);
assertProperty(xmlManifest, 'Microsoft.VisualStudio.Services.Content.Pricing', 'Trial');
});

it('should expose enabledApiProposals as properties', () => {
const manifest = {
name: 'test',
publisher: 'mocha',
version: '0.0.1',
engines: Object.create(null),
enabledApiProposals: [
'foo',
'bar@2'
],
};

return _toVsixManifest(manifest, [])
.then(parseXmlManifest)
.then(result => {
const properties = result.PackageManifest.Metadata[0].Properties[0].Property;
const enabledApiProposalsProp = properties.filter(p => p.$.Id === 'Microsoft.VisualStudio.Code.EnabledApiProposals');
assert.strictEqual(enabledApiProposalsProp.length, 1);

const enabledApiProposals = enabledApiProposalsProp[0].$.Value.split(',');
assert.strictEqual(enabledApiProposals.length, 2);
assert.strictEqual(enabledApiProposals[0], 'foo');
assert.strictEqual(enabledApiProposals[1], 'bar@2');
});
});
});

describe('qna', () => {
Expand Down

0 comments on commit 33daacd

Please sign in to comment.