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
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.stop
is called, "OC1" is disposed, client._outputChannel is set to undefinedoutputChannel
getter, seeing thatthis._outputChannel
is 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.