@@ -44,7 +44,7 @@ import { DefaultGutterClickAction, TestingConfigKeys, getTestingConfiguration }
44
44
import { Testing , labelForTestInState } from 'vs/workbench/contrib/testing/common/constants' ;
45
45
import { TestId } from 'vs/workbench/contrib/testing/common/testId' ;
46
46
import { ITestProfileService } from 'vs/workbench/contrib/testing/common/testProfileService' ;
47
- import { LiveTestResult } from 'vs/workbench/contrib/testing/common/testResult' ;
47
+ import { ITestResult , LiveTestResult } from 'vs/workbench/contrib/testing/common/testResult' ;
48
48
import { ITestResultService } from 'vs/workbench/contrib/testing/common/testResultService' ;
49
49
import { ITestService , getContextForTestItem , testsInFile } from 'vs/workbench/contrib/testing/common/testService' ;
50
50
import { IRichLocation , ITestMessage , ITestRunProfile , IncrementalTestCollectionItem , InternalTestItem , TestDiffOpType , TestMessageType , TestResultItem , TestResultState , TestRunProfileBitset } from 'vs/workbench/contrib/testing/common/testTypes' ;
@@ -318,47 +318,11 @@ export class TestingDecorationService extends Disposable implements ITestingDeco
318
318
}
319
319
}
320
320
321
- const lastResult = this . results . results [ 0 ] ;
322
- if ( this . testService . showInlineOutput . value && lastResult instanceof LiveTestResult ) {
323
- for ( const task of lastResult . tasks ) {
324
- for ( const m of task . otherMessages ) {
325
- if ( ! this . invalidatedMessages . has ( m ) && m . location ?. uri . toString ( ) === uriStr ) {
326
- const decoration = lastDecorations . getMessage ( m ) || this . instantiationService . createInstance ( TestMessageDecoration , m , undefined , model ) ;
327
- newDecorations . addMessage ( decoration ) ;
328
- }
329
- }
330
- }
331
-
332
- const messageLines = new Map < /* line number */ number , /* last test message */ ITestMessage > ( ) ;
333
- for ( const test of lastResult . tests ) {
334
- for ( let taskId = 0 ; taskId < test . tasks . length ; taskId ++ ) {
335
- const state = test . tasks [ taskId ] ;
336
- for ( let i = 0 ; i < state . messages . length ; i ++ ) {
337
- const m = state . messages [ i ] ;
338
- if ( this . invalidatedMessages . has ( m ) || m . location ?. uri . toString ( ) !== uriStr ) {
339
- continue ;
340
- }
341
-
342
- // Only add one message per line number. Overlapping messages
343
- // don't appear well, and the peek will show all of them (#134129)
344
- const line = m . location . range . startLineNumber ;
345
- if ( messageLines . has ( line ) ) {
346
- newDecorations . removeMessage ( messageLines . get ( line ) ! ) ;
347
- }
348
-
349
- const decoration = lastDecorations . getMessage ( m ) || this . instantiationService . createInstance ( TestMessageDecoration , m , buildTestUri ( {
350
- type : TestUriType . ResultActualOutput ,
351
- messageIndex : i ,
352
- taskIndex : taskId ,
353
- resultId : lastResult . id ,
354
- testExtId : test . item . extId ,
355
- } ) , model ) ;
356
-
357
- newDecorations . addMessage ( decoration ) ;
358
- messageLines . set ( line , decoration . testMessage ) ;
359
- }
360
- }
361
- }
321
+ const messageLines = new Set < number > ( ) ;
322
+ if ( getTestingConfiguration ( this . configurationService , TestingConfigKeys . ShowAllMessages ) ) {
323
+ this . results . results . forEach ( lastResult => this . applyDecorationsFromResult ( lastResult , messageLines , uriStr , lastDecorations , model , newDecorations ) ) ;
324
+ } else {
325
+ this . applyDecorationsFromResult ( this . results . results [ 0 ] , messageLines , uriStr , lastDecorations , model , newDecorations ) ;
362
326
}
363
327
364
328
const saveFromRemoval = new Set < string > ( ) ;
@@ -387,6 +351,47 @@ export class TestingDecorationService extends Disposable implements ITestingDeco
387
351
388
352
return newDecorations || lastDecorations ;
389
353
}
354
+
355
+ private applyDecorationsFromResult ( lastResult : ITestResult , messageLines : Set < Number > , uriStr : string , lastDecorations : CachedDecorations , model : ITextModel , newDecorations : CachedDecorations ) {
356
+ if ( this . testService . showInlineOutput . value && lastResult instanceof LiveTestResult ) {
357
+ for ( const task of lastResult . tasks ) {
358
+ for ( const m of task . otherMessages ) {
359
+ if ( ! this . invalidatedMessages . has ( m ) && m . location ?. uri . toString ( ) === uriStr ) {
360
+ const decoration = lastDecorations . getMessage ( m ) || this . instantiationService . createInstance ( TestMessageDecoration , m , undefined , model ) ;
361
+ newDecorations . addMessage ( decoration ) ;
362
+ }
363
+ }
364
+ }
365
+
366
+ for ( const test of lastResult . tests ) {
367
+ for ( let taskId = 0 ; taskId < test . tasks . length ; taskId ++ ) {
368
+ const state = test . tasks [ taskId ] ;
369
+ for ( let i = 0 ; i < state . messages . length ; i ++ ) {
370
+ const m = state . messages [ i ] ;
371
+ if ( this . invalidatedMessages . has ( m ) || m . location ?. uri . toString ( ) !== uriStr ) {
372
+ continue ;
373
+ }
374
+
375
+ // Only add one message per line number. Overlapping messages
376
+ // don't appear well, and the peek will show all of them (#134129)
377
+ const line = m . location . range . startLineNumber ;
378
+ if ( ! messageLines . has ( line ) ) {
379
+ const decoration = lastDecorations . getMessage ( m ) || this . instantiationService . createInstance ( TestMessageDecoration , m , buildTestUri ( {
380
+ type : TestUriType . ResultActualOutput ,
381
+ messageIndex : i ,
382
+ taskIndex : taskId ,
383
+ resultId : lastResult . id ,
384
+ testExtId : test . item . extId ,
385
+ } ) , model ) ;
386
+
387
+ newDecorations . addMessage ( decoration ) ;
388
+ messageLines . add ( line ) ;
389
+ }
390
+ }
391
+ }
392
+ }
393
+ }
394
+ }
390
395
}
391
396
392
397
export class TestingDecorations extends Disposable implements IEditorContribution {
0 commit comments