Consider moving ILaunchMainService.getRemoteDiagnostics to IDiagnosticsService (fix #141025)

This commit is contained in:
Benjamin Pasero
2022-01-20 09:46:14 +01:00
parent 08a0f23926
commit 0e44e127e3
5 changed files with 116 additions and 57 deletions

View File

@@ -34,6 +34,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { CredentialsMainService, ICredentialsMainService } from 'vs/platform/credentials/node/credentialsMainService';
import { ElectronExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/electron-main/extensionHostDebugIpc';
import { IDiagnosticsService } from 'vs/platform/diagnostics/common/diagnostics';
import { DiagnosticsMainService, IDiagnosticsMainService } from 'vs/platform/diagnostics/electron-main/diagnosticsMainService';
import { DialogMainService, IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogMainService';
import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
import { EncryptionMainService, IEncryptionMainService } from 'vs/platform/encryption/node/encryptionMainService';
@@ -572,6 +573,7 @@ export class CodeApplication extends Disposable {
services.set(ILaunchMainService, new SyncDescriptor(LaunchMainService));
// Diagnostics
services.set(IDiagnosticsMainService, new SyncDescriptor(DiagnosticsMainService));
services.set(IDiagnosticsService, ProxyChannel.toService(getDelayedChannel(sharedProcessReady.then(client => client.getChannel('diagnostics')))));
// Issues
@@ -647,13 +649,17 @@ export class CodeApplication extends Disposable {
private initChannels(accessor: ServicesAccessor, mainProcessElectronServer: ElectronIPCServer, sharedProcessClient: Promise<MessagePortClient>): void {
// Launch: this one is explicitly registered to the node.js
// server because when a second instance starts up, that is
// the only possible connection between the first and the
// second instance. Electron IPC does not work across apps.
// Channels registered to node.js are exposed to second instances
// launching because that is the only way the second instance
// can talk to the first instance. Electron IPC does not work
// across apps until `requestSingleInstance` APIs are adopted.
const launchChannel = ProxyChannel.fromService(accessor.get(ILaunchMainService), { disableMarshalling: true });
this.mainProcessNodeIpcServer.registerChannel('launch', launchChannel);
const diagnosticsChannel = ProxyChannel.fromService(accessor.get(IDiagnosticsMainService), { disableMarshalling: true });
this.mainProcessNodeIpcServer.registerChannel('diagnostics', diagnosticsChannel);
// Local Files
const diskFileSystemProvider = this.fileService.getProvider(Schemas.file);
assertType(diskFileSystemProvider instanceof DiskFileSystemProvider);