diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index 7fe7dc12012..e869771e86c 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -23,7 +23,7 @@ import { DownloadService } from 'vs/platform/download/common/downloadService'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; -import { ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService'; +import { ExtensionGalleryCLIService } from 'vs/platform/extensionManagement/common/extensionGalleryService'; import { IExtensionGalleryService, IExtensionManagementCLIService, IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { ExtensionManagementCLIService } from 'vs/platform/extensionManagement/common/extensionManagementCLIService'; import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService'; @@ -140,7 +140,7 @@ class CliMain extends Disposable { // Extensions services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService)); - services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService)); + services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryCLIService)); services.set(IExtensionManagementCLIService, new SyncDescriptor(ExtensionManagementCLIService)); // Localizations diff --git a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts index c0b75c8e493..fdffe3895e0 100644 --- a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts +++ b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts @@ -18,7 +18,6 @@ import { adoptToGalleryExtensionId, areSameExtensions, getGalleryExtensionId, ge import { IExtensionManifest } from 'vs/platform/extensions/common/extensions'; import { isEngineValid } from 'vs/platform/extensions/common/extensionValidator'; import { IFileService } from 'vs/platform/files/common/files'; -import { optional } from 'vs/platform/instantiation/common/instantiation'; import { ILogService } from 'vs/platform/log/common/log'; import { IProductService } from 'vs/platform/product/common/productService'; import { asJson, asText, IRequestService, isSuccess } from 'vs/platform/request/common/request'; @@ -407,7 +406,7 @@ interface IRawExtensionsReport { slow: string[]; } -export class ExtensionGalleryService implements IExtensionGalleryService { +abstract class AbstractExtensionGalleryService implements IExtensionGalleryService { declare readonly _serviceBrand: undefined; @@ -417,6 +416,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService { private readonly commonHeadersPromise: Promise<{ [key: string]: string; }>; constructor( + storageService: IStorageService | undefined, @IRequestService private readonly requestService: IRequestService, @ILogService private readonly logService: ILogService, @IEnvironmentService private readonly environmentService: IEnvironmentService, @@ -424,7 +424,6 @@ export class ExtensionGalleryService implements IExtensionGalleryService { @IFileService private readonly fileService: IFileService, @IProductService private readonly productService: IProductService, @IConfigurationService private readonly configurationService: IConfigurationService, - @optional(IStorageService) storageService: IStorageService, ) { const config = productService.extensionsGallery; this.extensionsGalleryUrl = config && config.serviceUrl; @@ -891,6 +890,37 @@ export class ExtensionGalleryService implements IExtensionGalleryService { } } +export class ExtensionGalleryService extends AbstractExtensionGalleryService { + + constructor( + @IStorageService storageService: IStorageService, + @IRequestService requestService: IRequestService, + @ILogService logService: ILogService, + @IEnvironmentService environmentService: IEnvironmentService, + @ITelemetryService telemetryService: ITelemetryService, + @IFileService fileService: IFileService, + @IProductService productService: IProductService, + @IConfigurationService configurationService: IConfigurationService, + ) { + super(storageService, requestService, logService, environmentService, telemetryService, fileService, productService, configurationService); + } +} + +export class ExtensionGalleryCLIService extends AbstractExtensionGalleryService { + + constructor( + @IRequestService requestService: IRequestService, + @ILogService logService: ILogService, + @IEnvironmentService environmentService: IEnvironmentService, + @ITelemetryService telemetryService: ITelemetryService, + @IFileService fileService: IFileService, + @IProductService productService: IProductService, + @IConfigurationService configurationService: IConfigurationService, + ) { + super(undefined, requestService, logService, environmentService, telemetryService, fileService, productService, configurationService); + } +} + export async function resolveMarketplaceHeaders(version: string, productService: IProductService, environmentService: IEnvironmentService, configurationService: IConfigurationService, fileService: IFileService, storageService: { get: (key: string, scope: StorageScope) => string | undefined, store: (key: string, value: string, scope: StorageScope, target: StorageTarget) => void