Skip to content
Open
18 changes: 11 additions & 7 deletions src/client/activation/common/outputChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,30 @@
import { inject, injectable } from 'inversify';
import { IApplicationShell, ICommandManager } from '../../common/application/types';
import '../../common/extensions';
import { IDisposableRegistry, ILogOutputChannel } from '../../common/types';
import { IDisposable, ILogOutputChannel } from '../../common/types';
import { OutputChannelNames } from '../../common/utils/localize';
import { ILanguageServerOutputChannel } from '../types';

@injectable()
export class LanguageServerOutputChannel implements ILanguageServerOutputChannel {
public output: ILogOutputChannel | undefined;

private disposables: IDisposable[] = [];
private registered = false;

constructor(
@inject(IApplicationShell) private readonly appShell: IApplicationShell,
@inject(ICommandManager) private readonly commandManager: ICommandManager,
@inject(IDisposableRegistry) private readonly disposable: IDisposableRegistry,
) {}

public dispose(): void {
this.disposables.forEach((d) => d && d.dispose());
this.disposables = [];
}

public get channel(): ILogOutputChannel {
if (!this.output) {
this.output = this.appShell.createOutputChannel(OutputChannelNames.languageServer);
this.disposable.push(this.output);
this.output = this.appShell.createOutputChannel(OutputChannelNames.JediLanguageServer);
this.disposables.push(this.output);
this.registerCommand().ignoreErrors();
}
return this.output;
Expand All @@ -39,10 +43,10 @@ export class LanguageServerOutputChannel implements ILanguageServerOutputChannel
// This controls the visibility of the command used to display the LS Output panel.
// We don't want to display it when Jedi is used instead of LS.
await this.commandManager.executeCommand('setContext', 'python.hasLanguageServerOutputChannel', true);
this.disposable.push(
this.disposables.push(
this.commandManager.registerCommand('python.viewLanguageServerOutput', () => this.output?.show(true)),
);
this.disposable.push({
this.disposables.push({
dispose: () => {
this.registered = false;
},
Expand Down
236 changes: 0 additions & 236 deletions src/client/activation/node/languageServerProxy.ts

This file was deleted.

Loading
Loading