@@ -26,7 +26,7 @@ import { OutputChannelUpdateMode } from 'vs/workbench/services/output/common/out
26
26
export interface IOutputChannelModel extends IDisposable {
27
27
readonly onDispose : Event < void > ;
28
28
append ( output : string ) : void ;
29
- update ( mode : OutputChannelUpdateMode , till ? : number ) : void ;
29
+ update ( mode : OutputChannelUpdateMode , till : number | undefined , immediate : boolean ) : void ;
30
30
loadModel ( ) : Promise < ITextModel > ;
31
31
clear ( ) : void ;
32
32
replace ( value : string ) : void ;
@@ -129,12 +129,12 @@ export class FileOutputChannelModel extends Disposable implements IOutputChannel
129
129
}
130
130
131
131
clear ( ) : void {
132
- this . update ( OutputChannelUpdateMode . Clear , this . endOffset ) ;
132
+ this . update ( OutputChannelUpdateMode . Clear , this . endOffset , true ) ;
133
133
}
134
134
135
- update ( mode : OutputChannelUpdateMode , till ? : number ) : void {
135
+ update ( mode : OutputChannelUpdateMode , till : number | undefined , immediate : boolean ) : void {
136
136
const loadModelPromise : Promise < any > = this . loadModelPromise ? this . loadModelPromise : Promise . resolve ( ) ;
137
- loadModelPromise . then ( ( ) => this . doUpdate ( mode , till ) ) ;
137
+ loadModelPromise . then ( ( ) => this . doUpdate ( mode , till , immediate ) ) ;
138
138
}
139
139
140
140
loadModel ( ) : Promise < ITextModel > {
@@ -174,7 +174,7 @@ export class FileOutputChannelModel extends Disposable implements IOutputChannel
174
174
return this . model ;
175
175
}
176
176
177
- private doUpdate ( mode : OutputChannelUpdateMode , till ? : number ) : void {
177
+ private doUpdate ( mode : OutputChannelUpdateMode , till : number | undefined , immediate : boolean ) : void {
178
178
if ( mode === OutputChannelUpdateMode . Clear || mode === OutputChannelUpdateMode . Replace ) {
179
179
this . startOffset = this . endOffset = isNumber ( till ) ? till : this . endOffset ;
180
180
this . cancelModelUpdate ( ) ;
@@ -198,15 +198,15 @@ export class FileOutputChannelModel extends Disposable implements IOutputChannel
198
198
}
199
199
200
200
else {
201
- this . appendContent ( this . model , token ) ;
201
+ this . appendContent ( this . model , immediate , token ) ;
202
202
}
203
203
}
204
204
205
205
private clearContent ( model : ITextModel ) : void {
206
206
this . doUpdateModel ( model , [ EditOperation . delete ( model . getFullModelRange ( ) ) ] , VSBuffer . fromString ( '' ) ) ;
207
207
}
208
208
209
- private async appendContent ( model : ITextModel , token : CancellationToken ) : Promise < void > {
209
+ private async appendContent ( model : ITextModel , immediate : boolean , token : CancellationToken ) : Promise < void > {
210
210
this . appendThrottler . trigger ( async ( ) => {
211
211
/* Abort if operation is cancelled */
212
212
if ( token . isCancellationRequested ) {
@@ -234,7 +234,7 @@ export class FileOutputChannelModel extends Disposable implements IOutputChannel
234
234
const lastLineMaxColumn = model . getLineMaxColumn ( lastLine ) ;
235
235
const edits = [ EditOperation . insert ( new Position ( lastLine , lastLineMaxColumn ) , contentToAppend . toString ( ) ) ] ;
236
236
this . doUpdateModel ( model , edits , contentToAppend ) ;
237
- } ) ;
237
+ } , immediate ? 0 : undefined ) ;
238
238
}
239
239
240
240
private async replaceContent ( model : ITextModel , token : CancellationToken ) : Promise < void > {
@@ -298,10 +298,10 @@ export class FileOutputChannelModel extends Disposable implements IOutputChannel
298
298
if ( ! this . modelUpdateInProgress ) {
299
299
if ( isNumber ( size ) && this . endOffset > size ) {
300
300
// Reset - Content is removed
301
- this . update ( OutputChannelUpdateMode . Clear , 0 ) ;
301
+ this . update ( OutputChannelUpdateMode . Clear , 0 , true ) ;
302
302
}
303
303
}
304
- this . update ( OutputChannelUpdateMode . Append ) ;
304
+ this . update ( OutputChannelUpdateMode . Append , undefined , false /* Not needed to update immediately. Wait to collect more changes and update. */ ) ;
305
305
}
306
306
}
307
307
@@ -340,13 +340,13 @@ class OutputChannelBackedByFile extends FileOutputChannelModel implements IOutpu
340
340
341
341
override append ( message : string ) : void {
342
342
this . write ( message ) ;
343
- this . update ( OutputChannelUpdateMode . Append ) ;
343
+ this . update ( OutputChannelUpdateMode . Append , undefined , this . isVisible ( ) ) ;
344
344
}
345
345
346
346
override replace ( message : string ) : void {
347
347
const till = this . _offset ;
348
348
this . write ( message ) ;
349
- this . update ( OutputChannelUpdateMode . Replace , till ) ;
349
+ this . update ( OutputChannelUpdateMode . Replace , till , true ) ;
350
350
}
351
351
352
352
private write ( content : string ) : void {
@@ -391,8 +391,8 @@ export class DelegatedOutputChannelModel extends Disposable implements IOutputCh
391
391
this . outputChannelModel . then ( outputChannelModel => outputChannelModel . append ( output ) ) ;
392
392
}
393
393
394
- update ( mode : OutputChannelUpdateMode , till ? : number ) : void {
395
- this . outputChannelModel . then ( outputChannelModel => outputChannelModel . update ( mode , till ) ) ;
394
+ update ( mode : OutputChannelUpdateMode , till : number | undefined , immediate : boolean ) : void {
395
+ this . outputChannelModel . then ( outputChannelModel => outputChannelModel . update ( mode , till , immediate ) ) ;
396
396
}
397
397
398
398
loadModel ( ) : Promise < ITextModel > {
0 commit comments