提交 694a3665 编写于 作者: B Benjamin Pasero

debt - introduce and adopt shared process service

上级 6965f5ca
......@@ -6,6 +6,7 @@
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
import { Event } from 'vs/base/common/event';
import { ILocalizationsService, LanguageType } from 'vs/platform/localizations/common/localizations';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
export class LocalizationsChannel implements IServerChannel {
......@@ -36,7 +37,11 @@ export class LocalizationsChannelClient implements ILocalizationsService {
_serviceBrand: any;
constructor(private channel: IChannel) { }
private channel: IChannel;
constructor(@ISharedProcessService sharedProcessService: ISharedProcessService) {
this.channel = sharedProcessService.getChannel('localizations');
}
get onDidLanguagesChange(): Event<void> { return this.channel.listen('onDidLanguagesChange'); }
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { Client, connect } from 'vs/base/parts/ipc/node/ipc.net';
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IChannel, getDelayedChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
export const ISharedProcessService = createDecorator<ISharedProcessService>('sharedProcessService');
export interface ISharedProcessService {
_serviceBrand: ServiceIdentifier<any>;
getChannel(channelName: string): IChannel;
registerChannel(channelName: string, channel: IServerChannel<string>): void;
}
export class SharedProcessService implements ISharedProcessService {
_serviceBrand: ServiceIdentifier<any>;
private withSharedProcessConnection: Promise<Client<string>>;
constructor(
@IWindowsService windowsService: IWindowsService,
@IWindowService windowService: IWindowService,
@IEnvironmentService environmentService: IEnvironmentService
) {
this.withSharedProcessConnection = windowsService.whenSharedProcessReady()
.then(() => connect(environmentService.sharedIPCHandle, `window:${windowService.getConfiguration().windowId}`));
}
getChannel(channelName: string): IChannel {
return getDelayedChannel(this.withSharedProcessConnection.then(connection => connection.getChannel(channelName)));
}
registerChannel(channelName: string, channel: IServerChannel<string>): void {
this.withSharedProcessConnection.then(connection => connection.registerChannel(channelName, channel));
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@ import * as os from 'os';
import * as uuid from 'vs/base/common/uuid';
import { readFile } from 'vs/base/node/pfs';
export function resolveCommonProperties(commit: string | undefined, version: string, machineId: string | undefined, installSourcePath: string): Promise<{ [name: string]: string | undefined; }> {
export function resolveCommonProperties(commit: string | undefined, version: string | undefined, machineId: string | undefined, installSourcePath: string): Promise<{ [name: string]: string | undefined; }> {
const result: { [name: string]: string | undefined; } = Object.create(null);
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
result['common.machineId'] = machineId;
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ITelemetryService, ITelemetryInfo, ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService, combinedAppender, LogAppender } from 'vs/platform/telemetry/common/telemetryUtils';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Disposable } from 'vs/base/common/lifecycle';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IProductService } from 'vs/platform/product/common/product';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc';
import { ILogService } from 'vs/platform/log/common/log';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { resolveWorkbenchCommonProperties } from 'vs/platform/telemetry/node/workbenchCommonProperties';
import { TelemetryService as BaseTelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
export class TelemetryService extends Disposable implements ITelemetryService {
_serviceBrand: any;
private impl: ITelemetryService;
constructor(
@IEnvironmentService environmentService: IEnvironmentService,
@IProductService productService: IProductService,
@ISharedProcessService sharedProcessService: ISharedProcessService,
@ILogService logService: ILogService,
@IStorageService storageService: IStorageService,
@IConfigurationService configurationService: IConfigurationService,
@IWindowService windowService: IWindowService
) {
super();
if (!environmentService.isExtensionDevelopment && !environmentService.args['disable-telemetry'] && !!productService.enableTelemetry) {
const channel = sharedProcessService.getChannel('telemetryAppender');
const config: ITelemetryServiceConfig = {
appender: combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(logService)),
commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, windowService.getConfiguration().machineId, environmentService.installSourcePath),
piiPaths: [environmentService.appRoot, environmentService.extensionsPath]
};
this.impl = this._register(new BaseTelemetryService(config, configurationService));
} else {
this.impl = NullTelemetryService;
}
}
get isOptedIn(): boolean {
return this.impl.isOptedIn;
}
publicLog(eventName: string, data?: ITelemetryData, anonymizeFilePaths?: boolean): Promise<void> {
return this.impl.publicLog(eventName, data, anonymizeFilePaths);
}
getTelemetryInfo(): Promise<ITelemetryInfo> {
return this.impl.getTelemetryInfo();
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@ export const currentSessionDateStorageKey = 'telemetry.currentSessionDate';
export const firstSessionDateStorageKey = 'telemetry.firstSessionDate';
export const lastSessionDateStorageKey = 'telemetry.lastSessionDate';
export function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string, version: string, machineId: string, installSourcePath: string): Promise<{ [name: string]: string | undefined }> {
export function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, installSourcePath: string): Promise<{ [name: string]: string | undefined }> {
return resolveCommonProperties(commit, version, machineId, installSourcePath).then(result => {
const instanceId = storageService.get(instanceStorageKey, StorageScope.GLOBAL)!;
const firstSessionDate = storageService.get(firstSessionDateStorageKey, StorageScope.GLOBAL)!;
......
......@@ -26,7 +26,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
import { IExtensionService, IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { TestContextService, TestWindowService } from 'vs/workbench/test/workbenchTestServices';
import { TestContextService, TestWindowService, TestSharedProcessService } from 'vs/workbench/test/workbenchTestServices';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
import { IWindowService } from 'vs/platform/windows/common/windows';
......@@ -37,6 +37,7 @@ import { ExtensionManagementServerService } from 'vs/workbench/services/extensio
import { IRemoteAgentService } from 'vs/workbench/services/remote/node/remoteAgentService';
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import { ExtensionIdentifier, IExtensionContributions, ExtensionType } from 'vs/platform/extensions/common/extensions';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
suite('ExtensionsActions Test', () => {
......@@ -63,7 +64,7 @@ suite('ExtensionsActions Test', () => {
instantiationService.stub(IConfigurationService, new TestConfigurationService());
instantiationService.stub(IExtensionGalleryService, ExtensionGalleryService);
instantiationService.stub(ISharedProcessService, TestSharedProcessService);
instantiationService.stub(IExtensionManagementService, ExtensionManagementService);
instantiationService.stub(IExtensionManagementService, 'onInstallExtension', installEvent.event);
......
......@@ -21,7 +21,7 @@ import { Emitter } from 'vs/base/common/event';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { TestTextResourceConfigurationService, TestContextService, TestLifecycleService, TestEnvironmentService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
import { TestTextResourceConfigurationService, TestContextService, TestLifecycleService, TestEnvironmentService, TestStorageService, TestSharedProcessService } from 'vs/workbench/test/workbenchTestServices';
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { URI } from 'vs/base/common/uri';
......@@ -48,6 +48,7 @@ import { IExperimentService } from 'vs/workbench/contrib/experiments/node/experi
import { TestExperimentService } from 'vs/workbench/contrib/experiments/test/electron-browser/experimentService.test';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
const mockExtensionGallery: IGalleryExtension[] = [
aGalleryExtension('MockExtension1', {
......@@ -184,6 +185,7 @@ suite('ExtensionsTipsService Test', () => {
uninstallEvent = new Emitter<IExtensionIdentifier>();
didUninstallEvent = new Emitter<DidUninstallExtensionEvent>();
instantiationService.stub(IExtensionGalleryService, ExtensionGalleryService);
instantiationService.stub(ISharedProcessService, TestSharedProcessService);
instantiationService.stub(ILifecycleService, new TestLifecycleService());
testConfigurationService = new TestConfigurationService();
instantiationService.stub(IConfigurationService, testConfigurationService);
......
......@@ -26,7 +26,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { TestContextService, TestWindowService } from 'vs/workbench/test/workbenchTestServices';
import { TestContextService, TestWindowService, TestSharedProcessService } from 'vs/workbench/test/workbenchTestServices';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
import { IWindowService } from 'vs/platform/windows/common/windows';
......@@ -39,6 +39,7 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/node/remoteAge
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/node/extensionManagementServerService';
import { ExtensionIdentifier, ExtensionType } from 'vs/platform/extensions/common/extensions';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
suite('ExtensionsListView Tests', () => {
......@@ -79,6 +80,7 @@ suite('ExtensionsListView Tests', () => {
instantiationService.stub(IConfigurationService, new TestConfigurationService());
instantiationService.stub(IExtensionGalleryService, ExtensionGalleryService);
instantiationService.stub(ISharedProcessService, TestSharedProcessService);
instantiationService.stub(IExperimentService, ExperimentService);
instantiationService.stub(IExtensionManagementService, ExtensionManagementService);
......
......@@ -26,7 +26,7 @@ import { IPager } from 'vs/base/common/paging';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { TestContextService, TestWindowService } from 'vs/workbench/test/workbenchTestServices';
import { TestContextService, TestWindowService, TestSharedProcessService } from 'vs/workbench/test/workbenchTestServices';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
import { IWindowService } from 'vs/platform/windows/common/windows';
......@@ -40,6 +40,7 @@ import { ExtensionType } from 'vs/platform/extensions/common/extensions';
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/node/extensionManagementServerService';
import { IRemoteAgentService } from 'vs/workbench/services/remote/node/remoteAgentService';
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
suite('ExtensionsWorkbenchServiceTest', () => {
......@@ -65,6 +66,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stub(IExtensionGalleryService, ExtensionGalleryService);
instantiationService.stub(IURLService, URLService);
instantiationService.stub(ISharedProcessService, TestSharedProcessService);
instantiationService.stub(IWorkspaceContextService, new TestContextService());
instantiationService.stub(IConfigurationService, {
......
......@@ -38,7 +38,7 @@ import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/p
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { LifecyclePhase, StartupKind, ILifecycleService, WillShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle';
import { IWindowService, IWindowConfiguration, IPath, MenuBarVisibility, getTitleBarStyle, IWindowsService } from 'vs/platform/windows/common/windows';
import { IWindowService, IWindowConfiguration, IPath, MenuBarVisibility, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { NotificationService } from 'vs/workbench/services/notification/common/notificationService';
......@@ -52,40 +52,26 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { Sizing, Direction, Grid, View } from 'vs/base/browser/ui/grid/grid';
import { WorkbenchLegacyLayout } from 'vs/workbench/browser/legacyLayout';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { setARIAContainer } from 'vs/base/browser/ui/aria/aria';
import { restoreFontInfo, readFontInfo, saveFontInfo } from 'vs/editor/browser/config/configuration';
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
import { ILogService } from 'vs/platform/log/common/log';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { combinedAppender, LogAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
import { IExtensionManagementServerService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
import { IProductService } from 'vs/platform/product/common/product';
import { WorkbenchContextKeysHandler } from 'vs/workbench/browser/contextkeys';
import { IDimension } from 'vs/platform/layout/browser/layoutService';
import { Part } from 'vs/workbench/browser/part';
// import@node
import { getDelayedChannel } from 'vs/base/parts/ipc/node/ipc';
import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net';
import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc';
import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc';
import { resolveWorkbenchCommonProperties } from 'vs/platform/telemetry/node/workbenchCommonProperties';
import { IRemoteAgentService } from 'vs/workbench/services/remote/node/remoteAgentService';
import { DownloadServiceChannel } from 'vs/platform/download/node/downloadIpc';
import { LogLevelSetterChannel } from 'vs/platform/log/node/logIpc';
import { ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/node/extensionManagementIpc';
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/node/extensionManagementServerService';
import { LocalizationsChannelClient } from 'vs/platform/localizations/node/localizationsIpc';
import { ProductService } from 'vs/platform/product/node/productService';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
// import@electron-browser
import { WindowService } from 'vs/platform/windows/electron-browser/windowService';
import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-browser/remoteAuthorityResolverService';
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
......@@ -137,7 +123,6 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
private configurationService: IConfigurationService;
private environmentService: IEnvironmentService;
private logService: ILogService;
private windowsService: IWindowsService;
private parts: Map<string, Part> = new Map<string, Part>();
......@@ -150,8 +135,7 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
@IStorageService storageService: IStorageService,
@IConfigurationService configurationService: IConfigurationService,
@IEnvironmentService environmentService: IEnvironmentService,
@ILogService logService: ILogService,
@IWindowsService windowsService: IWindowsService
@ILogService logService: ILogService
) {
super();
......@@ -161,7 +145,6 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
this.configurationService = configurationService;
this.environmentService = environmentService;
this.logService = logService;
this.windowsService = windowsService;
this.registerErrorHandler();
}
......@@ -301,53 +284,19 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
const productService = new ProductService();
serviceCollection.set(IProductService, productService); // TODO@Ben use SyncDescriptor
// Shared Process
const sharedProcess = this.windowsService.whenSharedProcessReady()
.then(() => connectNet(this.environmentService.sharedIPCHandle, `window:${this.configuration.windowId}`))
.then(client => {
client.registerChannel('dialog', this.instantiationService.createInstance(DialogChannel));
return client;
});
// Telemetry
let telemetryService: ITelemetryService;
if (!this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!productService.enableTelemetry) {
const channel = getDelayedChannel(sharedProcess.then(c => c.getChannel('telemetryAppender')));
const config: ITelemetryServiceConfig = {
appender: combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(this.logService)),
commonProperties: resolveWorkbenchCommonProperties(this.storageService, productService.commit, productService.version, this.configuration.machineId, this.environmentService.installSourcePath),
piiPaths: [this.environmentService.appRoot, this.environmentService.extensionsPath]
};
telemetryService = this._register(this.instantiationService.createInstance(TelemetryService, config));
} else {
telemetryService = NullTelemetryService;
}
serviceCollection.set(ITelemetryService, telemetryService); // TODO@Ben use SyncDescriptor
// Remote Resolver
serviceCollection.set(IRemoteAuthorityResolverService, new SyncDescriptor(RemoteAuthorityResolverService, undefined, true));
// Remote Agent
serviceCollection.set(IRemoteAgentService, new SyncDescriptor(RemoteAgentService, [this.configuration]));
// Extensions Management
const extensionManagementChannel = getDelayedChannel(sharedProcess.then(c => c.getChannel('extensions')));
const extensionManagementChannelClient = new ExtensionManagementChannelClient(extensionManagementChannel);
serviceCollection.set(IExtensionManagementServerService, new SyncDescriptor(ExtensionManagementServerService, [extensionManagementChannelClient]));
// Localization
const localizationsChannel = getDelayedChannel(sharedProcess.then(c => c.getChannel('localizations')));
serviceCollection.set(ILocalizationsService, new SyncDescriptor(LocalizationsChannelClient, [localizationsChannel]));
// Contributed services
const contributedServices = getServices();
for (let contributedService of contributedServices) {
serviceCollection.set(contributedService.id, contributedService.descriptor);
}
// TODO@Steven this should move somewhere else
this.instantiationService.invokeFunction(accessor => {
const sharedProcessService = accessor.get(ISharedProcessService);
sharedProcessService.registerChannel('dialog', this.instantiationService.createInstance(DialogChannel));
});
// TODO@Alex TODO@Sandeep this should move somewhere else
this.instantiationService.invokeFunction(accessor => {
const remoteAgentConnection = accessor.get(IRemoteAgentService).getConnection();
......
......@@ -6,11 +6,13 @@
import { localize } from 'vs/nls';
import { Schemas } from 'vs/base/common/network';
import { URI } from 'vs/base/common/uri';
import { IExtensionManagementServer, IExtensionManagementServerService, IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IExtensionManagementServer, IExtensionManagementServerService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/node/extensionManagementIpc';
import { IRemoteAgentService } from 'vs/workbench/services/remote/node/remoteAgentService';
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
import { IChannel } from 'vs/base/parts/ipc/node/ipc';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
const localExtensionManagementServerAuthority: string = 'vscode-local';
......@@ -22,9 +24,11 @@ export class ExtensionManagementServerService implements IExtensionManagementSer
readonly remoteExtensionManagementServer: IExtensionManagementServer | null = null;
constructor(
localExtensionManagementService: IExtensionManagementService,
@ISharedProcessService sharedProcessService: ISharedProcessService,
@IRemoteAgentService remoteAgentService: IRemoteAgentService
) {
const localExtensionManagementService = new ExtensionManagementChannelClient(sharedProcessService.getChannel('extensions'));
this.localExtensionManagementServer = { extensionManagementService: localExtensionManagementService, authority: localExtensionManagementServerAuthority, label: localize('local', "Local") };
const remoteAgentConnection = remoteAgentService.getConnection();
if (remoteAgentConnection) {
......@@ -42,4 +46,6 @@ export class ExtensionManagementServerService implements IExtensionManagementSer
}
return null;
}
}
\ No newline at end of file
}
registerSingleton(IExtensionManagementServerService, ExtensionManagementServerService);
\ No newline at end of file
......@@ -10,10 +10,11 @@ import { Client } from 'vs/base/parts/ipc/node/ipc.net';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { connectRemoteAgentManagement, RemoteAgentConnectionContext } from 'vs/platform/remote/node/remoteAgentConnection';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { RemoteExtensionEnvironmentChannelClient } from 'vs/workbench/services/remote/node/remoteAgentEnvironmentChannel';
import { IRemoteAgentConnection, IRemoteAgentEnvironment, IRemoteAgentService } from 'vs/workbench/services/remote/node/remoteAgentService';
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
export class RemoteAgentService implements IRemoteAgentService {
......@@ -22,13 +23,14 @@ export class RemoteAgentService implements IRemoteAgentService {
private readonly _connection: IRemoteAgentConnection | null = null;
constructor(
window: IWindowConfiguration,
@IWindowService windowService: IWindowService,
@INotificationService notificationService: INotificationService,
@IEnvironmentService environmentService: IEnvironmentService,
@IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService
) {
if (window.remoteAuthority) {
this._connection = new RemoteAgentConnection(window.remoteAuthority, notificationService, environmentService, remoteAuthorityResolverService);
const { remoteAuthority } = windowService.getConfiguration();
if (remoteAuthority) {
this._connection = new RemoteAgentConnection(remoteAuthority, notificationService, environmentService, remoteAuthorityResolverService);
}
}
......@@ -83,3 +85,5 @@ class RemoteAgentConnection extends Disposable implements IRemoteAgentConnection
return this._connection;
}
}
registerSingleton(IRemoteAgentService, RemoteAgentService);
\ No newline at end of file
......@@ -81,6 +81,7 @@ import { Part } from 'vs/workbench/browser/part';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IPanel } from 'vs/workbench/common/panel';
import { IBadge } from 'vs/workbench/services/activity/common/activity';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
return instantiationService.createInstance(FileEditorInput, resource, undefined);
......@@ -1560,4 +1561,15 @@ export class TestHashService implements IHashService {
createSHA1(content: string): string {
return content;
}
}
export class TestSharedProcessService implements ISharedProcessService {
_serviceBrand: ServiceIdentifier<any>;
getChannel(channelName: string): any {
return undefined;
}
registerChannel(channelName: string, channel: any): void { }
}
\ No newline at end of file
......@@ -71,6 +71,13 @@ import { IRequestService } from 'vs/platform/request/node/request';
import { RequestService } from 'vs/platform/request/electron-browser/requestService';
import { LifecycleService } from 'vs/platform/lifecycle/electron-browser/lifecycleService';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
import { LocalizationsChannelClient } from 'vs/platform/localizations/node/localizationsIpc';
import { ISharedProcessService, SharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-browser/remoteAuthorityResolverService';
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { TelemetryService } from 'vs/platform/telemetry/node/telemetryService';
import 'vs/workbench/services/bulkEdit/browser/bulkEditService';
import 'vs/workbench/services/integrity/node/integrityService';
......@@ -107,6 +114,8 @@ import 'vs/workbench/services/extensions/electron-browser/extensionService';
import 'vs/workbench/services/contextmenu/electron-browser/contextmenuService';
import 'vs/workbench/services/extensionManagement/node/multiExtensionManagement';
import 'vs/workbench/services/label/common/labelService';
import 'vs/workbench/services/extensions/node/extensionManagementServerService';
import 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
registerSingleton(IMenuService, MenuService, true);
registerSingleton(IListService, ListService, true);
......@@ -125,6 +134,10 @@ registerSingleton(IContextViewService, ContextViewService, true);
registerSingleton(IExtensionGalleryService, ExtensionGalleryService, true);
registerSingleton(IRequestService, RequestService, true);
registerSingleton(ILifecycleService, LifecycleService);
registerSingleton(ILocalizationsService, LocalizationsChannelClient);
registerSingleton(ISharedProcessService, SharedProcessService, true);
registerSingleton(IRemoteAuthorityResolverService, RemoteAuthorityResolverService, true);
registerSingleton(ITelemetryService, TelemetryService);
//#endregion
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册