mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 1b314ab317fbff7d799b21754326b7d849889ceb
This commit is contained in:
@@ -130,6 +130,6 @@ export class ExtensionsLifecycle extends Disposable {
|
||||
}
|
||||
|
||||
private getExtensionStoragePath(extension: ILocalExtension): string {
|
||||
return join(this.environmentService.globalStorageHome, extension.identifier.id.toLowerCase());
|
||||
return join(this.environmentService.globalStorageHome.fsPath, extension.identifier.id.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { join, } from 'vs/base/common/path';
|
||||
import { IProductService, IExeBasedExtensionTip } from 'vs/platform/product/common/productService';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { env as processEnv } from 'vs/base/common/process';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
@@ -13,17 +13,23 @@ import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
import { IExecutableBasedExtensionTip } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IStringDictionary, forEach } from 'vs/base/common/collections';
|
||||
import { forEach } from 'vs/base/common/collections';
|
||||
import { IRequestService } from 'vs/platform/request/common/request';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ExtensionTipsService as BaseExtensionTipsService } from 'vs/platform/extensionManagement/common/extensionTipsService';
|
||||
|
||||
type IExeBasedExtensionTips = {
|
||||
readonly exeFriendlyName: string,
|
||||
readonly windowsPath?: string,
|
||||
readonly recommendations: { extensionId: string, extensionName: string, isExtensionPack: boolean }[];
|
||||
};
|
||||
|
||||
export class ExtensionTipsService extends BaseExtensionTipsService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private readonly allImportantExecutableTips: IStringDictionary<IExeBasedExtensionTip> = {};
|
||||
private readonly allOtherExecutableTips: IStringDictionary<IExeBasedExtensionTip> = {};
|
||||
private readonly allImportantExecutableTips: Map<string, IExeBasedExtensionTips> = new Map<string, IExeBasedExtensionTips>();
|
||||
private readonly allOtherExecutableTips: Map<string, IExeBasedExtensionTips> = new Map<string, IExeBasedExtensionTips>();
|
||||
|
||||
constructor(
|
||||
@IEnvironmentService private readonly environmentService: INativeEnvironmentService,
|
||||
@@ -35,10 +41,20 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
|
||||
super(fileService, productService, requestService, logService);
|
||||
if (productService.exeBasedExtensionTips) {
|
||||
forEach(productService.exeBasedExtensionTips, ({ key, value }) => {
|
||||
if (value.important) {
|
||||
this.allImportantExecutableTips[key] = value;
|
||||
} else {
|
||||
this.allOtherExecutableTips[key] = value;
|
||||
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, isExtensionPack: !!value.isExtensionPack });
|
||||
} else {
|
||||
otherRecommendations.push({ extensionId, extensionName: value.name, isExtensionPack: !!value.isExtensionPack });
|
||||
}
|
||||
});
|
||||
if (importantRecommendations.length) {
|
||||
this.allImportantExecutableTips.set(key, { exeFriendlyName: value.friendlyName, windowsPath: value.windowsPath, recommendations: importantRecommendations });
|
||||
}
|
||||
if (otherRecommendations.length) {
|
||||
this.allOtherExecutableTips.set(key, { exeFriendlyName: value.friendlyName, windowsPath: value.windowsPath, recommendations: otherRecommendations });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -52,13 +68,13 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
|
||||
return this.getValidExecutableBasedExtensionTips(this.allOtherExecutableTips);
|
||||
}
|
||||
|
||||
private async getValidExecutableBasedExtensionTips(executableTips: IStringDictionary<IExeBasedExtensionTip>): Promise<IExecutableBasedExtensionTip[]> {
|
||||
private async getValidExecutableBasedExtensionTips(executableTips: Map<string, IExeBasedExtensionTips>): Promise<IExecutableBasedExtensionTip[]> {
|
||||
const result: IExecutableBasedExtensionTip[] = [];
|
||||
|
||||
const checkedExecutables: Map<string, boolean> = new Map<string, boolean>();
|
||||
for (const exeName of Object.keys(executableTips)) {
|
||||
const extensionTip = executableTips[exeName];
|
||||
if (!isNonEmptyArray(extensionTip?.recommendations)) {
|
||||
for (const exeName of executableTips.keys()) {
|
||||
const extensionTip = executableTips.get(exeName);
|
||||
if (!extensionTip || !isNonEmptyArray(extensionTip.recommendations)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -83,12 +99,15 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
|
||||
checkedExecutables.set(exePath, exists);
|
||||
}
|
||||
if (exists) {
|
||||
extensionTip.recommendations.forEach(recommendation => result.push({
|
||||
extensionId: recommendation,
|
||||
friendlyName: extensionTip.friendlyName,
|
||||
exeFriendlyName: extensionTip.exeFriendlyName,
|
||||
windowsPath: extensionTip.windowsPath,
|
||||
}));
|
||||
for (const { extensionId, extensionName, isExtensionPack } of extensionTip.recommendations) {
|
||||
result.push({
|
||||
extensionId,
|
||||
extensionName,
|
||||
isExtensionPack,
|
||||
exeFriendlyName: extensionTip.exeFriendlyName,
|
||||
windowsPath: extensionTip.windowsPath,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user