diff --git a/src/package.ts b/src/package.ts index ced035b..c8f63f4 100644 --- a/src/package.ts +++ b/src/package.ts @@ -140,6 +140,14 @@ export class TagsProcessor extends BaseProcessor { keywords = [...keywords, 'theme']; } + const activationEvents = this.manifest.activationEvents || []; + const languages = activationEvents + .map(e => /^onLanguage:(.*)$/.exec(e)) + .filter(r => !!r) + .map(r => r[1]); + + keywords = [...keywords, ...languages]; + this.vsix.tags = _.unique(keywords).join(','); }); } diff --git a/src/test/package.test.ts b/src/test/package.test.ts index c3ea8fe..0fbc54f 100644 --- a/src/test/package.test.ts +++ b/src/test/package.test.ts @@ -441,7 +441,7 @@ describe('toVsixManifest', () => { return _toVsixManifest(manifest, []) .then(parseXml) - .then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags, ['theme'])); + .then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags[0], 'theme')); }); it('should not automatically add theme tag when themes are empty', () => { @@ -457,7 +457,21 @@ describe('toVsixManifest', () => { return _toVsixManifest(manifest, []) .then(parseXml) - .then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags, [''])); + .then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags[0], '')); + }); + + it('should automatically add language tag', () => { + const manifest = { + name: 'test', + publisher: 'mocha', + version: '0.0.1', + engines: Object.create(null), + activationEvents: ['onLanguage:go'] + }; + + return _toVsixManifest(manifest, []) + .then(parseXml) + .then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags[0], 'go')); }); it('should remove duplicate tags', () => { @@ -471,7 +485,7 @@ describe('toVsixManifest', () => { return _toVsixManifest(manifest, []) .then(parseXml) - .then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags, ['theme'])); + .then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags[0], 'theme')); }); });