diff --git a/packages/output/src/common/output-channel.ts b/packages/output/src/common/output-channel.ts index 8762c3d8e15df..c02942461e0e5 100644 --- a/packages/output/src/common/output-channel.ts +++ b/packages/output/src/common/output-channel.ts @@ -196,7 +196,7 @@ export class OutputChannelManager implements CommandContribution, Disposable, Re this.textModelService.createModelReference(uri).then(ref => editorModelRef.resolve(ref)); } - const channel = new OutputChannel(resource, this.preferences); + const channel = this.createChannel(resource); this.channels.set(name, channel); this.toDisposeOnChannelDeletion.set(name, this.registerListeners(channel)); this.channelAddedEmitter.fire(channel); @@ -306,6 +306,10 @@ export class OutputChannelManager implements CommandContribution, Disposable, Re return new OutputResource(uri, editorModelRef); } + protected createChannel(resource: OutputResource): OutputChannel { + return new OutputChannel(resource, this.preferences); + } + } export enum OutputChannelSeverity { @@ -316,20 +320,21 @@ export enum OutputChannelSeverity { export class OutputChannel implements Disposable { - private readonly contentChangeEmitter = new Emitter(); - private readonly visibilityChangeEmitter = new Emitter<{ isVisible: boolean, preserveFocus?: boolean }>(); - private readonly disposedEmitter = new Emitter(); - private readonly toDispose = new DisposableCollection( + protected readonly contentChangeEmitter = new Emitter(); + protected readonly visibilityChangeEmitter = new Emitter<{ isVisible: boolean, preserveFocus?: boolean }>(); + protected readonly disposedEmitter = new Emitter(); + protected readonly textModifyQueue = new PQueue({ autoStart: true, concurrency: 1 }); + protected readonly toDispose = new DisposableCollection( + Disposable.create(() => this.textModifyQueue.clear()), this.contentChangeEmitter, this.visibilityChangeEmitter, this.disposedEmitter ); - private disposed = false; - private visible = true; - private _maxLineNumber: number; - private decorationIds = new Set(); - private textModifyQueue = new PQueue({ autoStart: true, concurrency: 1 }); + protected disposed = false; + protected visible = true; + protected _maxLineNumber: number; + protected decorationIds = new Set(); readonly onVisibilityChange: Event<{ isVisible: boolean, preserveFocus?: boolean }> = this.visibilityChangeEmitter.event; readonly onContentChange: Event = this.contentChangeEmitter.event;