add ExtensionKindController

This commit is contained in:
Martin Aeschlimann
2021-03-10 19:27:54 +01:00
parent a2b5e58b09
commit 7cae7b5ced
11 changed files with 135 additions and 90 deletions

View File

@@ -20,7 +20,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IProductService } from 'vs/platform/product/common/productService';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { canExecuteOnWorkspace } from 'vs/workbench/services/extensions/common/extensionsUtil';
import { ExtensionKindController } from 'vs/workbench/services/extensions/common/extensionsUtil';
import { IExtensionManifest } from 'vs/workbench/workbench.web.api';
@@ -78,10 +78,12 @@ class RemoteExtensionCLIManagementService extends ExtensionManagementCLIService
private _location: string | undefined;
private readonly _extensionKindController: ExtensionKindController;
constructor(
@IExtensionManagementService extensionManagementService: IExtensionManagementService,
@IProductService private readonly productService: IProductService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionGalleryService extensionGalleryService: IExtensionGalleryService,
@ILocalizationsService localizationsService: ILocalizationsService,
@ILabelService labelService: ILabelService,
@@ -91,6 +93,8 @@ class RemoteExtensionCLIManagementService extends ExtensionManagementCLIService
const remoteAuthority = envService.remoteAuthority;
this._location = remoteAuthority ? labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority) : undefined;
this._extensionKindController = new ExtensionKindController(productService, configurationService);
}
protected get location(): string | undefined {
@@ -98,7 +102,7 @@ class RemoteExtensionCLIManagementService extends ExtensionManagementCLIService
}
protected validateExtensionKind(manifest: IExtensionManifest, output: CLIOutput): boolean {
if (!canExecuteOnWorkspace(manifest, this.productService, this.configurationService)) {
if (!this._extensionKindController.canExecuteOnWorkspace(manifest)) {
output.log(localize('cannot be installed', "Cannot install the '{0}' extension because it is declared to not run in this setup.", getExtensionId(manifest.publisher, manifest.name)));
return false;
}