From e55b1212d1c9db51aec49eb102c39b4955f5ee0c Mon Sep 17 00:00:00 2001 From: Tobias Ortmayr Date: Wed, 29 Nov 2023 18:01:37 +0100 Subject: [PATCH] GLSP-1181: Fix support for simultaneously open diagrams Fixes https://github.com/eclipse-glsp/glsp/issues/1181 Also: Update changelog to reflect latest changes --- CHANGELOG.md | 10 +++++++--- .../jsonrpc/base-jsonrpc-glsp-client.ts | 11 ++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ebc9420..dd89b7f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,16 @@ # Eclipse GLSP Client Changelog -## v2.10.0 - active +## v2.1.0 - active ### Changes +- [diagram] Fix a bug that prevented correct rendering of projection bars when using `GLSPProjectionView` [#298](https://github.com/eclipse-glsp/glsp-client/pull/298) +- [a11y] Improved responsibility and feedback when resizing or moving diagram elements with keyboard-only commands [#295](https://github.com/eclipse-glsp/glsp-client/pull/295) +- [diagram] Extends `configureDiagramOptions` function to also allow partial configuration of `ViewerOptions` [#296](https://github.com/eclipse-glsp/glsp-client/pull/296) - [diagram] Remove unused handleSetContextActions from ToolPalette [#301](https://github.com/eclipse-glsp/glsp-client/pull/301) - -### Breaking Changes +- [diagram] Deprecate `ISModelRootListener` API in favor of `IGModelRootListener` [#303](https://github.com/eclipse-glsp/glsp-client/pull/303) +- [diagram] Ensure that the suggestion container position of the `AutoCompleteWidget` is rendered correctly [#304](https://github.com/eclipse-glsp/glsp-client/pull/304) +- [feature] Extend `ToolPalette`/`CreateOperation` API to support rendering of preview/ghost elements when creating new nodes [#301](https://github.com/eclipse-glsp/glsp-client/pull/301) ## [v2.0.0 - 14/10/2023](https://github.com/eclipse-glsp/glsp-client/releases/tag/v2.0.0) diff --git a/packages/protocol/src/client-server-protocol/jsonrpc/base-jsonrpc-glsp-client.ts b/packages/protocol/src/client-server-protocol/jsonrpc/base-jsonrpc-glsp-client.ts index 47e9dd71..cc17491a 100644 --- a/packages/protocol/src/client-server-protocol/jsonrpc/base-jsonrpc-glsp-client.ts +++ b/packages/protocol/src/client-server-protocol/jsonrpc/base-jsonrpc-glsp-client.ts @@ -36,6 +36,11 @@ export class BaseJsonrpcGLSPClient implements GLSPClient { return this.onServerInitializedEmitter.event; } + protected onActionMessageNotificationEmitter = new Emitter(); + protected get onActionMessageNotification(): Event { + return this.onActionMessageNotificationEmitter.event; + } + constructor(options: JsonrpcGLSPClient.Options) { Object.assign(this, options); this.state = ClientState.Initial; @@ -66,7 +71,7 @@ export class BaseJsonrpcGLSPClient implements GLSPClient { } onActionMessage(handler: ActionMessageHandler, clientId?: string): Disposable { - return this.checkedConnection.onNotification(JsonrpcGLSPClient.ActionMessageNotification, msg => { + return this.onActionMessageNotification(msg => { if (!clientId || msg.clientId === clientId) { handler(msg); } @@ -91,6 +96,9 @@ export class BaseJsonrpcGLSPClient implements GLSPClient { try { this.state = ClientState.Starting; const connection = await this.resolveConnection(); + connection.onNotification(JsonrpcGLSPClient.ActionMessageNotification, msg => + this.onActionMessageNotificationEmitter.fire(msg) + ); connection.listen(); this.resolvedConnection = connection; this.state = ClientState.Running; @@ -113,6 +121,7 @@ export class BaseJsonrpcGLSPClient implements GLSPClient { connection.dispose(); this.state = ClientState.Stopped; this.onStop = undefined; + this.onActionMessageNotificationEmitter.dispose(); this.connectionPromise = undefined; this.resolvedConnection = undefined; }));