@@ -184,6 +184,8 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
184
184
185
185
private _activeTasks : IStringDictionary < IActiveTerminalData > ;
186
186
private _busyTasks : IStringDictionary < Task > ;
187
+ private _taskErrors : IStringDictionary < boolean > ; // Tracks which tasks had errors from problem matchers
188
+ private _taskDependencies : IStringDictionary < string [ ] > ; // Tracks which tasks depend on which other tasks
187
189
private _terminals : IStringDictionary < ITerminalData > ;
188
190
private _idleTaskTerminals : LinkedMap < string , string > ;
189
191
private _sameTaskTerminals : IStringDictionary < string > ;
@@ -243,6 +245,8 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
243
245
244
246
this . _activeTasks = Object . create ( null ) ;
245
247
this . _busyTasks = Object . create ( null ) ;
248
+ this . _taskErrors = Object . create ( null ) ;
249
+ this . _taskDependencies = Object . create ( null ) ;
246
250
this . _terminals = Object . create ( null ) ;
247
251
this . _idleTaskTerminals = new LinkedMap < string , string > ( ) ;
248
252
this . _sameTaskTerminals = Object . create ( null ) ;
@@ -528,6 +532,16 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
528
532
const dependencyTask = await resolver . resolve ( dependency . uri , dependency . task ) ;
529
533
if ( dependencyTask ) {
530
534
this . _adoptConfigurationForDependencyTask ( dependencyTask , task ) ;
535
+
536
+ // Track the dependency relationship
537
+ const taskMapKey = task . getMapKey ( ) ;
538
+ const dependencyMapKey = dependencyTask . getMapKey ( ) ;
539
+ if ( ! this . _taskDependencies [ taskMapKey ] ) {
540
+ this . _taskDependencies [ taskMapKey ] = [ ] ;
541
+ }
542
+ if ( ! this . _taskDependencies [ taskMapKey ] . includes ( dependencyMapKey ) ) {
543
+ this . _taskDependencies [ taskMapKey ] . push ( dependencyMapKey ) ;
544
+ }
531
545
let taskResult ;
532
546
const commonKey = dependencyTask . getCommonTaskId ( ) ;
533
547
if ( nextLiveDependencies . has ( commonKey ) ) {
@@ -600,6 +614,33 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
600
614
} ) ;
601
615
}
602
616
617
+ private _taskHasErrors ( task : Task ) : boolean {
618
+ const taskMapKey = task . getMapKey ( ) ;
619
+
620
+ // Check if this task itself had errors
621
+ if ( this . _taskErrors [ taskMapKey ] ) {
622
+ return true ;
623
+ }
624
+
625
+ // Check if any tracked dependencies had errors
626
+ const dependencies = this . _taskDependencies [ taskMapKey ] ;
627
+ if ( dependencies ) {
628
+ for ( const dependencyMapKey of dependencies ) {
629
+ if ( this . _taskErrors [ dependencyMapKey ] ) {
630
+ return true ;
631
+ }
632
+ }
633
+ }
634
+
635
+ return false ;
636
+ }
637
+
638
+ private _cleanupTaskTracking ( task : Task ) : void {
639
+ const taskMapKey = task . getMapKey ( ) ;
640
+ delete this . _taskErrors [ taskMapKey ] ;
641
+ delete this . _taskDependencies [ taskMapKey ] ;
642
+ }
643
+
603
644
private _adoptConfigurationForDependencyTask ( dependencyTask : Task , task : Task ) : void {
604
645
if ( dependencyTask . configurationProperties . icon ) {
605
646
dependencyTask . configurationProperties . icon . id ||= task . configurationProperties . icon ?. id ;
@@ -852,6 +893,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
852
893
if ( eventCounter === 0 ) {
853
894
if ( ( watchingProblemMatcher . numberOfMatches > 0 ) && watchingProblemMatcher . maxMarkerSeverity &&
854
895
( watchingProblemMatcher . maxMarkerSeverity >= MarkerSeverity . Error ) ) {
896
+ this . _taskErrors [ task . getMapKey ( ) ] = true ;
855
897
this . _fireTaskEvent ( TaskEvent . general ( TaskEventKind . ProblemMatcherFoundErrors , task , terminal ?. instanceId ) ) ;
856
898
const reveal = task . command . presentation ! . reveal ;
857
899
const revealProblems = task . command . presentation ! . revealProblems ;
@@ -862,7 +904,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
862
904
this . _terminalGroupService . showPanel ( false ) ;
863
905
}
864
906
} else {
865
- this . _fireTaskEvent ( TaskEvent . general ( TaskEventKind . ProblemMatcherEnded , task , terminal ?. instanceId ) ) ;
907
+ this . _fireTaskEvent ( TaskEvent . problemMatcherEnded ( task , this . _taskHasErrors ( task ) , terminal ?. instanceId ) ) ;
866
908
}
867
909
}
868
910
}
@@ -1000,9 +1042,10 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
1000
1042
this . _fireTaskEvent ( TaskEvent . general ( TaskEventKind . ProblemMatcherStarted , task , terminal ?. instanceId ) ) ;
1001
1043
} else if ( event . kind === ProblemCollectorEventKind . BackgroundProcessingEnds ) {
1002
1044
if ( startStopProblemMatcher . numberOfMatches && startStopProblemMatcher . maxMarkerSeverity && startStopProblemMatcher . maxMarkerSeverity >= MarkerSeverity . Error ) {
1045
+ this . _taskErrors [ task . getMapKey ( ) ] = true ;
1003
1046
this . _fireTaskEvent ( TaskEvent . general ( TaskEventKind . ProblemMatcherFoundErrors , task , terminal ?. instanceId ) ) ;
1004
1047
} else {
1005
- this . _fireTaskEvent ( TaskEvent . general ( TaskEventKind . ProblemMatcherEnded , task , terminal ?. instanceId ) ) ;
1048
+ this . _fireTaskEvent ( TaskEvent . problemMatcherEnded ( task , this . _taskHasErrors ( task ) , terminal ?. instanceId ) ) ;
1006
1049
}
1007
1050
}
1008
1051
} ) ) ;
@@ -1069,11 +1112,13 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
1069
1112
}
1070
1113
this . _fireTaskEvent ( TaskEvent . general ( TaskEventKind . Inactive , task , terminal ?. instanceId ) ) ;
1071
1114
if ( startStopProblemMatcher . numberOfMatches && startStopProblemMatcher . maxMarkerSeverity && startStopProblemMatcher . maxMarkerSeverity >= MarkerSeverity . Error ) {
1115
+ this . _taskErrors [ task . getMapKey ( ) ] = true ;
1072
1116
this . _fireTaskEvent ( TaskEvent . general ( TaskEventKind . ProblemMatcherFoundErrors , task , terminal ?. instanceId ) ) ;
1073
1117
} else {
1074
- this . _fireTaskEvent ( TaskEvent . general ( TaskEventKind . ProblemMatcherEnded , task , terminal ?. instanceId ) ) ;
1118
+ this . _fireTaskEvent ( TaskEvent . problemMatcherEnded ( task , this . _taskHasErrors ( task ) , terminal ?. instanceId ) ) ;
1075
1119
}
1076
1120
this . _fireTaskEvent ( TaskEvent . general ( TaskEventKind . End , task , terminal ?. instanceId ) ) ;
1121
+ this . _cleanupTaskTracking ( task ) ;
1077
1122
resolve ( { exitCode : exitCode ?? undefined } ) ;
1078
1123
} ) ;
1079
1124
} ) ;
0 commit comments