I'm trying to fix some issues with the LSP client showing errors when I try to dispose it. One issue is that I'm getting errors like this:
rejected promise not handled within 1 second: Error: Client is not running and can't be stopped. It's current state is: starting
extensionHostProcess.js:155
stack trace: Error: Client is not running and can't be stopped. It's current state is: starting
at LanguageClient.shutdown (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:38362:10)
at LanguageClient.stop (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:38332:15)
at LanguageClient.stop (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:47462:22)
at Object.dispose (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:4810:66)
at disposeAll (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:29122:20)
at LspAnalyzer.dispose (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:25645:32)
at d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:14511:36
at tryCleanup (d:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:14544:15)
The problem is that calling stop() is invalid when the state is stopping, however my code looks like this:
if (this.client.needsStop())
await this.client.stop();
The implementation of needsStop is:
|
public needsStop(): boolean { |
|
return this.$state === ClientState.Starting || this.$state === ClientState.Running; |
|
} |
So needsStop says that stop is required if the state is starting, but calling stop() throws. It's not clear to me what the correct way of shutting down the server cleanly is.
I'm trying to fix some issues with the LSP client showing errors when I try to dispose it. One issue is that I'm getting errors like this:
The problem is that calling
stop()is invalid when the state isstopping, however my code looks like this:The implementation of needsStop is:
vscode-languageserver-node/client/src/common/client.ts
Lines 1228 to 1230 in f58f4df
So
needsStopsays that stop is required if the state isstarting, but callingstop()throws. It's not clear to me what the correct way of shutting down the server cleanly is.