@eclipse-glsp/server 1.1.0-next.44aae0c.44 → 1.1.0-next.452eba9.51

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.
Files changed (149) hide show
  1. package/lib/browser/di/app-module.d.ts +2 -7
  2. package/lib/browser/di/app-module.d.ts.map +1 -1
  3. package/lib/browser/di/app-module.js +5 -30
  4. package/lib/browser/di/app-module.js.map +1 -1
  5. package/lib/browser/index.d.ts +0 -1
  6. package/lib/browser/index.d.ts.map +1 -1
  7. package/lib/browser/index.js +0 -1
  8. package/lib/browser/index.js.map +1 -1
  9. package/lib/browser/launch/worker-server-launcher.d.ts +11 -8
  10. package/lib/browser/launch/worker-server-launcher.d.ts.map +1 -1
  11. package/lib/browser/launch/worker-server-launcher.js +13 -21
  12. package/lib/browser/launch/worker-server-launcher.js.map +1 -1
  13. package/lib/common/actions/client-action-handler.d.ts +1 -2
  14. package/lib/common/actions/client-action-handler.d.ts.map +1 -1
  15. package/lib/common/actions/client-action-handler.js +17 -2
  16. package/lib/common/actions/client-action-handler.js.map +1 -1
  17. package/lib/common/command/command-stack.d.ts +16 -1
  18. package/lib/common/command/command-stack.d.ts.map +1 -1
  19. package/lib/common/command/command-stack.js +0 -15
  20. package/lib/common/command/command-stack.js.map +1 -1
  21. package/lib/common/command/recording-command.d.ts +7 -7
  22. package/lib/common/command/recording-command.d.ts.map +1 -1
  23. package/lib/common/command/recording-command.js +6 -6
  24. package/lib/common/command/recording-command.js.map +1 -1
  25. package/lib/common/di/client-session-module.d.ts +1 -1
  26. package/lib/common/di/client-session-module.d.ts.map +1 -1
  27. package/lib/common/di/client-session-module.js +2 -2
  28. package/lib/common/di/client-session-module.js.map +1 -1
  29. package/lib/common/di/glsp-module.d.ts +3 -1
  30. package/lib/common/di/glsp-module.d.ts.map +1 -1
  31. package/lib/common/di/glsp-module.js +0 -15
  32. package/lib/common/di/glsp-module.js.map +1 -1
  33. package/lib/common/di/multi-binding.d.ts +19 -4
  34. package/lib/common/di/multi-binding.d.ts.map +1 -1
  35. package/lib/common/di/multi-binding.js.map +1 -1
  36. package/lib/common/di/server-module.d.ts +1 -6
  37. package/lib/common/di/server-module.d.ts.map +1 -1
  38. package/lib/common/di/server-module.js +21 -17
  39. package/lib/common/di/server-module.js.map +1 -1
  40. package/lib/common/features/layout/computed-bounds-action-handler.js +1 -1
  41. package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
  42. package/lib/common/index.d.ts +4 -3
  43. package/lib/common/index.d.ts.map +1 -1
  44. package/lib/common/index.js +4 -3
  45. package/lib/common/index.js.map +1 -1
  46. package/lib/common/launch/glsp-server-launcher.d.ts +8 -7
  47. package/lib/common/launch/glsp-server-launcher.d.ts.map +1 -1
  48. package/lib/common/launch/glsp-server-launcher.js +27 -4
  49. package/lib/common/launch/glsp-server-launcher.js.map +1 -1
  50. package/lib/common/launch/jsonrpc-server-launcher.d.ts +38 -0
  51. package/lib/common/launch/jsonrpc-server-launcher.d.ts.map +1 -0
  52. package/lib/common/launch/jsonrpc-server-launcher.js +84 -0
  53. package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -0
  54. package/lib/common/protocol/glsp-server.d.ts +4 -104
  55. package/lib/common/protocol/glsp-server.d.ts.map +1 -1
  56. package/lib/common/protocol/glsp-server.js +13 -20
  57. package/lib/common/protocol/glsp-server.js.map +1 -1
  58. package/lib/common/protocol/glsp-server.spec.js +18 -5
  59. package/lib/common/protocol/glsp-server.spec.js.map +1 -1
  60. package/lib/common/session/client-session-factory.d.ts +1 -2
  61. package/lib/common/session/client-session-factory.d.ts.map +1 -1
  62. package/lib/common/session/client-session-factory.js +17 -2
  63. package/lib/common/session/client-session-factory.js.map +1 -1
  64. package/lib/common/session/client-session-factory.spec.js +2 -2
  65. package/lib/common/session/client-session-factory.spec.js.map +1 -1
  66. package/lib/common/session/client-session-manager.d.ts +1 -3
  67. package/lib/common/session/client-session-manager.d.ts.map +1 -1
  68. package/lib/common/session/client-session-manager.js.map +1 -1
  69. package/lib/common/test/mock-util.d.ts +3 -6
  70. package/lib/common/test/mock-util.d.ts.map +1 -1
  71. package/lib/common/test/mock-util.js.map +1 -1
  72. package/lib/{browser/di → common/utils}/console-logger.d.ts +7 -1
  73. package/lib/common/utils/console-logger.d.ts.map +1 -0
  74. package/lib/{browser/di → common/utils}/console-logger.js +26 -8
  75. package/lib/common/utils/console-logger.js.map +1 -0
  76. package/lib/common/utils/layout-util.d.ts +1 -1
  77. package/lib/common/utils/layout-util.d.ts.map +1 -1
  78. package/lib/common/utils/layout-util.js +3 -3
  79. package/lib/common/utils/layout-util.js.map +1 -1
  80. package/lib/common/utils/logger.d.ts +21 -0
  81. package/lib/common/utils/logger.d.ts.map +1 -1
  82. package/lib/common/utils/logger.js +12 -1
  83. package/lib/common/utils/logger.js.map +1 -1
  84. package/lib/node/di/app-module.d.ts +2 -2
  85. package/lib/node/di/app-module.d.ts.map +1 -1
  86. package/lib/node/di/app-module.js +10 -35
  87. package/lib/node/di/app-module.js.map +1 -1
  88. package/lib/node/index.d.ts +1 -0
  89. package/lib/node/index.d.ts.map +1 -1
  90. package/lib/node/index.js +1 -0
  91. package/lib/node/index.js.map +1 -1
  92. package/lib/node/launch/cli-parser.d.ts +2 -3
  93. package/lib/node/launch/cli-parser.d.ts.map +1 -1
  94. package/lib/node/launch/cli-parser.js.map +1 -1
  95. package/lib/node/launch/socket-cli-parser.js +1 -1
  96. package/lib/node/launch/socket-cli-parser.js.map +1 -1
  97. package/lib/node/launch/socket-server-launcher.d.ts +4 -24
  98. package/lib/node/launch/socket-server-launcher.d.ts.map +1 -1
  99. package/lib/node/launch/socket-server-launcher.js +15 -34
  100. package/lib/node/launch/socket-server-launcher.js.map +1 -1
  101. package/lib/node/launch/socket-server-launcher.spec.js +5 -0
  102. package/lib/node/launch/socket-server-launcher.spec.js.map +1 -1
  103. package/lib/node/launch/websocket-server-launcher.d.ts +53 -0
  104. package/lib/node/launch/websocket-server-launcher.d.ts.map +1 -0
  105. package/lib/node/launch/websocket-server-launcher.js +121 -0
  106. package/lib/node/launch/websocket-server-launcher.js.map +1 -0
  107. package/package.json +7 -5
  108. package/src/browser/di/app-module.ts +4 -32
  109. package/src/browser/index.ts +0 -1
  110. package/src/browser/launch/worker-server-launcher.ts +20 -22
  111. package/src/common/actions/client-action-handler.ts +1 -2
  112. package/src/common/command/command-stack.ts +1 -1
  113. package/src/common/command/recording-command.ts +11 -11
  114. package/src/common/di/client-session-module.ts +1 -1
  115. package/src/common/di/glsp-module.ts +3 -1
  116. package/src/common/di/multi-binding.ts +4 -5
  117. package/src/common/di/server-module.ts +6 -21
  118. package/src/common/features/layout/computed-bounds-action-handler.ts +2 -2
  119. package/src/common/index.ts +4 -3
  120. package/src/common/launch/glsp-server-launcher.ts +15 -9
  121. package/src/common/launch/jsonrpc-server-launcher.ts +95 -0
  122. package/src/common/protocol/glsp-server.spec.ts +7 -4
  123. package/src/common/protocol/glsp-server.ts +17 -132
  124. package/src/common/session/client-session-factory.spec.ts +1 -1
  125. package/src/common/session/client-session-factory.ts +1 -2
  126. package/src/common/session/client-session-manager.ts +1 -3
  127. package/src/common/test/mock-util.ts +5 -5
  128. package/src/{browser/di → common/utils}/console-logger.ts +19 -1
  129. package/src/common/utils/layout-util.ts +1 -1
  130. package/src/common/utils/logger.ts +16 -1
  131. package/src/node/di/app-module.ts +4 -13
  132. package/src/node/index.ts +1 -0
  133. package/src/node/launch/cli-parser.ts +2 -3
  134. package/src/node/launch/socket-cli-parser.ts +1 -1
  135. package/src/node/launch/socket-server-launcher.spec.ts +6 -0
  136. package/src/node/launch/socket-server-launcher.ts +19 -35
  137. package/src/node/launch/websocket-server-launcher.ts +138 -0
  138. package/lib/browser/di/console-logger.d.ts.map +0 -1
  139. package/lib/browser/di/console-logger.js.map +0 -1
  140. package/lib/common/protocol/glsp-client-proxy.d.ts +0 -45
  141. package/lib/common/protocol/glsp-client-proxy.d.ts.map +0 -1
  142. package/lib/common/protocol/glsp-client-proxy.js +0 -53
  143. package/lib/common/protocol/glsp-client-proxy.js.map +0 -1
  144. package/lib/common/protocol/glsp-server-listener.d.ts +0 -37
  145. package/lib/common/protocol/glsp-server-listener.d.ts.map +0 -1
  146. package/lib/common/protocol/glsp-server-listener.js +0 -5
  147. package/lib/common/protocol/glsp-server-listener.js.map +0 -1
  148. package/src/common/protocol/glsp-client-proxy.ts +0 -65
  149. package/src/common/protocol/glsp-server-listener.ts +0 -39
