mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35:40 -05:00
Merge from vscode 2e5312cd61ff99c570299ecc122c52584265eda2
This commit is contained in:
committed by
Anthony Dresser
parent
3603f55d97
commit
7f1d8fc32f
@@ -771,7 +771,6 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
||||
// Scan other system extensions during development
|
||||
const devSystemExtensionsPromise = this.getDevSystemExtensionsList()
|
||||
.then(devSystemExtensionsList => {
|
||||
console.log(devSystemExtensionsList);
|
||||
if (devSystemExtensionsList.length) {
|
||||
return this.scanExtensions(this.devSystemExtensionsPath, ExtensionType.System)
|
||||
.then(result => {
|
||||
|
||||
@@ -12,13 +12,13 @@ import { INativeEnvironmentService } from 'vs/platform/environment/node/environm
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
import { IExtensionTipsService, IExecutableBasedExtensionTip, IWorkspaceTips } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExecutableBasedExtensionTip } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IStringDictionary, forEach } from 'vs/base/common/collections';
|
||||
import { IRequestService, asJson } from 'vs/platform/request/common/request';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
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';
|
||||
|
||||
export class ExtensionTipsService implements IExtensionTipsService {
|
||||
export class ExtensionTipsService extends BaseExtensionTipsService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
@@ -26,14 +26,15 @@ export class ExtensionTipsService implements IExtensionTipsService {
|
||||
private readonly allOtherExecutableTips: IStringDictionary<IExeBasedExtensionTip> = {};
|
||||
|
||||
constructor(
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@IEnvironmentService private readonly environmentService: IEnvironmentService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IRequestService private readonly requestService: IRequestService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IEnvironmentService private readonly environmentService: INativeEnvironmentService,
|
||||
@IFileService fileService: IFileService,
|
||||
@IProductService productService: IProductService,
|
||||
@IRequestService requestService: IRequestService,
|
||||
@ILogService logService: ILogService,
|
||||
) {
|
||||
if (this.productService.exeBasedExtensionTips) {
|
||||
forEach(this.productService.exeBasedExtensionTips, ({ key, value }) => {
|
||||
super(fileService, productService, requestService, logService);
|
||||
if (productService.exeBasedExtensionTips) {
|
||||
forEach(productService.exeBasedExtensionTips, ({ key, value }) => {
|
||||
if (value.important) {
|
||||
this.allImportantExecutableTips[key] = value;
|
||||
} else {
|
||||
@@ -43,10 +44,6 @@ export class ExtensionTipsService implements IExtensionTipsService {
|
||||
}
|
||||
}
|
||||
|
||||
getAllWorkspacesTips(): Promise<IWorkspaceTips[]> {
|
||||
return this.fetchWorkspacesTips();
|
||||
}
|
||||
|
||||
getImportantExecutableBasedTips(): Promise<IExecutableBasedExtensionTip[]> {
|
||||
return this.getValidExecutableBasedExtensionTips(this.allImportantExecutableTips);
|
||||
}
|
||||
@@ -76,7 +73,7 @@ export class ExtensionTipsService implements IExtensionTipsService {
|
||||
}
|
||||
} else {
|
||||
exePaths.push(join('/usr/local/bin', exeName));
|
||||
exePaths.push(join((this.environmentService as INativeEnvironmentService).userHome.fsPath, exeName));
|
||||
exePaths.push(join(this.environmentService.userHome.fsPath, exeName));
|
||||
}
|
||||
|
||||
for (const exePath of exePaths) {
|
||||
@@ -99,24 +96,4 @@ export class ExtensionTipsService implements IExtensionTipsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
private async fetchWorkspacesTips(): Promise<IWorkspaceTips[]> {
|
||||
if (!this.productService.extensionsGallery?.recommendationsUrl) {
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
const context = await this.requestService.request({ type: 'GET', url: this.productService.extensionsGallery?.recommendationsUrl }, CancellationToken.None);
|
||||
if (context.res.statusCode !== 200) {
|
||||
return [];
|
||||
}
|
||||
const result = await asJson<{ workspaceRecommendations?: IWorkspaceTips[] }>(context);
|
||||
if (!result) {
|
||||
return [];
|
||||
}
|
||||
return result.workspaceRecommendations || [];
|
||||
} catch (error) {
|
||||
this.logService.error(error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user