microsoft / microsoft/vscode-languageserver-node

Stopped client can recreate its OutputChannel

Open
#1,496 1 comment 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.8k
Forks
404
Avg merge
2d 8h
Merged PRs (30d)
14

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.