Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLSP-1449: Update inversify & drop node 16 #69

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Eclipse GLSP VSCode Integration Changelog

## 2.3.0 - active
## [2.3.0 - 19/12/2024](https://github.com/eclipse-glsp/glsp-vscode-integration/releases/tag/v2.3.0)

### Changes
- [diagram] Update default styling to consistently use vscode theme variables [#68](https://github.com/eclipse-glsp/glsp-vscode-integration/pull/68)
- [deps] Drop support for node `16`. New minimum version is `18.x` [#69](https://github.com/eclipse-glsp/glsp-vscode-integration/pull/69)

### Potentially Breaking Changes
### Changes

## [2.2.1 - 22/07/2024](https://github.com/eclipse-glsp/glsp-vscode-integration/releases/tag/v2.2.1)

Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Pod
spec:
containers:
- name: node
image: node:16
image: node:18
tty: true
resources:
limits:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
},
"devDependencies": {
"@eclipse-glsp/dev": "next",
"@types/node": "16",
"@types/node": "18.x",
"@types/vscode": "^1.54.0",
"concurrently": "^8.2.2",
"lerna": "^7.0.0",
"typescript": "^5.0.4"
},
"engines": {
"node": ">=16.11.0",
"yarn": ">=1.7.0 <2.x.x"
"node": ">=18",
"yarn": ">=1.7.0 <2"
}
}
29 changes: 20 additions & 9 deletions packages/vscode-integration-webview/src/webview-glsp-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface WebviewGlspClientOptions extends GLSPClient.Options {
}

export const ActionMessageNotification: NotificationType<ActionMessage> = { method: 'actionMessage' };
export const ClientStateChangeNotification: NotificationType<ClientState> = { method: 'notifyClientStateChange' };
export const StartRequest: RequestType<undefined, void> = { method: 'start' };
export const InitializeServerRequest: RequestType<InitializeParameters, InitializeResult> = { method: 'initializeServer' };
export const InitializeClientSessionRequest: RequestType<InitializeClientSessionParameters, void> = { method: 'initializeClientSession' };
Expand All @@ -54,7 +55,13 @@ export class WebviewGlspClient implements GLSPClient, Disposable {
protected toDispose = new DisposableCollection();
protected onActionMessageEmitter = new Emitter<ActionMessage>();

protected _currentState: ClientState = ClientState.Starting;
protected onCurrentStateChangedEmitter = new Emitter<ClientState>();
get onCurrentStateChanged(): Event<ClientState> {
return this.onCurrentStateChangedEmitter.event;
}

protected _currentState: ClientState = ClientState.Initial;

get currentState(): ClientState {
return this._currentState;
}
Expand All @@ -72,18 +79,24 @@ export class WebviewGlspClient implements GLSPClient, Disposable {
constructor(options: WebviewGlspClientOptions) {
this.id = options.id;
this.messenger = options.messenger ?? new Messenger();
this.toDispose.push(this.onActionMessageEmitter, this.onServerInitializedEmitter);
this.messenger.onNotification<ActionMessage>(ActionMessageNotification, msg => this.onActionMessageEmitter.fire(msg));
this.toDispose.push(this.onActionMessageEmitter, this.onServerInitializedEmitter, this.onCurrentStateChangedEmitter);
this.messenger.onNotification(ActionMessageNotification, msg => this.onActionMessageEmitter.fire(msg));
this.messenger.onNotification(ClientStateChangeNotification, state => this.updateState(state));
}

protected updateState(state: ClientState): void {
if (this._currentState !== state) {
this._currentState = state;
this.onCurrentStateChangedEmitter.fire(this._currentState);
}
}

async start(): Promise<void> {
try {
this._currentState = ClientState.Starting;
await this.messenger.sendRequest(StartRequest, HOST_EXTENSION);
this._currentState = ClientState.Running;
} catch (error) {
console.error('Failed to start connection to server', error);
this._currentState = ClientState.StartFailed;
this.updateState(ClientState.StartFailed);
}
}

Expand All @@ -110,12 +123,10 @@ export class WebviewGlspClient implements GLSPClient, Disposable {
}

async stop(): Promise<void> {
if (this._currentState === ClientState.Stopped) {
if (this.currentState === ClientState.Stopped) {
return;
}
this._currentState = ClientState.Stopping;
await this.messenger.sendRequest(StopRequest, HOST_EXTENSION);
this._currentState = ClientState.Stopped;
}

sendActionMessage(message: ActionMessage<Action>): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
********************************************************************************/
import {
ActionMessage,
ClientState,
Deferred,
Disposable,
DisposableCollection,
Expand All @@ -39,6 +40,7 @@ export const WebviewReadyNotification: NotificationType<void> = { method: 'ready
export const InitializeNotification: NotificationType<GLSPDiagramIdentifier> = { method: 'initialize' };

export const ActionMessageNotification: NotificationType<ActionMessage> = { method: 'actionMessage' };
export const ClientStateChangeNotification: NotificationType<ClientState> = { method: 'notifyClientStateChange' };
export const StartRequest: RequestType<undefined, void> = { method: 'start' };
export const InitializeServerRequest: RequestType<InitializeParameters, InitializeResult> = { method: 'initializeServer' };
export const InitializeClientSessionRequest: RequestType<InitializeClientSessionParameters, void> = { method: 'initializeClientSession' };
Expand Down Expand Up @@ -160,7 +162,10 @@ export class WebviewEndpoint implements Disposable {
}),
this.messenger.onRequest(StopRequest, () => glspClient.stop(), {
sender: this.messageParticipant
})
}),
glspClient.onCurrentStateChanged(state =>
this.messenger.sendNotification(ClientStateChangeNotification, this.messageParticipant, state)
)
);
this.toDispose.push(toDispose);
this.sendDiagramIdentifier();
Expand Down
Loading