Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected async doActivate(toDeactivate: DisposableCollection): Promise {
const options: WebSocketOptions = {};
toDeactivate.push(Disposable.create(() => options.reconnecting = false));
this.connectionProvider.listen({
path: LanguageContribution.getPath(this),
onConnection: messageConnection => {
if (toDeactivate.disposed) {
messageConnection.dispose();
return;
}
const languageClient = this.createLanguageClient(messageConnection);
this.onWillStart(languageClient);
toDeactivate.pushAll([
messageConnection,
this.toRestart.push(Disposable.create(async () => {
await languageClient.onReady();
languageClient.stop();
})),
languageClient.start()
onConnection: messageConnection => {
if (toDeactivate.disposed) {
messageConnection.dispose();
return;
}
const languageClient = this.createLanguageClient(messageConnection);
this.onWillStart(languageClient);
toDeactivate.pushAll([
messageConnection,
this.toRestart.push(Disposable.create(async () => {
await languageClient.onReady();
languageClient.stop();
})),
languageClient.start()
]);
}
}, options);