parent
8fe3e91f31
commit
4b8c129e54
2 changed files with 30 additions and 9 deletions
|
@ -134,19 +134,24 @@ export class TagsProcessor extends BaseProcessor {
|
|||
|
||||
return promise.then<any>(keywords => {
|
||||
const contributes = this.manifest.contributes;
|
||||
const themes = contributes && contributes['themes'];
|
||||
|
||||
if (themes && themes.length > 0) {
|
||||
keywords = [...keywords, 'theme'];
|
||||
}
|
||||
|
||||
const activationEvents = this.manifest.activationEvents || [];
|
||||
const languages = activationEvents
|
||||
|
||||
const themes = contributes && contributes['themes'] && contributes['themes'].length > 0 ? ['theme'] : [];
|
||||
|
||||
const languageContributions = ((contributes && contributes['languages']) || [])
|
||||
.map(l => l.id);
|
||||
|
||||
const languageActivations = activationEvents
|
||||
.map(e => /^onLanguage:(.*)$/.exec(e))
|
||||
.filter(r => !!r)
|
||||
.map(r => r[1]);
|
||||
|
||||
keywords = [...keywords, ...languages];
|
||||
keywords = [
|
||||
...keywords,
|
||||
...themes,
|
||||
...languageContributions,
|
||||
...languageActivations
|
||||
];
|
||||
|
||||
this.vsix.tags = _.unique(keywords).join(',');
|
||||
});
|
||||
|
|
|
@ -460,7 +460,7 @@ describe('toVsixManifest', () => {
|
|||
.then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags[0], ''));
|
||||
});
|
||||
|
||||
it('should automatically add language tag', () => {
|
||||
it('should automatically add language tag with activationEvent', () => {
|
||||
const manifest = {
|
||||
name: 'test',
|
||||
publisher: 'mocha',
|
||||
|
@ -474,6 +474,22 @@ describe('toVsixManifest', () => {
|
|||
.then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags[0], 'go'));
|
||||
});
|
||||
|
||||
it('should automatically add language tag with language contribution', () => {
|
||||
const manifest = {
|
||||
name: 'test',
|
||||
publisher: 'mocha',
|
||||
version: '0.0.1',
|
||||
engines: Object.create(null),
|
||||
contributes: {
|
||||
languages: [{ id: 'go' }]
|
||||
}
|
||||
};
|
||||
|
||||
return _toVsixManifest(manifest, [])
|
||||
.then(parseXml)
|
||||
.then(result => assert.deepEqual(result.PackageManifest.Metadata[0].Tags[0], 'go'));
|
||||
});
|
||||
|
||||
it('should remove duplicate tags', () => {
|
||||
const manifest = {
|
||||
name: 'test',
|
||||
|
|
Loading…
Add table
Reference in a new issue