66import { inject , injectable } from 'inversify' ;
77import { IApplicationShell , ICommandManager } from '../../common/application/types' ;
88import '../../common/extensions' ;
9- import { IDisposableRegistry , ILogOutputChannel } from '../../common/types' ;
9+ import { IDisposable , ILogOutputChannel } from '../../common/types' ;
1010import { OutputChannelNames } from '../../common/utils/localize' ;
1111import { ILanguageServerOutputChannel } from '../types' ;
1212
1313@injectable ( )
1414export class LanguageServerOutputChannel implements ILanguageServerOutputChannel {
1515 public output : ILogOutputChannel | undefined ;
16-
16+ private disposables : IDisposable [ ] = [ ] ;
1717 private registered = false ;
1818
1919 constructor (
2020 @inject ( IApplicationShell ) private readonly appShell : IApplicationShell ,
2121 @inject ( ICommandManager ) private readonly commandManager : ICommandManager ,
22- @inject ( IDisposableRegistry ) private readonly disposable : IDisposableRegistry ,
2322 ) { }
2423
24+ public dispose ( ) : void {
25+ this . disposables . forEach ( ( d ) => d && d . dispose ( ) ) ;
26+ this . disposables = [ ] ;
27+ }
28+
2529 public get channel ( ) : ILogOutputChannel {
2630 if ( ! this . output ) {
27- this . output = this . appShell . createOutputChannel ( OutputChannelNames . languageServer ) ;
28- this . disposable . push ( this . output ) ;
31+ this . output = this . appShell . createOutputChannel ( OutputChannelNames . JediLanguageServer ) ;
32+ this . disposables . push ( this . output ) ;
2933 this . registerCommand ( ) . ignoreErrors ( ) ;
3034 }
3135 return this . output ;
@@ -39,10 +43,10 @@ export class LanguageServerOutputChannel implements ILanguageServerOutputChannel
3943 // This controls the visibility of the command used to display the LS Output panel.
4044 // We don't want to display it when Jedi is used instead of LS.
4145 await this . commandManager . executeCommand ( 'setContext' , 'python.hasLanguageServerOutputChannel' , true ) ;
42- this . disposable . push (
46+ this . disposables . push (
4347 this . commandManager . registerCommand ( 'python.viewLanguageServerOutput' , ( ) => this . output ?. show ( true ) ) ,
4448 ) ;
45- this . disposable . push ( {
49+ this . disposables . push ( {
4650 dispose : ( ) => {
4751 this . registered = false ;
4852 } ,
0 commit comments