mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-16 05:39:28 +00:00
Fixed LS stops working after OS sleep/wakeup cycle
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { Emitter, Event, JsonRpcProxy } from '@theia/core';
|
||||
import { injectable, interfaces } from '@theia/core/shared/inversify';
|
||||
import { HostedPluginServer } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
||||
import { HostedPluginSupport as TheiaHostedPluginSupport } from '@theia/plugin-ext/lib/hosted/browser/hosted-plugin';
|
||||
@injectable()
|
||||
export class HostedPluginSupport extends TheiaHostedPluginSupport {
|
||||
private readonly onDidLoadEmitter = new Emitter<void>();
|
||||
private readonly onDidCloseConnectionEmitter = new Emitter<void>();
|
||||
|
||||
override onStart(container: interfaces.Container): void {
|
||||
super.onStart(container);
|
||||
this.hostedPluginServer.onDidCloseConnection(() =>
|
||||
this.onDidCloseConnectionEmitter.fire()
|
||||
);
|
||||
}
|
||||
|
||||
protected override async doLoad(): Promise<void> {
|
||||
await super.doLoad();
|
||||
this.onDidLoadEmitter.fire(); // Unlike Theia, IDE2 fires an event after loading the VS Code extensions.
|
||||
}
|
||||
|
||||
get onDidLoad(): Event<void> {
|
||||
return this.onDidLoadEmitter.event;
|
||||
}
|
||||
|
||||
get onDidCloseConnection(): Event<void> {
|
||||
return this.onDidCloseConnectionEmitter.event;
|
||||
}
|
||||
|
||||
private get hostedPluginServer(): JsonRpcProxy<HostedPluginServer> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (this as any).server;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user