提交 79d85e40 编写于 作者: S Sandeep Somavarapu

support extension packs in exe recommendations

上级 855f75e0
......@@ -237,7 +237,8 @@ export type IConfigBasedExtensionTip = {
export type IExecutableBasedExtensionTip = {
readonly extensionId: string,
readonly friendlyName: string,
readonly extensionName: string,
readonly isExtensionPack: boolean,
readonly exeFriendlyName: string,
readonly windowsPath?: string,
};
......
......@@ -21,7 +21,7 @@ import { ExtensionTipsService as BaseExtensionTipsService } from 'vs/platform/ex
type IExeBasedExtensionTips = {
readonly exeFriendlyName: string,
readonly windowsPath?: string,
readonly recommendations: { extensionId: string, extensionName: string }[];
readonly recommendations: { extensionId: string, extensionName: string, isExtensionPack: boolean }[];
};
export class ExtensionTipsService extends BaseExtensionTipsService {
......@@ -41,13 +41,13 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
super(fileService, productService, requestService, logService);
if (productService.exeBasedExtensionTips) {
forEach(productService.exeBasedExtensionTips, ({ key, value }) => {
const importantRecommendations: { extensionId: string, extensionName: string }[] = [];
const otherRecommendations: { extensionId: string, extensionName: string }[] = [];
const importantRecommendations: { extensionId: string, extensionName: string, isExtensionPack: boolean }[] = [];
const otherRecommendations: { extensionId: string, extensionName: string, isExtensionPack: boolean }[] = [];
forEach(value.recommendations, ({ key: extensionId, value }) => {
if (value.important) {
importantRecommendations.push({ extensionId, extensionName: value.name });
importantRecommendations.push({ extensionId, extensionName: value.name, isExtensionPack: !!value.isExtensionPack });
} else {
otherRecommendations.push({ extensionId, extensionName: value.name });
otherRecommendations.push({ extensionId, extensionName: value.name, isExtensionPack: !!value.isExtensionPack });
}
});
if (importantRecommendations.length) {
......@@ -99,10 +99,11 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
checkedExecutables.set(exePath, exists);
}
if (exists) {
for (const { extensionId, extensionName: friendlyName } of extensionTip.recommendations) {
for (const { extensionId, extensionName, isExtensionPack } of extensionTip.recommendations) {
result.push({
extensionId,
friendlyName,
extensionName,
isExtensionPack,
exeFriendlyName: extensionTip.exeFriendlyName,
windowsPath: extensionTip.windowsPath,
});
......
......@@ -131,7 +131,7 @@ export interface IConfigBasedExtensionTip {
export interface IExeBasedExtensionTip {
friendlyName: string;
windowsPath?: string;
recommendations: IStringDictionary<{ name: string, important?: boolean }>;
recommendations: IStringDictionary<{ name: string, important?: boolean, isExtensionPack?: boolean }>;
}
export interface IRemoteExtensionTip {
......
......@@ -87,7 +87,8 @@ export class ExeBasedRecommendations extends ExtensionRecommendations {
for (const extensionId of recommendations) {
const tip = importantExeBasedRecommendations[extensionId];
const message = localize('exeRecommended', "The '{0}' extension is recommended as you have {1} installed on your system.", tip.friendlyName!, tip.exeFriendlyName || basename(tip.windowsPath!));
const message = tip.isExtensionPack ? localize('extensionPackRecommended', "The '{0}' extension pack is recommended as you have {1} installed on your system.", tip.extensionName!, tip.exeFriendlyName || basename(tip.windowsPath!))
: localize('exeRecommended', "The '{0}' extension is recommended as you have {1} installed on your system.", tip.extensionName!, tip.exeFriendlyName || basename(tip.windowsPath!));
this.promptImportantExtensionInstallNotification(extensionId, message);
}
}
......@@ -111,7 +112,7 @@ export class ExeBasedRecommendations extends ExtensionRecommendations {
source: 'executable',
reason: {
reasonId: ExtensionRecommendationReason.Executable,
reasonText: localize('exeBasedRecommendation', "This extension is recommended because you have {0} installed.", tip.friendlyName)
reasonText: localize('exeBasedRecommendation', "This extension is recommended because you have {0} installed.", tip.extensionName)
}
};
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册