@@ -13,6 +13,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
1313import { ILineMatcher , createLineMatcher , ProblemMatcher , ProblemMatch , ApplyToKind , WatchingPattern , getResource } from 'vs/workbench/contrib/tasks/common/problemMatcher' ;
1414import { IMarkerService , IMarkerData , MarkerSeverity } from 'vs/platform/markers/common/markers' ;
1515import { generateUuid } from 'vs/base/common/uuid' ;
16+ import { IFileService } from 'vs/platform/files/common/files' ;
1617
1718export const enum ProblemCollectorEventKind {
1819 BackgroundProcessingBegins = 'backgroundProcessingBegins' ,
@@ -30,7 +31,7 @@ namespace ProblemCollectorEvent {
3031}
3132
3233export interface IProblemMatcher {
33- processLine ( line : string ) : void ;
34+ processLine ( line : string ) : Promise < void > ;
3435}
3536
3637export class AbstractProblemCollector implements IDisposable {
@@ -55,10 +56,10 @@ export class AbstractProblemCollector implements IDisposable {
5556
5657 protected _onDidStateChange : Emitter < ProblemCollectorEvent > ;
5758
58- constructor ( problemMatchers : ProblemMatcher [ ] , protected markerService : IMarkerService , private modelService : IModelService ) {
59+ constructor ( problemMatchers : ProblemMatcher [ ] , protected markerService : IMarkerService , private modelService : IModelService , fileService ?: IFileService ) {
5960 this . matchers = Object . create ( null ) ;
6061 this . bufferLength = 1 ;
61- problemMatchers . map ( elem => createLineMatcher ( elem ) ) . forEach ( ( matcher ) => {
62+ problemMatchers . map ( elem => createLineMatcher ( elem , fileService ) ) . forEach ( ( matcher ) => {
6263 let length = matcher . matchLength ;
6364 if ( length > this . bufferLength ) {
6465 this . bufferLength = length ;
@@ -143,14 +144,14 @@ export class AbstractProblemCollector implements IDisposable {
143144 return result ;
144145 }
145146
146- protected shouldApplyMatch ( result : ProblemMatch ) : boolean {
147+ protected async shouldApplyMatch ( result : ProblemMatch ) : Promise < boolean > {
147148 switch ( result . description . applyTo ) {
148149 case ApplyToKind . allDocuments :
149150 return true ;
150151 case ApplyToKind . openDocuments :
151- return ! ! this . openModels [ result . resource . toString ( ) ] ;
152+ return ! ! this . openModels [ ( await result . resource ) . toString ( ) ] ;
152153 case ApplyToKind . closedDocuments :
153- return ! this . openModels [ result . resource . toString ( ) ] ;
154+ return ! this . openModels [ ( await result . resource ) . toString ( ) ] ;
154155 default :
155156 return true ;
156157 }
@@ -333,8 +334,8 @@ export class StartStopProblemCollector extends AbstractProblemCollector implemen
333334 private currentOwner : string ;
334335 private currentResource : string ;
335336
336- constructor ( problemMatchers : ProblemMatcher [ ] , markerService : IMarkerService , modelService : IModelService , _strategy : ProblemHandlingStrategy = ProblemHandlingStrategy . Clean ) {
337- super ( problemMatchers , markerService , modelService ) ;
337+ constructor ( problemMatchers : ProblemMatcher [ ] , markerService : IMarkerService , modelService : IModelService , _strategy : ProblemHandlingStrategy = ProblemHandlingStrategy . Clean , fileService ?: IFileService ) {
338+ super ( problemMatchers , markerService , modelService , fileService ) ;
338339 let ownerSet : { [ key : string ] : boolean ; } = Object . create ( null ) ;
339340 problemMatchers . forEach ( description => ownerSet [ description . owner ] = true ) ;
340341 this . owners = Object . keys ( ownerSet ) ;
@@ -343,17 +344,17 @@ export class StartStopProblemCollector extends AbstractProblemCollector implemen
343344 } ) ;
344345 }
345346
346- public processLine ( line : string ) : void {
347+ public async processLine ( line : string ) : Promise < void > {
347348 let markerMatch = this . tryFindMarker ( line ) ;
348349 if ( ! markerMatch ) {
349350 return ;
350351 }
351352
352353 let owner = markerMatch . description . owner ;
353- let resource = markerMatch . resource ;
354+ let resource = await markerMatch . resource ;
354355 let resourceAsString = resource . toString ( ) ;
355356 this . removeResourceToClean ( owner , resourceAsString ) ;
356- let shouldApplyMatch = this . shouldApplyMatch ( markerMatch ) ;
357+ let shouldApplyMatch = await this . shouldApplyMatch ( markerMatch ) ;
357358 if ( shouldApplyMatch ) {
358359 this . recordMarker ( markerMatch . marker , owner , resourceAsString ) ;
359360 if ( this . currentOwner !== owner || this . currentResource !== resourceAsString ) {
@@ -386,8 +387,8 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement
386387 private currentOwner : string | null ;
387388 private currentResource : string | null ;
388389
389- constructor ( problemMatchers : ProblemMatcher [ ] , markerService : IMarkerService , modelService : IModelService ) {
390- super ( problemMatchers , markerService , modelService ) ;
390+ constructor ( problemMatchers : ProblemMatcher [ ] , markerService : IMarkerService , modelService : IModelService , fileService ?: IFileService ) {
391+ super ( problemMatchers , markerService , modelService , fileService ) ;
391392 this . problemMatchers = problemMatchers ;
392393 this . resetCurrentResource ( ) ;
393394 this . backgroundPatterns = [ ] ;
@@ -415,19 +416,19 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement
415416 }
416417 }
417418
418- public processLine ( line : string ) : void {
419+ public async processLine ( line : string ) : Promise < void > {
419420 if ( this . tryBegin ( line ) || this . tryFinish ( line ) ) {
420421 return ;
421422 }
422423 let markerMatch = this . tryFindMarker ( line ) ;
423424 if ( ! markerMatch ) {
424425 return ;
425426 }
426- let resource = markerMatch . resource ;
427+ let resource = await markerMatch . resource ;
427428 let owner = markerMatch . description . owner ;
428429 let resourceAsString = resource . toString ( ) ;
429430 this . removeResourceToClean ( owner , resourceAsString ) ;
430- let shouldApplyMatch = this . shouldApplyMatch ( markerMatch ) ;
431+ let shouldApplyMatch = await this . shouldApplyMatch ( markerMatch ) ;
431432 if ( shouldApplyMatch ) {
432433 this . recordMarker ( markerMatch . marker , owner , resourceAsString ) ;
433434 if ( this . currentOwner !== owner || this . currentResource !== resourceAsString ) {
@@ -442,7 +443,7 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement
442443 this . reportMarkersForCurrentResource ( ) ;
443444 }
444445
445- private tryBegin ( line : string ) : boolean {
446+ private async tryBegin ( line : string ) : Promise < boolean > {
446447 let result = false ;
447448 for ( const background of this . backgroundPatterns ) {
448449 let matches = background . begin . regexp . exec ( line ) ;
@@ -459,7 +460,7 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement
459460 let file = matches [ background . begin . file ! ] ;
460461 if ( file ) {
461462 let resource = getResource ( file , background . matcher ) ;
462- this . recordResourceToClean ( owner , resource ) ;
463+ this . recordResourceToClean ( owner , await resource ) ;
463464 } else {
464465 this . recordResourcesToClean ( owner ) ;
465466 }
0 commit comments