async onEnd()

in src/package.ts [553:624]


	async onEnd(): Promise<void> {
		const keywords = this.manifest.keywords ?? [];
		const contributes = this.manifest.contributes;
		const activationEvents = this.manifest.activationEvents ?? [];
		const doesContribute = (...properties: string[]) => {
			let obj = contributes;
			for (const property of properties) {
				if (!obj) {
					return false;
				}
				obj = obj[property];
			}
			return obj && obj.length > 0;
		};

		const colorThemes = doesContribute('themes') ? ['theme', 'color-theme'] : [];
		const iconThemes = doesContribute('iconThemes') ? ['theme', 'icon-theme'] : [];
		const productIconThemes = doesContribute('productIconThemes') ? ['theme', 'product-icon-theme'] : [];
		const snippets = doesContribute('snippets') ? ['snippet'] : [];
		const keybindings = doesContribute('keybindings') ? ['keybindings'] : [];
		const debuggers = doesContribute('debuggers') ? ['debuggers'] : [];
		const json = doesContribute('jsonValidation') ? ['json'] : [];
		const remoteMenu = doesContribute('menus', 'statusBar/remoteIndicator') ? ['remote-menu'] : [];

		const localizationContributions = ((contributes && contributes['localizations']) ?? []).reduce<string[]>(
			(r, l) => [...r, `lp-${l.languageId}`, ...toLanguagePackTags(l.translations, l.languageId)],
			[]
		);

		const languageContributions = ((contributes && contributes['languages']) ?? []).reduce<string[]>(
			(r, l) => [...r, l.id, ...(l.aliases ?? []), ...toExtensionTags(l.extensions ?? [])],
			[]
		);

		const languageActivations = activationEvents
			.map(e => /^onLanguage:(.*)$/.exec(e))
			.filter(util.nonnull)
			.map(r => r[1]);

		const grammars = ((contributes && contributes['grammars']) ?? []).map(g => g.language);

		const description = this.manifest.description || '';
		const descriptionKeywords = Object.keys(TagsProcessor.Keywords).reduce<string[]>(
			(r, k) =>
				r.concat(
					new RegExp('\\b(?:' + escapeRegExp(k) + ')(?!\\w)', 'gi').test(description) ? TagsProcessor.Keywords[k] : []
				),
			[]
		);

		const webExensionTags = isWebKind(this.manifest) ? ['__web_extension'] : [];

		const tags = new Set([
			...keywords,
			...colorThemes,
			...iconThemes,
			...productIconThemes,
			...snippets,
			...keybindings,
			...debuggers,
			...json,
			...remoteMenu,
			...localizationContributions,
			...languageContributions,
			...languageActivations,
			...grammars,
			...descriptionKeywords,
			...webExensionTags,
		]);

		this.tags = [...tags].filter(tag => !!tag);
	}