提交 d56c4846 编写于 作者: S Sandeep Somavarapu

fix #76715

上级 b29fec00
......@@ -596,29 +596,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
// re-schedule this bit of the operation to be off the critical path - in case glob-match is slow
setImmediate(async () => {
const installed = await this.extensionManagementService.getInstalled(ExtensionType.User);
if (await this.promptRecommendedExtensionForFileType(model, installed)) {
return;
}
if (fileExtension) {
fileExtension = fileExtension.substr(1); // Strip the dot
}
if (!fileExtension) {
return;
}
await this.extensionService.whenInstalledExtensionsRegistered();
const mimeTypes = guessMimeTypes(uri);
if (mimeTypes.length !== 1 || mimeTypes[0] !== MIME_UNKNOWN) {
return;
}
this.promptRecommendedExtensionForFileExtension(fileExtension, installed);
});
}
private async promptRecommendedExtensionForFileType(model: ITextModel, installed: ILocalExtension[]): Promise<boolean> {
let recommendationsToSuggest: string[] = [];
const now = Date.now();
forEach(this._availableRecommendations, entry => {
......@@ -646,9 +624,32 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
const config = this.configurationService.getValue<IExtensionsConfiguration>(ConfigurationKey);
if (config.ignoreRecommendations || config.showRecommendationsOnlyOnDemand) {
return false;
return;
}
const installed = await this.extensionManagementService.getInstalled(ExtensionType.User);
if (await this.promptRecommendedExtensionForFileType(recommendationsToSuggest, installed)) {
return;
}
if (fileExtension) {
fileExtension = fileExtension.substr(1); // Strip the dot
}
if (!fileExtension) {
return;
}
await this.extensionService.whenInstalledExtensionsRegistered();
const mimeTypes = guessMimeTypes(uri);
if (mimeTypes.length !== 1 || mimeTypes[0] !== MIME_UNKNOWN) {
return;
}
this.promptRecommendedExtensionForFileExtension(fileExtension, installed);
});
}
private async promptRecommendedExtensionForFileType(recommendationsToSuggest: string[], installed: ILocalExtension[]): Promise<boolean> {
const importantRecommendationsIgnoreList = <string[]>JSON.parse(this.storageService.get('extensionsAssistant/importantRecommendationsIgnore', StorageScope.GLOBAL, '[]'));
const installedExtensionsIds = installed.reduce((result, i) => { result.add(i.identifier.id.toLowerCase()); return result; }, new Set<string>());
recommendationsToSuggest = recommendationsToSuggest.filter(id => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册