Skip to content

Commit

Permalink
Fix restartLS command disposal (#18993)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimadeline authored Apr 25, 2022
1 parent 4e20c2b commit 707e8b6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/client/activation/node/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,21 @@ export class NodeLanguageServerManager implements ILanguageServerManager {

private started = false;

private static commandDispose: IDisposable;

constructor(
private readonly serviceContainer: IServiceContainer,
private readonly analysisOptions: ILanguageServerAnalysisOptions,
private readonly languageServerProxy: ILanguageServerProxy,
commandManager: ICommandManager,
private readonly extensions: IExtensions,
) {
this.disposables.push(
commandManager.registerCommand(Commands.RestartLS, () => {
this.restartLanguageServer().ignoreErrors();
}),
);
if (NodeLanguageServerManager.commandDispose) {
NodeLanguageServerManager.commandDispose.dispose();
}
NodeLanguageServerManager.commandDispose = commandManager.registerCommand(Commands.RestartLS, () => {
this.restartLanguageServer().ignoreErrors();
});
}

private static versionTelemetryProps(instance: NodeLanguageServerManager) {
Expand All @@ -59,6 +62,7 @@ export class NodeLanguageServerManager implements ILanguageServerManager {
if (this.languageProxy) {
this.languageProxy.dispose();
}
NodeLanguageServerManager.commandDispose.dispose();
this.disposables.forEach((d) => d.dispose());
}

Expand Down

0 comments on commit 707e8b6

Please sign in to comment.