mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 18:46:36 -05:00
* Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 * Fix test build break * Update distro * Fix build errors * Update distro * Update REH build file * Update build task names for REL * Fix product build yaml * Fix product REH task name * Fix type in task name * Update linux build step * Update windows build tasks * Turn off server publish * Disable REH * Fix typo * Bump distro * Update vscode tests * Bump distro * Fix type in disto * Bump distro * Turn off docker build * Remove docker step from release Co-authored-by: ADS Merger <andresse@microsoft.com> Co-authored-by: Karl Burtram <karlb@microsoft.com>
68 lines
3.6 KiB
TypeScript
68 lines
3.6 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { localize } from 'vs/nls';
|
|
import { IExtensionManagementServer, IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
|
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
|
import { Schemas } from 'vs/base/common/network';
|
|
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
|
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
|
import { ILabelService } from 'vs/platform/label/common/label';
|
|
import { isWeb } from 'vs/base/common/platform';
|
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
|
import { WebExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/webExtensionManagementService';
|
|
import { IExtension } from 'vs/platform/extensions/common/extensions';
|
|
import { WebRemoteExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/remoteExtensionManagementService';
|
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
|
import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
|
import { IProductService } from 'vs/platform/product/common/productService';
|
|
|
|
export class ExtensionManagementServerService implements IExtensionManagementServerService {
|
|
|
|
declare readonly _serviceBrand: undefined;
|
|
|
|
readonly localExtensionManagementServer: IExtensionManagementServer | null = null;
|
|
readonly remoteExtensionManagementServer: IExtensionManagementServer | null = null;
|
|
readonly webExtensionManagementServer: IExtensionManagementServer | null = null;
|
|
|
|
constructor(
|
|
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
|
|
@ILabelService labelService: ILabelService,
|
|
@IExtensionGalleryService galleryService: IExtensionGalleryService,
|
|
@IProductService productService: IProductService,
|
|
@IConfigurationService configurationService: IConfigurationService,
|
|
@IInstantiationService instantiationService: IInstantiationService,
|
|
) {
|
|
const remoteAgentConnection = remoteAgentService.getConnection();
|
|
if (remoteAgentConnection) {
|
|
const extensionManagementService = new WebRemoteExtensionManagementService(remoteAgentConnection.getChannel<IChannel>('extensions'), galleryService, configurationService, productService);
|
|
this.remoteExtensionManagementServer = {
|
|
id: 'remote',
|
|
extensionManagementService,
|
|
get label() { return labelService.getHostLabel(Schemas.vscodeRemote, remoteAgentConnection!.remoteAuthority) || localize('remote', "Remote"); }
|
|
};
|
|
} else if (isWeb) {
|
|
const extensionManagementService = instantiationService.createInstance(WebExtensionManagementService);
|
|
this.webExtensionManagementServer = {
|
|
id: 'web',
|
|
extensionManagementService,
|
|
label: localize('web', "Web")
|
|
};
|
|
}
|
|
}
|
|
|
|
getExtensionManagementServer(extension: IExtension): IExtensionManagementServer {
|
|
if (extension.location.scheme === Schemas.vscodeRemote) {
|
|
return this.remoteExtensionManagementServer!;
|
|
}
|
|
if (this.webExtensionManagementServer) {
|
|
return this.webExtensionManagementServer;
|
|
}
|
|
throw new Error(`Invalid Extension ${extension.location}`);
|
|
}
|
|
}
|
|
|
|
registerSingleton(IExtensionManagementServerService, ExtensionManagementServerService);
|