diff --git a/src/vs/base/common/product.ts b/src/vs/base/common/product.ts index 93783e6b5164f..b8114824ee543 100644 --- a/src/vs/base/common/product.ts +++ b/src/vs/base/common/product.ts @@ -232,7 +232,7 @@ export interface IConfigBasedExtensionTip { configScheme?: string; recommendations: IStringDictionary<{ name: string; - remotes?: string[]; + contentPattern?: string; important?: boolean; isExtensionPack?: boolean; whenNotInstalled?: string[]; diff --git a/src/vs/platform/extensionManagement/common/extensionTipsService.ts b/src/vs/platform/extensionManagement/common/extensionTipsService.ts index 88134849a4686..2796900ab7bd4 100644 --- a/src/vs/platform/extensionManagement/common/extensionTipsService.ts +++ b/src/vs/platform/extensionManagement/common/extensionTipsService.ts @@ -8,7 +8,6 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IConfigBasedExtensionTip as IRawConfigBasedExtensionTip } from 'vs/base/common/product'; import { joinPath } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; -import { getDomainsOfRemotes } from 'vs/platform/extensionManagement/common/configRemotes'; import { IConfigBasedExtensionTip, IExecutableBasedExtensionTip, IExtensionManagementService, IExtensionTipsService, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; import { IFileService } from 'vs/platform/files/common/files'; import { IProductService } from 'vs/platform/product/common/productService'; @@ -62,21 +61,15 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe continue; } try { - const content = await this.fileService.readFile(joinPath(folder, configPath)); - const recommendationByRemote: Map = new Map(); - Object.entries(tip.recommendations).forEach(([key, value]) => { - if (isNonEmptyArray(value.remotes)) { - for (const remote of value.remotes) { - recommendationByRemote.set(remote, { - extensionId: key, - extensionName: value.name, - configName: tip.configName, - important: !!value.important, - isExtensionPack: !!value.isExtensionPack, - whenNotInstalled: value.whenNotInstalled - }); - } - } else { + let content: string | undefined; + const getContent = async () => { + if (content === undefined) { + content = (await this.fileService.readFile(joinPath(folder, configPath))).value.toString(); + } + return content; + }; + for (const [key, value] of Object.entries(tip.recommendations)) { + if (!value.contentPattern || new RegExp(value.contentPattern, 'mig').test(await getContent())) { result.push({ extensionId: key, extensionName: value.name, @@ -86,13 +79,6 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe whenNotInstalled: value.whenNotInstalled }); } - }); - const domains = getDomainsOfRemotes(content.value.toString(), [...recommendationByRemote.keys()]); - for (const domain of domains) { - const remote = recommendationByRemote.get(domain); - if (remote) { - result.push(remote); - } } } catch (error) { /* Ignore */ } }