@@ -192,8 +192,8 @@ export class FileMatch extends Disposable implements IFileMatch {
192
192
return ( selected ? FileMatch . _CURRENT_FIND_MATCH : FileMatch . _FIND_MATCH ) ;
193
193
}
194
194
195
- private _onChange = this . _register ( new Emitter < { didRemove ?: boolean ; forceUpdateModel ?: boolean } > ( ) ) ;
196
- readonly onChange : Event < { didRemove ?: boolean ; forceUpdateModel ?: boolean } > = this . _onChange . event ;
195
+ private _onChange = this . _register ( new Emitter < { didRemove ?: boolean ; forceUpdateModel ?: boolean ; userRemoved ?: boolean } > ( ) ) ;
196
+ readonly onChange : Event < { didRemove ?: boolean ; forceUpdateModel ?: boolean ; userRemoved ?: boolean } > = this . _onChange . event ;
197
197
198
198
private _onDispose = this . _register ( new Emitter < void > ( ) ) ;
199
199
readonly onDispose : Event < void > = this . _onDispose . event ;
@@ -354,10 +354,10 @@ export class FileMatch extends Disposable implements IFileMatch {
354
354
return values ( this . _matches ) ;
355
355
}
356
356
357
- remove ( match : Match ) : void {
357
+ remove ( match : Match , userRemoved ?: boolean ) : void {
358
358
this . removeMatch ( match ) ;
359
359
this . _removedMatches . add ( match . id ( ) ) ;
360
- this . _onChange . fire ( { didRemove : true } ) ;
360
+ this . _onChange . fire ( { didRemove : true , userRemoved } ) ;
361
361
}
362
362
363
363
replace ( toReplace : Match ) : Promise < void > {
@@ -447,6 +447,7 @@ export interface IChangeEvent {
447
447
elements : FileMatch [ ] ;
448
448
added ?: boolean ;
449
449
removed ?: boolean ;
450
+ userRemoved ?: boolean ;
450
451
}
451
452
452
453
export class FolderMatch extends Disposable {
@@ -529,7 +530,7 @@ export class FolderMatch extends Disposable {
529
530
const fileMatch = this . instantiationService . createInstance ( FileMatch , this . _query . contentPattern , this . _query . previewOptions , this . _query . maxResults , this , rawFileMatch ) ;
530
531
this . doAdd ( fileMatch ) ;
531
532
added . push ( fileMatch ) ;
532
- const disposable = fileMatch . onChange ( ( { didRemove } ) => this . onFileChange ( fileMatch , didRemove ) ) ;
533
+ const disposable = fileMatch . onChange ( ( { didRemove, userRemoved } ) => this . onFileChange ( fileMatch , didRemove , userRemoved ) ) ;
533
534
fileMatch . onDispose ( ( ) => disposable . dispose ( ) ) ;
534
535
}
535
536
} ) ;
@@ -540,14 +541,14 @@ export class FolderMatch extends Disposable {
540
541
}
541
542
}
542
543
543
- clear ( ) : void {
544
+ clear ( userRemoved ?: boolean ) : void {
544
545
const changed : FileMatch [ ] = this . matches ( ) ;
545
546
this . disposeMatches ( ) ;
546
- this . _onChange . fire ( { elements : changed , removed : true } ) ;
547
+ this . _onChange . fire ( { elements : changed , removed : true , userRemoved } ) ;
547
548
}
548
549
549
- remove ( matches : FileMatch | FileMatch [ ] ) : void {
550
- this . doRemove ( matches ) ;
550
+ remove ( matches : FileMatch | FileMatch [ ] , userRemoved ?: boolean ) : void {
551
+ this . doRemove ( matches , undefined , undefined , userRemoved ) ;
551
552
}
552
553
553
554
replace ( match : FileMatch ) : Promise < any > {
@@ -577,7 +578,7 @@ export class FolderMatch extends Disposable {
577
578
return this . matches ( ) . reduce < number > ( ( prev , match ) => prev + match . count ( ) , 0 ) ;
578
579
}
579
580
580
- private onFileChange ( fileMatch : FileMatch , removed = false ) : void {
581
+ private onFileChange ( fileMatch : FileMatch , removed = false , userRemoved = false ) : void {
581
582
let added = false ;
582
583
if ( ! this . _fileMatches . has ( fileMatch . resource ) ) {
583
584
this . doAdd ( fileMatch ) ;
@@ -589,7 +590,7 @@ export class FolderMatch extends Disposable {
589
590
removed = true ;
590
591
}
591
592
if ( ! this . _replacingAll ) {
592
- this . _onChange . fire ( { elements : [ fileMatch ] , added : added , removed : removed } ) ;
593
+ this . _onChange . fire ( { elements : [ fileMatch ] , added : added , removed : removed , userRemoved } ) ;
593
594
}
594
595
}
595
596
@@ -600,7 +601,7 @@ export class FolderMatch extends Disposable {
600
601
}
601
602
}
602
603
603
- private doRemove ( fileMatches : FileMatch | FileMatch [ ] , dispose : boolean = true , trigger : boolean = true ) : void {
604
+ private doRemove ( fileMatches : FileMatch | FileMatch [ ] , dispose : boolean = true , trigger : boolean = true , userRemoved : boolean = false ) : void {
604
605
if ( ! Array . isArray ( fileMatches ) ) {
605
606
fileMatches = [ fileMatches ] ;
606
607
}
@@ -615,7 +616,7 @@ export class FolderMatch extends Disposable {
615
616
}
616
617
617
618
if ( trigger ) {
618
- this . _onChange . fire ( { elements : fileMatches , removed : true } ) ;
619
+ this . _onChange . fire ( { elements : fileMatches , removed : true , userRemoved } ) ;
619
620
}
620
621
}
621
622
@@ -717,7 +718,7 @@ export class SearchResult extends Disposable {
717
718
this . _register ( this . modelService . onModelAdded ( model => this . onModelAdded ( model ) ) ) ;
718
719
719
720
this . _register ( this . onChange ( e => {
720
- if ( e . removed ) {
721
+ if ( e . userRemoved ) {
721
722
this . _hasRemovedResults = true ;
722
723
}
723
724
} ) ) ;
@@ -808,14 +809,14 @@ export class SearchResult extends Disposable {
808
809
this . _otherFilesMatch = null ;
809
810
}
810
811
811
- remove ( matches : FileMatch | FolderMatch | ( FileMatch | FolderMatch ) [ ] ) : void {
812
+ remove ( matches : FileMatch | FolderMatch | ( FileMatch | FolderMatch ) [ ] , userRemoved ?: boolean ) : void {
812
813
if ( ! Array . isArray ( matches ) ) {
813
814
matches = [ matches ] ;
814
815
}
815
816
816
817
matches . forEach ( m => {
817
818
if ( m instanceof FolderMatch ) {
818
- m . clear ( ) ;
819
+ m . clear ( userRemoved ) ;
819
820
}
820
821
} ) ;
821
822
@@ -827,11 +828,11 @@ export class SearchResult extends Disposable {
827
828
return ;
828
829
}
829
830
830
- this . getFolderMatch ( matches [ 0 ] . resource ) . remove ( < FileMatch [ ] > matches ) ;
831
+ this . getFolderMatch ( matches [ 0 ] . resource ) . remove ( < FileMatch [ ] > matches , userRemoved ) ;
831
832
} ) ;
832
833
833
834
if ( other . length ) {
834
- this . getFolderMatch ( other [ 0 ] . resource ) . remove ( < FileMatch [ ] > other ) ;
835
+ this . getFolderMatch ( other [ 0 ] . resource ) . remove ( < FileMatch [ ] > other , userRemoved ) ;
835
836
}
836
837
}
837
838
0 commit comments