@@ -13,24 +13,35 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { Container, inject, injectable } from 'inversify';
16
+ import { Disposable } from '@eclipse-glsp/protocol';
17
+ import { inject, injectable } from 'inversify';
17
18
  import * as net from 'net';
18
19
  import * as jsonrpc from 'vscode-jsonrpc/node';
19
- import { GLSPServerLauncher } from '../../common/launch/glsp-server-launcher';
20
- import { GLSPServer, JsonRpcGLSPServer } from '../../common/protocol/glsp-server';
20
+ import { JsonRpcGLSPServerLauncher } from '../../common/launch/jsonrpc-server-launcher';
21
21
  import { Logger } from '../../common/utils/logger';
22
22
 
23
- const START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed. Accepting requests on port:';
23
+ export const START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed. Accepting requests on port:';
24
+
24
25
  @injectable()
25
- export class SocketServerLauncher extends GLSPServerLauncher<net.TcpSocketConnectOpts> {
26
+ export class SocketServerLauncher extends JsonRpcGLSPServerLauncher<net.TcpSocketConnectOpts> {
26
27
  @inject(Logger) protected override logger: Logger;
27
28
 
28
- protected currentConnections: jsonrpc.MessageConnection[] = [];
29
- protected startupCompleteMessage = START_UP_COMPLETE_MSG;
30
29
  protected netServer: net.Server;
31
30
 
31
+ constructor() {
32
+ super();
33
+ this.toDispose.push(
34
+ Disposable.create(() => {
35
+ this.netServer.close();
36
+ })
37
+ );
38
+ }
39
+
32
40
  protected run(opts: net.TcpSocketConnectOpts): Promise<void> {
33
- this.netServer = net.createServer(socket => this.createClientConnection(socket));
41
+ this.netServer = net.createServer(socket => {
42
+ const connection = this.createConnection(socket);
43
+ this.createServerInstance(connection);
44
+ });
34
45
 
35
46
  this.netServer.listen(opts.port, opts.host);
36
47
  this.netServer.on('listening', () => {
@@ -57,34 +68,7 @@ export class SocketServerLauncher extends GLSPServerLauncher<net.TcpSocketConnec
57
68
  });
58
69
  }
59
70
 
60
- protected async createClientConnection(socket: net.Socket): Promise<void> {
61
- const container = this.createContainer();
62
- const connection = this.createConnection(socket);
63
- this.currentConnections.push(connection);
64
- const glspServer = container.get<JsonRpcGLSPServer>(JsonRpcGLSPServer);
65
- glspServer.connect(connection);
66
- this.logger.info(`Starting GLSP server connection for client: '${socket.localAddress}'`);
67
- connection.listen();
68
- connection.onDispose(() => this.disposeClientConnection(container, glspServer));
69
- socket.on('close', () => this.disposeClientConnection(container, glspServer));
70
- return new Promise((resolve, rejects) => {
71
- connection.onClose(() => resolve(undefined));
72
- connection.onError(error => rejects(error));
73
- });
74
- }
75
-
76
- protected disposeClientConnection(container: Container, glspServer: GLSPServer): void {
77
- glspServer.shutdown();
78
- container.unbindAll();
79
- }
80
-
81
71
  protected createConnection(socket: net.Socket): jsonrpc.MessageConnection {
82
72
  return jsonrpc.createMessageConnection(new jsonrpc.SocketMessageReader(socket), new jsonrpc.SocketMessageWriter(socket), console);
83
73
  }
84
-
85
- protected stop(): void {
86
- this.logger.info('Shutdown SocketServerLauncher');
87
- this.currentConnections.forEach(connection => connection.dispose());
88
- this.netServer.close();
89
- }
90
74
  }
@@ -0,0 +1,138 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { createWebSocketConnection, Disposable, MaybePromise, WebSocketWrapper } from '@eclipse-glsp/protocol';
18
+ import * as http from 'http';
19
+ import { inject, injectable } from 'inversify';
20
+ import * as net from 'net';
21
+ import * as jsonrpc from 'vscode-jsonrpc';
22
+ import { Server, WebSocket } from 'ws';
23
+ import { JsonRpcGLSPServerLauncher } from '../../common/launch/jsonrpc-server-launcher';
24
+ import { Logger } from '../../common/utils/logger';
25
+
26
+ export interface WebSocketServerOptions {
27
+ host?: string;
28
+ port?: number;
29
+ path: string;
30
+ }
31
+
32
+ export interface ResolvedWebSocketServerOptions {
33
+ host?: string;
34
+ port: number;
35
+ path: string;
36
+ server: http.Server;
37
+ }
38
+
39
+ export interface WebsocketConnectionData {
40
+ socket: WebSocket;
41
+ connection: jsonrpc.MessageConnection;
42
+ }
43
+
44
+ const STATUS_UPGRADE_REQUIRED = 426;
45
+
46
+ @injectable()
47
+ export class WebSocketServerLauncher extends JsonRpcGLSPServerLauncher<WebSocketServerOptions> {
48
+ @inject(Logger)
49
+ protected override logger: Logger;
50
+
51
+ protected server: Server;
52
+
53
+ constructor() {
54
+ super();
55
+ this.toDispose.push(
56
+ Disposable.create(() => {
57
+ this.server.close();
58
+ })
59
+ );
60
+ }
61
+
62
+ protected async run(options: WebSocketServerOptions): Promise<void> {
63
+ const resolvedOptions = await this.resolveOptions(options);
64
+ this.server = new Server({ server: resolvedOptions.server, path: resolvedOptions.path });
65
+ const endpoint = `ws://${resolvedOptions.host}:${resolvedOptions.port}:${resolvedOptions.path}`;
66
+ this.logger.info(`The GLSP Websocket launcher is ready to accept new client requests on endpoint '${endpoint}'`);
67
+ console.log(this.startupCompleteMessage.concat(resolvedOptions.port.toString()));
68
+
69
+ this.server.on('connection', (ws, req) => {
70
+ const connection = this.createConnection(ws);
71
+ this.createServerInstance(connection);
72
+ });
73
+
74
+ return new Promise((resolve, reject) => {
75
+ this.server.on('close', () => resolve(undefined));
76
+ this.server.on('error', error => reject(error));
77
+ });
78
+ }
79
+
80
+ protected createConnection(socket: WebSocket): jsonrpc.MessageConnection {
81
+ return createWebSocketConnection(wrapWebSocket(socket));
82
+ }
83
+
84
+ protected async resolveOptions(options: WebSocketServerOptions): Promise<ResolvedWebSocketServerOptions> {
85
+ const port = !options.port || options.port === 0 ? await getFreePort() : options.port;
86
+ const path = options.path.startsWith('/') ? options.path : `/${options.path}`;
87
+ const server = this.createHttpServer(port, options.host);
88
+
89
+ return { ...options, port, path, server };
90
+ }
91
+
92
+ protected createHttpServer(port: number, host?: string): http.Server {
93
+ const server = http.createServer((req, res) => {
94
+ const body = http.STATUS_CODES[STATUS_UPGRADE_REQUIRED];
95
+
96
+ res.writeHead(426, {
97
+ 'Content-Length': body?.length,
98
+ 'Content-Type': 'text/plain'
99
+ });
100
+ res.end(body);
101
+ });
102
+ server.listen(port, host);
103
+ // Set server timeout to infinite
104
+ server.setTimeout(0);
105
+ return server;
106
+ }
107
+
108
+ override start(options: WebSocketServerOptions): MaybePromise<void> {
109
+ super.start(options);
110
+ }
111
+ }
112
+
113
+ async function getFreePort(): Promise<number> {
114
+ return new Promise((resolve, reject) => {
115
+ const srv = net.createServer();
116
+ srv.listen(0, () => {
117
+ const address = srv.address();
118
+ if (!address || typeof address === 'string') {
119
+ reject(new Error('Could not address to compute a free port'));
120
+ return;
121
+ }
122
+ srv.close(() => resolve(address.port));
123
+ });
124
+ });
125
+ }
126
+ /**
127
+ * Creates a {@link WebSocketWrapper} for the given plain WebSocket
128
+ * @param socket The socket to wrap
129
+ */
130
+ export function wrapWebSocket(socket: WebSocket): WebSocketWrapper {
131
+ return {
132
+ send: content => socket.send(content),
133
+ onMessage: cb => socket.on('message', cb),
134
+ onClose: cb => socket.on('close', cb),
135
+ onError: cb => socket.on('error', cb),
136
+ dispose: () => socket.close()
137
+ };
138
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"console-logger.d.ts","sourceRoot":"","sources":["../../../src/browser/di/console-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBACa,aAAc,SAAQ,MAAM;IAClB,QAAQ,EAAE,QAAQ;IAAyB,MAAM,CAAC;gBAAlD,QAAQ,GAAE,QAAwB,EAAS,MAAM,CAAC,oBAAQ;IAI7E,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;IAM7C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;IAM7C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;IAM9C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;IAM9C,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM;IAOrD,cAAc,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM;IAOxC,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAOpC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"console-logger.js","sourceRoot":"","sources":["../../../src/browser/di/console-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,yCAAuC;AACvC,8CAAsD;AAG/C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,cAAM;IACrC,YAAmB,WAAqB,gBAAQ,CAAC,IAAI,EAAS,MAAe;QACzE,KAAK,EAAE,CAAC;QADO,aAAQ,GAAR,QAAQ,CAA0B;QAAS,WAAM,GAAN,MAAM,CAAS;IAE7E,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAG,MAAa;QAClC,IAAI,gBAAQ,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;YAChC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;SAClD;IACL,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAG,MAAa;QAClC,IAAI,gBAAQ,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;YAChC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;SAClD;IACL,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,MAAa;QACnC,IAAI,gBAAQ,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;SACnD;IACL,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,MAAa;QACnC,IAAI,gBAAQ,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;SACnD;IACL,CAAC;IAED,UAAU,CAAC,OAAe,EAAE,GAAG,MAAa;QACxC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC,CAAC;QAClD,OAAO,GAAG,SAAS,IAAI,IAAI,CAAC,QAAQ,MAAM,MAAM,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;IAChF,CAAC;IAED,cAAc,CAAC,GAAG,MAAa;QAC3B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,OAAO,EAAE,CAAC;SACb;QACD,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClE,CAAC;IAED,SAAS,CAAC,KAAc;QACpB,IAAI,KAAK,YAAY,KAAK,EAAE;YACxB,OAAO,GAAG,KAAK,CAAC,OAAO;cACrB,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;SACzB;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAA;AAlDY,aAAa;IADzB,IAAA,sBAAU,GAAE;;GACA,aAAa,CAkDzB;AAlDY,sCAAa"}
@@ -1,45 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2022-2023 STMicroelectronics and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- import { ActionMessage } from '@eclipse-glsp/protocol';
17
- import * as jsonrpc from 'vscode-jsonrpc';
18
- export declare const GLSPClientProxyFactory: unique symbol;
19
- export type GLSPClientProxyFactory = (connection: jsonrpc.MessageConnection) => GLSPClientProxy;
20
- export declare const GLSPClientProxy: unique symbol;
21
- /**
22
- * Json-rpc client proxy interface to hide the underlying json-rpc logic.
23
- */
24
- export interface GLSPClientProxy {
25
- /**
26
- * A `process` notification is sent from the server to server to the client when the client should handle i.e.
27
- * process a specific {@link ActionMessage}. Any communication that is performed between initialization and shutdown
28
- * is handled by sending action messages, either from the client to the server or from the server to the client. This
29
- * is the core part of the Graphical Language Server Protocol.
30
- *
31
- * @param message The {@link ActionMessage} that should be processed.
32
- */
33
- process(message: ActionMessage): void;
34
- }
35
- export declare const JsonRpcGLSPClientProxy: unique symbol;
36
- export interface JsonRpcGLSPClientProxy extends GLSPClientProxy {
37
- connect(connection: jsonrpc.MessageConnection): void;
38
- }
39
- export declare class DefaultGLSPClientProxy implements JsonRpcGLSPClientProxy {
40
- private logger;
41
- protected connection: jsonrpc.MessageConnection;
42
- connect(connection: jsonrpc.MessageConnection): void;
43
- process(message: ActionMessage): void;
44
- }
45
- //# sourceMappingURL=glsp-client-proxy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"glsp-client-proxy.d.ts","sourceRoot":"","sources":["../../../src/common/protocol/glsp-client-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,aAAa,EAAqB,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAG1C,eAAO,MAAM,sBAAsB,eAAmC,CAAC;AAEvE,MAAM,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,KAAK,eAAe,CAAC;AAEhG,eAAO,MAAM,eAAe,eAA4B,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,sBAAsB,eAAmC,CAAC;AAEvE,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC3D,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;CACxD;AAED,qBACa,sBAAuB,YAAW,sBAAsB;IAEjE,OAAO,CAAC,MAAM,CAAS;IAEvB,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC;IAEhD,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI;IAMpD,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;CAIxC"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DefaultGLSPClientProxy = exports.JsonRpcGLSPClientProxy = exports.GLSPClientProxy = exports.GLSPClientProxyFactory = void 0;
13
- /********************************************************************************
14
- * Copyright (c) 2022-2023 STMicroelectronics and others.
15
- *
16
- * This program and the accompanying materials are made available under the
17
- * terms of the Eclipse Public License v. 2.0 which is available at
18
- * http://www.eclipse.org/legal/epl-2.0.
19
- *
20
- * This Source Code may also be made available under the following Secondary
21
- * Licenses when the conditions for such availability set forth in the Eclipse
22
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
23
- * with the GNU Classpath Exception which is available at
24
- * https://www.gnu.org/software/classpath/license.html.
25
- *
26
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
27
- ********************************************************************************/
28
- const protocol_1 = require("@eclipse-glsp/protocol");
29
- const inversify_1 = require("inversify");
30
- const logger_1 = require("../utils/logger");
31
- exports.GLSPClientProxyFactory = Symbol('GLSPClientProxyFactory');
32
- exports.GLSPClientProxy = Symbol('GLSPClientProxy');
33
- exports.JsonRpcGLSPClientProxy = Symbol('JsonRpcGLSPClientProxy');
34
- let DefaultGLSPClientProxy = class DefaultGLSPClientProxy {
35
- connect(connection) {
36
- if (!this.connection) {
37
- this.connection = connection;
38
- }
39
- }
40
- process(message) {
41
- this.logger.debug(`Send action '${message.action.kind}' to client '${message.clientId}'`);
42
- this.connection.sendNotification(protocol_1.JsonrpcGLSPClient.ActionMessageNotification, message);
43
- }
44
- };
45
- __decorate([
46
- (0, inversify_1.inject)(logger_1.Logger),
47
- __metadata("design:type", logger_1.Logger)
48
- ], DefaultGLSPClientProxy.prototype, "logger", void 0);
49
- DefaultGLSPClientProxy = __decorate([
50
- (0, inversify_1.injectable)()
51
- ], DefaultGLSPClientProxy);
52
- exports.DefaultGLSPClientProxy = DefaultGLSPClientProxy;
53
- //# sourceMappingURL=glsp-client-proxy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"glsp-client-proxy.js","sourceRoot":"","sources":["../../../src/common/protocol/glsp-client-proxy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAA0E;AAC1E,yCAA+C;AAE/C,4CAAyC;AAE5B,QAAA,sBAAsB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAI1D,QAAA,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAiB5C,QAAA,sBAAsB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAOhE,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAM/B,OAAO,CAAC,UAAqC;QACzC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;SAChC;IACL,CAAC;IAED,OAAO,CAAC,OAAsB;QAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,OAAO,CAAC,MAAM,CAAC,IAAI,gBAAgB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QAC1F,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,4BAAiB,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;IAC3F,CAAC;CACJ,CAAA;AAfG;IAAC,IAAA,kBAAM,EAAC,eAAM,CAAC;8BACC,eAAM;sDAAC;AAFd,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CAgBlC;AAhBY,wDAAsB"}
@@ -1,37 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2022-2023 STMicroelectronics and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- import { GLSPServer } from './glsp-server';
17
- export declare const GLSPServerListener: unique symbol;
18
- /**
19
- * A listener to track the connection status of {@link GLSPClient}s (i.e. client applications).
20
- * Gets notified when a new GLSP client connects or disconnects.
21
- */
22
- export interface GLSPServerListener {
23
- /**
24
- * Triggered after a GLSPServer has been initialized via the {@link GLSPServer.initialize()}
25
- * method.
26
- *
27
- * @param server The GLSPServer which has been initialized.
28
- */
29
- serverInitialized?(server: GLSPServer): void;
30
- /**
31
- * Triggered after the {@link GLSPServer.shutdown()} method has been invoked.
32
- *
33
- * @param glspServer The glspServer which has been shut down.
34
- */
35
- serverShutDown?(server: GLSPServer): void;
36
- }
37
- //# sourceMappingURL=glsp-server-listener.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"glsp-server-listener.d.ts","sourceRoot":"","sources":["../../../src/common/protocol/glsp-server-listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;;OAKG;IACH,iBAAiB,CAAC,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAE7C;;;;OAIG;IACH,cAAc,CAAC,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;CAC7C"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GLSPServerListener = void 0;
4
- exports.GLSPServerListener = Symbol('GLSPServerListener');
5
- //# sourceMappingURL=glsp-server-listener.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"glsp-server-listener.js","sourceRoot":"","sources":["../../../src/common/protocol/glsp-server-listener.ts"],"names":[],"mappings":";;;AAiBa,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
@@ -1,65 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2022-2023 STMicroelectronics and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- import { ActionMessage, JsonrpcGLSPClient } from '@eclipse-glsp/protocol';
17
- import { inject, injectable } from 'inversify';
18
- import * as jsonrpc from 'vscode-jsonrpc';
19
- import { Logger } from '../utils/logger';
20
-
21
- export const GLSPClientProxyFactory = Symbol('GLSPClientProxyFactory');
22
-
23
- export type GLSPClientProxyFactory = (connection: jsonrpc.MessageConnection) => GLSPClientProxy;
24
-
25
- export const GLSPClientProxy = Symbol('GLSPClientProxy');
26
-
27
- /**
28
- * Json-rpc client proxy interface to hide the underlying json-rpc logic.
29
- */
30
- export interface GLSPClientProxy {
31
- /**
32
- * A `process` notification is sent from the server to server to the client when the client should handle i.e.
33
- * process a specific {@link ActionMessage}. Any communication that is performed between initialization and shutdown
34
- * is handled by sending action messages, either from the client to the server or from the server to the client. This
35
- * is the core part of the Graphical Language Server Protocol.
36
- *
37
- * @param message The {@link ActionMessage} that should be processed.
38
- */
39
- process(message: ActionMessage): void;
40
- }
41
-
42
- export const JsonRpcGLSPClientProxy = Symbol('JsonRpcGLSPClientProxy');
43
-
44
- export interface JsonRpcGLSPClientProxy extends GLSPClientProxy {
45
- connect(connection: jsonrpc.MessageConnection): void;
46
- }
47
-
48
- @injectable()
49
- export class DefaultGLSPClientProxy implements JsonRpcGLSPClientProxy {
50
- @inject(Logger)
51
- private logger: Logger;
52
-
53
- protected connection: jsonrpc.MessageConnection;
54
-
55
- connect(connection: jsonrpc.MessageConnection): void {
56
- if (!this.connection) {
57
- this.connection = connection;
58
- }
59
- }
60
-
61
- process(message: ActionMessage): void {
62
- this.logger.debug(`Send action '${message.action.kind}' to client '${message.clientId}'`);
63
- this.connection.sendNotification(JsonrpcGLSPClient.ActionMessageNotification, message);
64
- }
65
- }
@@ -1,39 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2022-2023 STMicroelectronics and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- import { GLSPServer } from './glsp-server';
17
-
18
- export const GLSPServerListener = Symbol('GLSPServerListener');
19
-
20
- /**
21
- * A listener to track the connection status of {@link GLSPClient}s (i.e. client applications).
22
- * Gets notified when a new GLSP client connects or disconnects.
23
- */
24
- export interface GLSPServerListener {
25
- /**
26
- * Triggered after a GLSPServer has been initialized via the {@link GLSPServer.initialize()}
27
- * method.
28
- *
29
- * @param server The GLSPServer which has been initialized.
30
- */
31
- serverInitialized?(server: GLSPServer): void;
32
-
33
- /**
34
- * Triggered after the {@link GLSPServer.shutdown()} method has been invoked.
35
- *
36
- * @param glspServer The glspServer which has been shut down.
37
- */
38
- serverShutDown?(server: GLSPServer): void;
39
- }