mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Simplify RPCProtocol usage (#36972)
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ExtensionHostMain, exit } from 'vs/workbench/node/extensionHostMain';
|
||||
import { RPCProtocol } from 'vs/workbench/services/extensions/node/rpcProtocol';
|
||||
import { parse } from 'vs/base/common/marshalling';
|
||||
import { IInitData } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
|
||||
@@ -16,7 +15,7 @@ import { createConnection } from 'net';
|
||||
import Event, { filterEvent } from 'vs/base/common/event';
|
||||
|
||||
interface IRendererConnection {
|
||||
rpcProtocol: RPCProtocol;
|
||||
protocol: IMessagePassingProtocol;
|
||||
initData: IInitData;
|
||||
}
|
||||
|
||||
@@ -70,7 +69,6 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
|
||||
first.dispose();
|
||||
|
||||
const initData = parse(raw);
|
||||
const rpcProtocol = new RPCProtocol(protocol);
|
||||
|
||||
// Print a console message when rejection isn't handled within N seconds. For details:
|
||||
// see https://nodejs.org/api/process.html#process_event_unhandledrejection
|
||||
@@ -111,7 +109,7 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
|
||||
// Tell the outside that we are initialized
|
||||
protocol.send('initialized');
|
||||
|
||||
c({ rpcProtocol, initData });
|
||||
c({ protocol, initData });
|
||||
});
|
||||
|
||||
// Tell the outside that we are ready to receive messages
|
||||
@@ -126,7 +124,7 @@ createExtHostProtocol().then(protocol => {
|
||||
return connectToRenderer(protocol);
|
||||
}).then(renderer => {
|
||||
// setup things
|
||||
const extensionHostMain = new ExtensionHostMain(renderer.rpcProtocol, renderer.initData);
|
||||
const extensionHostMain = new ExtensionHostMain(renderer.protocol, renderer.initData);
|
||||
onTerminate = () => extensionHostMain.terminate();
|
||||
return extensionHostMain.start();
|
||||
}).catch(err => console.error(err));
|
||||
|
||||
Reference in New Issue
Block a user