@eclipse-glsp/server 1.1.0-RC06 → 1.1.0-RC08
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/di/app-module.d.ts +2 -7
- package/lib/browser/di/app-module.d.ts.map +1 -1
- package/lib/browser/di/app-module.js +5 -30
- package/lib/browser/di/app-module.js.map +1 -1
- package/lib/browser/index.d.ts +0 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +0 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/launch/worker-server-launcher.d.ts +4 -4
- package/lib/browser/launch/worker-server-launcher.d.ts.map +1 -1
- package/lib/browser/launch/worker-server-launcher.js +5 -11
- package/lib/browser/launch/worker-server-launcher.js.map +1 -1
- package/lib/common/actions/client-action-handler.d.ts +1 -2
- package/lib/common/actions/client-action-handler.d.ts.map +1 -1
- package/lib/common/actions/client-action-handler.js +17 -2
- package/lib/common/actions/client-action-handler.js.map +1 -1
- package/lib/common/command/command-stack.d.ts +16 -1
- package/lib/common/command/command-stack.d.ts.map +1 -1
- package/lib/common/command/command-stack.js +0 -15
- package/lib/common/command/command-stack.js.map +1 -1
- package/lib/common/di/client-session-module.d.ts +1 -1
- package/lib/common/di/client-session-module.d.ts.map +1 -1
- package/lib/common/di/client-session-module.js +2 -2
- package/lib/common/di/client-session-module.js.map +1 -1
- package/lib/common/di/glsp-module.d.ts +3 -1
- package/lib/common/di/glsp-module.d.ts.map +1 -1
- package/lib/common/di/glsp-module.js +0 -15
- package/lib/common/di/glsp-module.js.map +1 -1
- package/lib/common/di/multi-binding.d.ts +19 -4
- package/lib/common/di/multi-binding.d.ts.map +1 -1
- package/lib/common/di/multi-binding.js.map +1 -1
- package/lib/common/di/server-module.d.ts +1 -6
- package/lib/common/di/server-module.d.ts.map +1 -1
- package/lib/common/di/server-module.js +21 -17
- package/lib/common/di/server-module.js.map +1 -1
- package/lib/common/index.d.ts +1 -2
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -2
- package/lib/common/index.js.map +1 -1
- package/lib/common/launch/glsp-server-launcher.d.ts +1 -1
- package/lib/common/launch/glsp-server-launcher.d.ts.map +1 -1
- package/lib/common/launch/glsp-server-launcher.js +2 -2
- package/lib/common/launch/glsp-server-launcher.js.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.d.ts +38 -0
- package/lib/common/launch/jsonrpc-server-launcher.d.ts.map +1 -0
- package/lib/common/launch/jsonrpc-server-launcher.js +84 -0
- package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -0
- package/lib/common/protocol/glsp-server.d.ts +4 -104
- package/lib/common/protocol/glsp-server.d.ts.map +1 -1
- package/lib/common/protocol/glsp-server.js +13 -20
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/protocol/glsp-server.spec.js +18 -5
- package/lib/common/protocol/glsp-server.spec.js.map +1 -1
- package/lib/common/session/client-session-factory.d.ts +1 -2
- package/lib/common/session/client-session-factory.d.ts.map +1 -1
- package/lib/common/session/client-session-factory.js +17 -2
- package/lib/common/session/client-session-factory.js.map +1 -1
- package/lib/common/session/client-session-factory.spec.js +2 -2
- package/lib/common/session/client-session-factory.spec.js.map +1 -1
- package/lib/common/session/client-session-manager.d.ts +1 -3
- package/lib/common/session/client-session-manager.d.ts.map +1 -1
- package/lib/common/session/client-session-manager.js.map +1 -1
- package/lib/common/test/mock-util.d.ts +3 -6
- package/lib/common/test/mock-util.d.ts.map +1 -1
- package/lib/common/test/mock-util.js.map +1 -1
- package/lib/{browser/di → common/utils}/console-logger.d.ts +7 -1
- package/lib/common/utils/console-logger.d.ts.map +1 -0
- package/lib/{browser/di → common/utils}/console-logger.js +26 -8
- package/lib/common/utils/console-logger.js.map +1 -0
- package/lib/common/utils/logger.d.ts +21 -0
- package/lib/common/utils/logger.d.ts.map +1 -1
- package/lib/common/utils/logger.js +12 -1
- package/lib/common/utils/logger.js.map +1 -1
- package/lib/node/di/app-module.d.ts +2 -2
- package/lib/node/di/app-module.d.ts.map +1 -1
- package/lib/node/di/app-module.js +10 -35
- package/lib/node/di/app-module.js.map +1 -1
- package/lib/node/launch/cli-parser.d.ts +2 -3
- package/lib/node/launch/cli-parser.d.ts.map +1 -1
- package/lib/node/launch/cli-parser.js.map +1 -1
- package/lib/node/launch/socket-cli-parser.js +1 -1
- package/lib/node/launch/socket-cli-parser.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.d.ts +2 -23
- package/lib/node/launch/socket-server-launcher.d.ts.map +1 -1
- package/lib/node/launch/socket-server-launcher.js +8 -28
- package/lib/node/launch/socket-server-launcher.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.spec.js +5 -0
- package/lib/node/launch/socket-server-launcher.spec.js.map +1 -1
- package/lib/node/launch/websocket-server-launcher.d.ts +2 -8
- package/lib/node/launch/websocket-server-launcher.d.ts.map +1 -1
- package/lib/node/launch/websocket-server-launcher.js +4 -28
- package/lib/node/launch/websocket-server-launcher.js.map +1 -1
- package/package.json +4 -4
- package/src/browser/di/app-module.ts +4 -32
- package/src/browser/index.ts +0 -1
- package/src/browser/launch/worker-server-launcher.ts +7 -13
- package/src/common/actions/client-action-handler.ts +1 -2
- package/src/common/command/command-stack.ts +1 -1
- package/src/common/di/client-session-module.ts +1 -1
- package/src/common/di/glsp-module.ts +3 -1
- package/src/common/di/multi-binding.ts +4 -5
- package/src/common/di/server-module.ts +6 -21
- package/src/common/index.ts +1 -2
- package/src/common/launch/glsp-server-launcher.ts +2 -2
- package/src/common/launch/jsonrpc-server-launcher.ts +95 -0
- package/src/common/protocol/glsp-server.spec.ts +7 -4
- package/src/common/protocol/glsp-server.ts +17 -132
- package/src/common/session/client-session-factory.spec.ts +1 -1
- package/src/common/session/client-session-factory.ts +1 -2
- package/src/common/session/client-session-manager.ts +1 -3
- package/src/common/test/mock-util.ts +5 -5
- package/src/{browser/di → common/utils}/console-logger.ts +19 -1
- package/src/common/utils/logger.ts +16 -1
- package/src/node/di/app-module.ts +4 -13
- package/src/node/launch/cli-parser.ts +2 -3
- package/src/node/launch/socket-cli-parser.ts +1 -1
- package/src/node/launch/socket-server-launcher.spec.ts +6 -0
- package/src/node/launch/socket-server-launcher.ts +8 -30
- package/src/node/launch/websocket-server-launcher.ts +5 -31
- package/lib/browser/di/console-logger.d.ts.map +0 -1
- package/lib/browser/di/console-logger.js.map +0 -1
- package/lib/common/protocol/glsp-client-proxy.d.ts +0 -45
- package/lib/common/protocol/glsp-client-proxy.d.ts.map +0 -1
- package/lib/common/protocol/glsp-client-proxy.js +0 -53
- package/lib/common/protocol/glsp-client-proxy.js.map +0 -1
- package/lib/common/protocol/glsp-server-listener.d.ts +0 -37
- package/lib/common/protocol/glsp-server-listener.d.ts.map +0 -1
- package/lib/common/protocol/glsp-server-listener.js +0 -5
- package/lib/common/protocol/glsp-server-listener.js.map +0 -1
- package/src/common/protocol/glsp-client-proxy.ts +0 -65
- package/src/common/protocol/glsp-server-listener.ts +0 -39
|
@@ -25,26 +25,25 @@ exports.SocketServerLauncher = exports.START_UP_COMPLETE_MSG = void 0;
|
|
|
25
25
|
*
|
|
26
26
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
27
27
|
********************************************************************************/
|
|
28
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
28
29
|
const inversify_1 = require("inversify");
|
|
29
30
|
const net = require("net");
|
|
30
31
|
const jsonrpc = require("vscode-jsonrpc/node");
|
|
31
|
-
const
|
|
32
|
-
const glsp_server_launcher_1 = require("../../common/launch/glsp-server-launcher");
|
|
33
|
-
const glsp_server_1 = require("../../common/protocol/glsp-server");
|
|
32
|
+
const jsonrpc_server_launcher_1 = require("../../common/launch/jsonrpc-server-launcher");
|
|
34
33
|
const logger_1 = require("../../common/utils/logger");
|
|
35
34
|
exports.START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed. Accepting requests on port:';
|
|
36
|
-
let SocketServerLauncher = class SocketServerLauncher extends
|
|
35
|
+
let SocketServerLauncher = class SocketServerLauncher extends jsonrpc_server_launcher_1.JsonRpcGLSPServerLauncher {
|
|
37
36
|
constructor() {
|
|
38
37
|
super();
|
|
39
|
-
this.
|
|
40
|
-
this.startupCompleteMessage = exports.START_UP_COMPLETE_MSG;
|
|
41
|
-
this.toDispose.push(__1.Disposable.create(() => {
|
|
42
|
-
this.currentConnections.forEach(connection => connection.dispose());
|
|
38
|
+
this.toDispose.push(protocol_1.Disposable.create(() => {
|
|
43
39
|
this.netServer.close();
|
|
44
40
|
}));
|
|
45
41
|
}
|
|
46
42
|
run(opts) {
|
|
47
|
-
this.netServer = net.createServer(socket =>
|
|
43
|
+
this.netServer = net.createServer(socket => {
|
|
44
|
+
const connection = this.createConnection(socket);
|
|
45
|
+
this.createServerInstance(connection);
|
|
46
|
+
});
|
|
48
47
|
this.netServer.listen(opts.port, opts.host);
|
|
49
48
|
this.netServer.on('listening', () => {
|
|
50
49
|
const addressInfo = this.netServer.address();
|
|
@@ -70,25 +69,6 @@ let SocketServerLauncher = class SocketServerLauncher extends glsp_server_launch
|
|
|
70
69
|
this.netServer.on('error', error => reject(error));
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
|
-
async createClientConnection(socket) {
|
|
74
|
-
const container = this.createContainer();
|
|
75
|
-
const connection = this.createConnection(socket);
|
|
76
|
-
this.currentConnections.push(connection);
|
|
77
|
-
const glspServer = container.get(glsp_server_1.JsonRpcGLSPServer);
|
|
78
|
-
glspServer.connect(connection);
|
|
79
|
-
this.logger.info(`Starting GLSP server connection for client: '${socket.localAddress}'`);
|
|
80
|
-
connection.listen();
|
|
81
|
-
connection.onDispose(() => this.disposeClientConnection(container, glspServer));
|
|
82
|
-
socket.on('close', () => this.disposeClientConnection(container, glspServer));
|
|
83
|
-
return new Promise((resolve, rejects) => {
|
|
84
|
-
connection.onClose(() => resolve(undefined));
|
|
85
|
-
connection.onError(error => rejects(error));
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
disposeClientConnection(container, glspServer) {
|
|
89
|
-
glspServer.shutdown();
|
|
90
|
-
container.unbindAll();
|
|
91
|
-
}
|
|
92
72
|
createConnection(socket) {
|
|
93
73
|
return jsonrpc.createMessageConnection(new jsonrpc.SocketMessageReader(socket), new jsonrpc.SocketMessageWriter(socket), console);
|
|
94
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-server-launcher.js","sourceRoot":"","sources":["../../../src/node/launch/socket-server-launcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"socket-server-launcher.js","sourceRoot":"","sources":["../../../src/node/launch/socket-server-launcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAoD;AACpD,yCAA+C;AAC/C,2BAA2B;AAC3B,+CAA+C;AAC/C,yFAAwF;AACxF,sDAAmD;AAEtC,QAAA,qBAAqB,GAAG,8DAA8D,CAAC;AAG7F,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,mDAAmD;IAKzF;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,CAAC,IAAI,CACf,qBAAU,CAAC,MAAM,CAAC,GAAG,EAAE;YACnB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QAC3B,CAAC,CAAC,CACL,CAAC;IACN,CAAC;IAES,GAAG,CAAC,IAA8B;QACxC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;YACvC,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YACjD,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,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AC,IAAI,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,IAAI,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IACtI,CAAC;CACJ,CAAA;AA/CG;IAAC,IAAA,kBAAM,EAAC,eAAM,CAAC;8BAA4B,eAAM;oDAAC;AADzC,oBAAoB;IADhC,IAAA,sBAAU,GAAE;;GACA,oBAAoB,CAgDhC;AAhDY,oDAAoB"}
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
16
|
********************************************************************************/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
18
19
|
const chai_1 = require("chai");
|
|
19
20
|
const inversify_1 = require("inversify");
|
|
20
21
|
const net = require("net");
|
|
22
|
+
const sinon = require("sinon");
|
|
23
|
+
const glsp_server_1 = require("../../common/protocol/glsp-server");
|
|
21
24
|
const app_module_1 = require("../di/app-module");
|
|
22
25
|
const socket_cli_parser_1 = require("./socket-cli-parser");
|
|
23
26
|
const socket_server_launcher_1 = require("./socket-server-launcher");
|
|
@@ -25,7 +28,9 @@ const severPort = 5008;
|
|
|
25
28
|
describe('test SocketServerLauncher', () => {
|
|
26
29
|
it('starts and stops', async () => {
|
|
27
30
|
const appContainer = new inversify_1.Container();
|
|
31
|
+
const serverStub = sinon.createStubInstance(glsp_server_1.DefaultGLSPServer);
|
|
28
32
|
appContainer.load((0, app_module_1.createAppModule)(socket_cli_parser_1.defaultSocketLaunchOptions));
|
|
33
|
+
appContainer.bind(protocol_1.GLSPServer).toConstantValue(serverStub);
|
|
29
34
|
const launcher = appContainer.resolve(socket_server_launcher_1.SocketServerLauncher);
|
|
30
35
|
launcher.start({ port: severPort });
|
|
31
36
|
const sockStart = new net.Socket();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-server-launcher.spec.js","sourceRoot":"","sources":["../../../src/node/launch/socket-server-launcher.spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;AAElF,+BAA8B;AAC9B,yCAAsC;AACtC,2BAA2B;AAC3B,iDAAmD;AACnD,2DAAiE;AACjE,qEAAgE;AAChE,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAC9B,MAAM,YAAY,GAAG,IAAI,qBAAS,EAAE,CAAC;QACrC,YAAY,CAAC,IAAI,CAAC,IAAA,4BAAe,EAAC,8CAA0B,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"socket-server-launcher.spec.js","sourceRoot":"","sources":["../../../src/node/launch/socket-server-launcher.spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;AAElF,qDAAoD;AACpD,+BAA8B;AAC9B,yCAAsC;AACtC,2BAA2B;AAC3B,+BAA+B;AAC/B,mEAAsE;AACtE,iDAAmD;AACnD,2DAAiE;AACjE,qEAAgE;AAChE,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAC9B,MAAM,YAAY,GAAG,IAAI,qBAAS,EAAE,CAAC;QACrC,MAAM,UAAU,GAAG,KAAK,CAAC,kBAAkB,CAAC,+BAAiB,CAAC,CAAC;QAC/D,YAAY,CAAC,IAAI,CAAC,IAAA,4BAAe,EAAC,8CAA0B,CAAC,CAAC,CAAC;QAE/D,YAAY,CAAC,IAAI,CAAC,qBAAU,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAC1D,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,6CAAoB,CAAC,CAAC;QAC5D,QAAQ,CAAC,KAAK,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,CAAC;YACd,CAAC,CAAC;iBACD,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;gBAChB,aAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YAC1C,CAAC,CAAC;iBACD,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QACH,MAAM,WAAW,CAAC;IACtB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -16,11 +16,9 @@
|
|
|
16
16
|
/// <reference types="node" />
|
|
17
17
|
import { MaybePromise, WebSocketWrapper } from '@eclipse-glsp/protocol';
|
|
18
18
|
import * as http from 'http';
|
|
19
|
-
import { Container } from 'inversify';
|
|
20
19
|
import * as jsonrpc from 'vscode-jsonrpc';
|
|
21
20
|
import { Server, WebSocket } from 'ws';
|
|
22
|
-
import {
|
|
23
|
-
import { GLSPServer } from '../../common/protocol/glsp-server';
|
|
21
|
+
import { JsonRpcGLSPServerLauncher } from '../../common/launch/jsonrpc-server-launcher';
|
|
24
22
|
import { Logger } from '../../common/utils/logger';
|
|
25
23
|
export interface WebSocketServerOptions {
|
|
26
24
|
host?: string;
|
|
@@ -37,15 +35,11 @@ export interface WebsocketConnectionData {
|
|
|
37
35
|
socket: WebSocket;
|
|
38
36
|
connection: jsonrpc.MessageConnection;
|
|
39
37
|
}
|
|
40
|
-
export declare class WebSocketServerLauncher extends
|
|
38
|
+
export declare class WebSocketServerLauncher extends JsonRpcGLSPServerLauncher<WebSocketServerOptions> {
|
|
41
39
|
protected logger: Logger;
|
|
42
40
|
protected server: Server;
|
|
43
|
-
protected startupCompleteMessage: string;
|
|
44
|
-
protected currentConnections: jsonrpc.MessageConnection[];
|
|
45
41
|
constructor();
|
|
46
42
|
protected run(options: WebSocketServerOptions): Promise<void>;
|
|
47
|
-
protected createClientConnection(socket: WebSocket): Promise<void>;
|
|
48
|
-
protected disposeClientConnection(container: Container, glspServer: GLSPServer): void;
|
|
49
43
|
protected createConnection(socket: WebSocket): jsonrpc.MessageConnection;
|
|
50
44
|
protected resolveOptions(options: WebSocketServerOptions): Promise<ResolvedWebSocketServerOptions>;
|
|
51
45
|
protected createHttpServer(port: number, host?: string): http.Server;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket-server-launcher.d.ts","sourceRoot":"","sources":["../../../src/node/launch/websocket-server-launcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;;AAElF,OAAO,EAAyC,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/G,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"websocket-server-launcher.d.ts","sourceRoot":"","sources":["../../../src/node/launch/websocket-server-launcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;;AAElF,OAAO,EAAyC,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/G,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,MAAM,WAAW,sBAAsB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,8BAA8B;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,SAAS,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC;CACzC;AAID,qBACa,uBAAwB,SAAQ,yBAAyB,CAAC,sBAAsB,CAAC;IAC1F,UACmB,MAAM,EAAE,MAAM,CAAC;IAElC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;;cAWT,GAAG,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBnE,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,iBAAiB;cAIxD,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAQxG,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM;IAgB3D,KAAK,CAAC,OAAO,EAAE,sBAAsB,GAAG,YAAY,CAAC,IAAI,CAAC;CAGtE;AAeD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,gBAAgB,CAQjE"}
|
|
@@ -30,18 +30,13 @@ const http = require("http");
|
|
|
30
30
|
const inversify_1 = require("inversify");
|
|
31
31
|
const net = require("net");
|
|
32
32
|
const ws_1 = require("ws");
|
|
33
|
-
const
|
|
34
|
-
const glsp_server_1 = require("../../common/protocol/glsp-server");
|
|
33
|
+
const jsonrpc_server_launcher_1 = require("../../common/launch/jsonrpc-server-launcher");
|
|
35
34
|
const logger_1 = require("../../common/utils/logger");
|
|
36
|
-
const socket_server_launcher_1 = require("./socket-server-launcher");
|
|
37
35
|
const STATUS_UPGRADE_REQUIRED = 426;
|
|
38
|
-
let WebSocketServerLauncher = class WebSocketServerLauncher extends
|
|
36
|
+
let WebSocketServerLauncher = class WebSocketServerLauncher extends jsonrpc_server_launcher_1.JsonRpcGLSPServerLauncher {
|
|
39
37
|
constructor() {
|
|
40
38
|
super();
|
|
41
|
-
this.startupCompleteMessage = socket_server_launcher_1.START_UP_COMPLETE_MSG;
|
|
42
|
-
this.currentConnections = [];
|
|
43
39
|
this.toDispose.push(protocol_1.Disposable.create(() => {
|
|
44
|
-
this.currentConnections.forEach(connection => connection.dispose());
|
|
45
40
|
this.server.close();
|
|
46
41
|
}));
|
|
47
42
|
}
|
|
@@ -52,33 +47,14 @@ let WebSocketServerLauncher = class WebSocketServerLauncher extends glsp_server_
|
|
|
52
47
|
this.logger.info(`The GLSP Websocket launcher is ready to accept new client requests on endpoint '${endpoint}'`);
|
|
53
48
|
console.log(this.startupCompleteMessage.concat(resolvedOptions.port.toString()));
|
|
54
49
|
this.server.on('connection', (ws, req) => {
|
|
55
|
-
this.
|
|
50
|
+
const connection = this.createConnection(ws);
|
|
51
|
+
this.createServerInstance(connection);
|
|
56
52
|
});
|
|
57
53
|
return new Promise((resolve, reject) => {
|
|
58
54
|
this.server.on('close', () => resolve(undefined));
|
|
59
55
|
this.server.on('error', error => reject(error));
|
|
60
56
|
});
|
|
61
57
|
}
|
|
62
|
-
async createClientConnection(socket) {
|
|
63
|
-
const container = this.createContainer();
|
|
64
|
-
const connection = this.createConnection(socket);
|
|
65
|
-
this.currentConnections.push(connection);
|
|
66
|
-
const glspServer = container.get(glsp_server_1.JsonRpcGLSPServer);
|
|
67
|
-
glspServer.connect(connection);
|
|
68
|
-
this.logger.info('Starting GLSP server connection');
|
|
69
|
-
connection.listen();
|
|
70
|
-
connection.onDispose(() => this.disposeClientConnection(container, glspServer));
|
|
71
|
-
socket.on('close', () => this.disposeClientConnection(container, glspServer));
|
|
72
|
-
connection.onClose(() => console.log('GOD dam'));
|
|
73
|
-
return new Promise((resolve, rejects) => {
|
|
74
|
-
connection.onClose(() => resolve(undefined));
|
|
75
|
-
connection.onError(error => rejects(error));
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
disposeClientConnection(container, glspServer) {
|
|
79
|
-
glspServer.shutdown();
|
|
80
|
-
container.unbindAll();
|
|
81
|
-
}
|
|
82
58
|
createConnection(socket) {
|
|
83
59
|
return (0, protocol_1.createWebSocketConnection)(wrapWebSocket(socket));
|
|
84
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket-server-launcher.js","sourceRoot":"","sources":["../../../src/node/launch/websocket-server-launcher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,qDAA+G;AAC/G,6BAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"websocket-server-launcher.js","sourceRoot":"","sources":["../../../src/node/launch/websocket-server-launcher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,qDAA+G;AAC/G,6BAA6B;AAC7B,yCAA+C;AAC/C,2BAA2B;AAE3B,2BAAuC;AACvC,yFAAwF;AACxF,sDAAmD;AAoBnD,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAG7B,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,mDAAiD;IAM1F;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,CAAC,IAAI,CACf,qBAAU,CAAC,MAAM,CAAC,GAAG,EAAE;YACnB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC,CAAC,CACL,CAAC;IACN,CAAC;IAES,KAAK,CAAC,GAAG,CAAC,OAA+B;QAC/C,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,GAAG,IAAI,WAAM,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;QACzF,MAAM,QAAQ,GAAG,QAAQ,eAAe,CAAC,IAAI,IAAI,eAAe,CAAC,IAAI,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC;QAChG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mFAAmF,QAAQ,GAAG,CAAC,CAAC;QACjH,OAAO,CAAC,GAAG,CAAC,I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C,0CAA0C,CAAC,CAAC,CAAC;gBAC9D,OAAO;aACV;YACD,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AACD;;;GAGG;AACH,SAAgB,aAAa,CAAC,MAAiB;IAC3C,OAAO;QACH,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QACrC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC;QACzC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QACrC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QACrC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;KAChC,CAAC;AACN,CAAC;AARD,sCAQC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/server",
|
|
3
|
-
"version": "1.1.0-
|
|
3
|
+
"version": "1.1.0-RC08",
|
|
4
4
|
"description": "A js server framework for Eclipse GLSP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"watch": "tsc -w"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@eclipse-glsp/graph": "1.1.0-
|
|
63
|
-
"@eclipse-glsp/protocol": "1.1.0-
|
|
62
|
+
"@eclipse-glsp/graph": "1.1.0-RC08",
|
|
63
|
+
"@eclipse-glsp/protocol": "1.1.0-RC08",
|
|
64
64
|
"@types/uuid": "8.3.1",
|
|
65
65
|
"commander": "^8.3.0",
|
|
66
66
|
"fast-json-patch": "^3.1.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "b6e49d1b5dc77e36e5b3d7e40f6451d9695b7887"
|
|
79
79
|
}
|
|
@@ -14,42 +14,14 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { ContainerModule
|
|
18
|
-
import { InjectionContainer,
|
|
19
|
-
import { ConsoleLogger } from './console-logger';
|
|
17
|
+
import { ContainerModule } from 'inversify';
|
|
18
|
+
import { InjectionContainer, LogLevel, LoggerConfigOptions, configureConsoleLogger } from '../../common/';
|
|
20
19
|
|
|
21
|
-
export
|
|
22
|
-
consoleLog
|
|
23
|
-
logLevel?: LogLevel;
|
|
24
|
-
}
|
|
25
|
-
export function createAppModule(options: LaunchOptions = {}): ContainerModule {
|
|
26
|
-
const resolvedOptions: LaunchOptions = { consoleLog: true, logLevel: LogLevel.info, ...options };
|
|
20
|
+
export function createAppModule(options: LoggerConfigOptions = {}): ContainerModule {
|
|
21
|
+
const resolvedOptions: LoggerConfigOptions = { consoleLog: true, logLevel: LogLevel.info, ...options };
|
|
27
22
|
return new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
28
23
|
bind(InjectionContainer).toDynamicValue(dynamicContext => dynamicContext.container);
|
|
29
24
|
const context = { bind, unbind, isBound, rebind };
|
|
30
25
|
configureConsoleLogger(context, resolvedOptions);
|
|
31
26
|
});
|
|
32
27
|
}
|
|
33
|
-
|
|
34
|
-
export function configureConsoleLogger<T extends LaunchOptions>(context: ModuleContext, options: T): void {
|
|
35
|
-
if (!options.consoleLog) {
|
|
36
|
-
context.bind(Logger).to(NullLogger).inSingletonScope();
|
|
37
|
-
} else {
|
|
38
|
-
context.bind(Logger).toDynamicValue(ctx => new ConsoleLogger(options.logLevel, getRequestParentName(ctx)));
|
|
39
|
-
}
|
|
40
|
-
context.bind(LoggerFactory).toFactory(dynamicContext => (caller: string) => {
|
|
41
|
-
const logger = dynamicContext.container.get(Logger);
|
|
42
|
-
logger.caller = caller;
|
|
43
|
-
return logger;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function getRequestParentName(context: interfaces.Context): string | undefined {
|
|
48
|
-
if (context.currentRequest.parentRequest) {
|
|
49
|
-
const bindings = context.currentRequest.parentRequest.bindings;
|
|
50
|
-
if (bindings.length > 0) {
|
|
51
|
-
return bindings[0].implementationType?.name;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
package/src/browser/index.ts
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { injectable } from 'inversify';
|
|
18
18
|
import * as jsonrpc from 'vscode-jsonrpc/browser';
|
|
19
|
-
import {
|
|
19
|
+
import { MaybePromise } from '../../common/index';
|
|
20
|
+
import { JsonRpcGLSPServerLauncher, JsonRpcServerInstance } from '../../common/launch/jsonrpc-server-launcher';
|
|
20
21
|
export interface WorkerLaunchOptions {
|
|
21
22
|
context?: Worker;
|
|
22
23
|
}
|
|
@@ -24,22 +25,16 @@ export interface WorkerLaunchOptions {
|
|
|
24
25
|
export const START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed.';
|
|
25
26
|
|
|
26
27
|
@injectable()
|
|
27
|
-
export class WorkerServerLauncher extends
|
|
28
|
+
export class WorkerServerLauncher extends JsonRpcGLSPServerLauncher<WorkerLaunchOptions> {
|
|
28
29
|
protected connection?: jsonrpc.MessageConnection;
|
|
29
30
|
|
|
30
31
|
protected run(options: WorkerLaunchOptions): MaybePromise<void> {
|
|
31
32
|
if (this.connection) {
|
|
32
33
|
throw new Error('Error during launch. Server already has an active client connection');
|
|
33
34
|
}
|
|
34
|
-
const container = this.createContainer();
|
|
35
35
|
this.connection = this.createConnection(options);
|
|
36
|
-
|
|
37
|
-
glspServer.connect(this.connection);
|
|
38
|
-
this.connection.onDispose(() => this.disposeClientConnection(container, glspServer));
|
|
39
|
-
|
|
36
|
+
this.createServerInstance(this.connection);
|
|
40
37
|
this.logger.info('GLSP server worker connection established');
|
|
41
|
-
this.connection.listen();
|
|
42
|
-
this.toDispose.push(this.connection);
|
|
43
38
|
postMessage(START_UP_COMPLETE_MSG);
|
|
44
39
|
return new Promise((resolve, rejects) => {
|
|
45
40
|
this.connection?.onClose(() => resolve(undefined));
|
|
@@ -47,9 +42,8 @@ export class WorkerServerLauncher extends GLSPServerLauncher<WorkerLaunchOptions
|
|
|
47
42
|
});
|
|
48
43
|
}
|
|
49
44
|
|
|
50
|
-
protected
|
|
51
|
-
|
|
52
|
-
container.unbindAll();
|
|
45
|
+
protected override disposeServerInstance(instance: JsonRpcServerInstance): void {
|
|
46
|
+
super.disposeServerInstance(instance);
|
|
53
47
|
this.connection = undefined;
|
|
54
48
|
}
|
|
55
49
|
|
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action, ActionMessage } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { Action, ActionMessage, GLSPClientProxy } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { inject, injectable, optional } from 'inversify';
|
|
18
18
|
import { ClientActionKinds, ClientId } from '../di/service-identifiers';
|
|
19
|
-
import { GLSPClientProxy } from '../protocol/glsp-client-proxy';
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* The client action handler is responsible of handling action kinds that are intended for the
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { MaybePromise } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { inject, injectable } from 'inversify';
|
|
17
|
-
import { MaybePromise } from '..';
|
|
18
18
|
import { Logger } from '../utils/logger';
|
|
19
19
|
import { Command } from './command';
|
|
20
20
|
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { GLSPClientProxy } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { ContainerModule } from 'inversify';
|
|
17
|
-
import { GLSPClientProxy } from '../protocol/glsp-client-proxy';
|
|
18
18
|
import { ClientId } from './service-identifiers';
|
|
19
19
|
|
|
20
20
|
export function createClientSessionModule(clientId: string, glspClient: GLSPClientProxy): ContainerModule {
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { BindingContext } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { ContainerModule, injectable, interfaces } from 'inversify';
|
|
17
18
|
import { AbstractMultiBinding } from './multi-binding';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* A wrapper interface to get access to the binding related functions
|
|
21
22
|
* for a inversify container.
|
|
23
|
+
* @deprecated Use `BindingContext` from `@eclipse-glsp/protocol` instead
|
|
22
24
|
*/
|
|
23
25
|
export interface ModuleContext {
|
|
24
26
|
bind: interfaces.Bind;
|
|
@@ -34,7 +36,7 @@ export interface ModuleContext {
|
|
|
34
36
|
export abstract class GLSPModule extends ContainerModule {
|
|
35
37
|
public static CLIENT_ACTIONS = 'ClientActions';
|
|
36
38
|
|
|
37
|
-
protected context:
|
|
39
|
+
protected context: BindingContext;
|
|
38
40
|
|
|
39
41
|
constructor() {
|
|
40
42
|
super((bind, unbind, isBound, rebind) => {
|
|
@@ -13,9 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { distinctAdd, flatPush, MaybeArray, remove } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { BindingContext, distinctAdd, flatPush, MaybeArray, remove } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { applyBindingTarget, BindingTarget } from './binding-target';
|
|
18
|
-
import { ModuleContext } from './glsp-module';
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* A helper class used in `GLSPModules` to ease the configuration of multi-injected service identifiers.
|
|
@@ -29,7 +28,7 @@ export abstract class AbstractMultiBinding<T> {
|
|
|
29
28
|
|
|
30
29
|
constructor(readonly identifier: string | symbol) {}
|
|
31
30
|
|
|
32
|
-
abstract applyBindings(context:
|
|
31
|
+
abstract applyBindings(context: BindingContext): void;
|
|
33
32
|
|
|
34
33
|
add(newBinding: T): void {
|
|
35
34
|
distinctAdd(this.bindings, newBinding);
|
|
@@ -71,7 +70,7 @@ export abstract class AbstractMultiBinding<T> {
|
|
|
71
70
|
* @typeparam T the base type of {@link BindingTarget}.
|
|
72
71
|
*/
|
|
73
72
|
export class MultiBinding<T> extends AbstractMultiBinding<BindingTarget<T>> {
|
|
74
|
-
applyBindings(context:
|
|
73
|
+
applyBindings(context: BindingContext): void {
|
|
75
74
|
this.bindings.forEach(binding => applyBindingTarget(context, this.identifier, binding));
|
|
76
75
|
}
|
|
77
76
|
}
|
|
@@ -83,7 +82,7 @@ export class MultiBinding<T> extends AbstractMultiBinding<BindingTarget<T>> {
|
|
|
83
82
|
* * @typeparam T the type of the instances
|
|
84
83
|
*/
|
|
85
84
|
export class InstanceMultiBinding<T> extends AbstractMultiBinding<T> {
|
|
86
|
-
applyBindings(context:
|
|
85
|
+
applyBindings(context: BindingContext): void {
|
|
87
86
|
context.bind(this.identifier).toConstantValue(this.bindings);
|
|
88
87
|
}
|
|
89
88
|
}
|
|
@@ -13,14 +13,13 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { GLSPServer, GLSPServerListener } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { ContainerModule, interfaces } from 'inversify';
|
|
17
18
|
import { DefaultGlobalActionProvider, GlobalActionProvider } from '../actions/global-action-provider';
|
|
18
|
-
import {
|
|
19
|
-
import { DefaultGLSPServer, GLSPServer, JsonRpcGLSPServer } from '../protocol/glsp-server';
|
|
20
|
-
import { GLSPServerListener } from '../protocol/glsp-server-listener';
|
|
19
|
+
import { DefaultGLSPServer } from '../protocol/glsp-server';
|
|
21
20
|
import { ClientSessionFactory, DefaultClientSessionFactory } from '../session/client-session-factory';
|
|
22
21
|
import { ClientSessionManager, DefaultClientSessionManager } from '../session/client-session-manager';
|
|
23
|
-
import {
|
|
22
|
+
import { BindingTarget, applyBindingTarget } from './binding-target';
|
|
24
23
|
import { DiagramModule } from './diagram-module';
|
|
25
24
|
import { GLSPModule } from './glsp-module';
|
|
26
25
|
import { MultiBinding } from './multi-binding';
|
|
@@ -74,7 +73,6 @@ export class ServerModule extends GLSPModule {
|
|
|
74
73
|
applyBindingTarget(context, DiagramModules, this.bindDiagramModules());
|
|
75
74
|
|
|
76
75
|
applyBindingTarget(context, GLSPServer, this.bindGLSPServer()).inSingletonScope();
|
|
77
|
-
applyBindingTarget(context, JsonRpcGLSPServer, this.bindJsonRpcGLSPServer());
|
|
78
76
|
applyBindingTarget(context, ClientSessionFactory, this.bindClientSessionFactory()).inSingletonScope();
|
|
79
77
|
applyBindingTarget(context, ClientSessionManager, this.bindClientSessionManager()).inSingletonScope();
|
|
80
78
|
this.configureMultiBinding(new MultiBinding<GLSPServerListener>(GLSPServerListener), binding =>
|
|
@@ -83,10 +81,9 @@ export class ServerModule extends GLSPModule {
|
|
|
83
81
|
|
|
84
82
|
applyBindingTarget(context, GlobalActionProvider, this.bindGlobalActionProvider()).inSingletonScope();
|
|
85
83
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
applyBindingTarget(context, JsonRpcGLSPClientProxy, this.bindJsonRpcGLSPClientProxy());
|
|
84
|
+
if (!isBound(InjectionContainer)) {
|
|
85
|
+
applyBindingTarget(context, InjectionContainer, this.bindInjectionContainer());
|
|
86
|
+
}
|
|
90
87
|
}
|
|
91
88
|
|
|
92
89
|
protected bindDiagramModules(): BindingTarget<Map<string, ContainerModule[]>> {
|
|
@@ -97,10 +94,6 @@ export class ServerModule extends GLSPModule {
|
|
|
97
94
|
return DefaultGLSPServer;
|
|
98
95
|
}
|
|
99
96
|
|
|
100
|
-
protected bindJsonRpcGLSPServer(): BindingTarget<JsonRpcGLSPServer> {
|
|
101
|
-
return { service: GLSPServer };
|
|
102
|
-
}
|
|
103
|
-
|
|
104
97
|
protected bindClientSessionFactory(): BindingTarget<ClientSessionFactory> {
|
|
105
98
|
return DefaultClientSessionFactory;
|
|
106
99
|
}
|
|
@@ -117,14 +110,6 @@ export class ServerModule extends GLSPModule {
|
|
|
117
110
|
return { dynamicValue: context => context.container };
|
|
118
111
|
}
|
|
119
112
|
|
|
120
|
-
protected bindGLSPClientProxy(): BindingTarget<GLSPClientProxy> {
|
|
121
|
-
return DefaultGLSPClientProxy;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
protected bindJsonRpcGLSPClientProxy(): BindingTarget<JsonRpcGLSPClientProxy> {
|
|
125
|
-
return { service: GLSPClientProxy };
|
|
126
|
-
}
|
|
127
|
-
|
|
128
113
|
protected configureGLSPServerListeners(binding: MultiBinding<GLSPServerListener>): void {
|
|
129
114
|
binding.add({ service: ClientSessionManager });
|
|
130
115
|
}
|
package/src/common/index.ts
CHANGED
|
@@ -74,9 +74,7 @@ export * from './operations/create-operation-handler';
|
|
|
74
74
|
export * from './operations/operation-action-handler';
|
|
75
75
|
export * from './operations/operation-handler';
|
|
76
76
|
export * from './operations/operation-handler-registry';
|
|
77
|
-
export * from './protocol/glsp-client-proxy';
|
|
78
77
|
export * from './protocol/glsp-server';
|
|
79
|
-
export * from './protocol/glsp-server-listener';
|
|
80
78
|
export * from './session/client-session';
|
|
81
79
|
export * from './session/client-session-factory';
|
|
82
80
|
export * from './session/client-session-initializer';
|
|
@@ -84,6 +82,7 @@ export * from './session/client-session-listener';
|
|
|
84
82
|
export * from './session/client-session-manager';
|
|
85
83
|
export * from './utils/args-util';
|
|
86
84
|
export * from './utils/client-options-util';
|
|
85
|
+
export * from './utils/console-logger';
|
|
87
86
|
export * from './utils/glsp-server-error';
|
|
88
87
|
export * from './utils/layout-util';
|
|
89
88
|
export * from './utils/logger';
|
|
@@ -33,9 +33,9 @@ export abstract class GLSPServerLauncher<T> implements Disposable {
|
|
|
33
33
|
this._modules.push(serverModule, ...additionalModules);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
createContainer(): Container {
|
|
36
|
+
createContainer(...additionalModules: ContainerModule[]): Container {
|
|
37
37
|
const container = this.parentContainer ? this.parentContainer.createChild() : new Container();
|
|
38
|
-
container.load(...this._modules);
|
|
38
|
+
container.load(...this._modules, ...additionalModules);
|
|
39
39
|
return container;
|
|
40
40
|
}
|
|
41
41
|
|