Our VS Code extension has a command to restart its language server. After a restart there are two identical OutputChannels in the Output dropdown. I did some digging and found the following steps were happening:
- The initial client is created, client's output channel ("OC1") is created.
- User runs the "Restart LSP Server" command in our extension
client.stop is called, "OC1" is disposed, client._outputChannel is set to undefined
- Cleanup continues, and the spawned LSP process is terminated
- This finally block executes, listening for the LSP process to exit.
- LSP exits with code 0, which is then logged here.
- The
outputChannel getter, seeing that this._outputChannel is undefined due to previous disposal, creates a new output channel ("OC2") that replaces the one that was disposed.
- Finally, our command creates a new client, which creates a new output channel "OC3".
This leaves us with one more output channel than we started with.
Our VS Code extension has a command to restart its language server. After a restart there are two identical OutputChannels in the Output dropdown. I did some digging and found the following steps were happening:
client.stopis called, "OC1" is disposed, client._outputChannel is set to undefinedoutputChannelgetter, seeing thatthis._outputChannelis undefined due to previous disposal, creates a new output channel ("OC2") that replaces the one that was disposed.This leaves us with one more output channel than we started with.