@@ -197,7 +197,7 @@ export class FileMatch extends Disposable implements IFileMatch {
197197 private _updateScheduler : RunOnceScheduler ;
198198 private _modelDecorations : string [ ] = [ ] ;
199199
200- constructor ( private _query : IPatternInfo , private _previewOptions : ITextSearchPreviewOptions , private _maxResults : number , private _parent : BaseFolderMatch , private rawMatch : IFileMatch ,
200+ constructor ( private _query : IPatternInfo , private _previewOptions : ITextSearchPreviewOptions , private _maxResults : number , private _parent : FolderMatch , private rawMatch : IFileMatch ,
201201 @IModelService private readonly modelService : IModelService , @IReplaceService private readonly replaceService : IReplaceService
202202 ) {
203203 super ( ) ;
@@ -322,7 +322,7 @@ export class FileMatch extends Disposable implements IFileMatch {
322322 return this . resource . toString ( ) ;
323323 }
324324
325- parent ( ) : BaseFolderMatch {
325+ parent ( ) : FolderMatch {
326326 return this . _parent ;
327327 }
328328
@@ -405,7 +405,7 @@ export interface IChangeEvent {
405405 removed ?: boolean ;
406406}
407407
408- export class BaseFolderMatch extends Disposable {
408+ export class FolderMatch extends Disposable {
409409
410410 private _onChange = this . _register ( new Emitter < IChangeEvent > ( ) ) ;
411411 readonly onChange : Event < IChangeEvent > = this . _onChange . event ;
@@ -458,10 +458,6 @@ export class BaseFolderMatch extends Disposable {
458458 return this . _parent ;
459459 }
460460
461- hasResource ( ) : boolean {
462- return ! ! this . _resource ;
463- }
464-
465461 bindModel ( model : ITextModel ) : void {
466462 const fileMatch = this . _fileMatches . get ( model . uri ) ;
467463 if ( fileMatch ) {
@@ -598,7 +594,7 @@ export class BaseFolderMatch extends Disposable {
598594 * BaseFolderMatch => optional resource ("other files" node)
599595 * FolderMatch => required resource (normal folder node)
600596 */
601- export class FolderMatch extends BaseFolderMatch {
597+ export class FolderMatchWithResource extends FolderMatch {
602598 constructor ( _resource : URI , _id : string , _index : number , _query : ITextQuery , _parent : SearchResult , _searchModel : SearchModel ,
603599 @IReplaceService replaceService : IReplaceService ,
604600 @IInstantiationService instantiationService : IInstantiationService
@@ -616,7 +612,7 @@ export class FolderMatch extends BaseFolderMatch {
616612 * and their sort order is undefined.
617613 */
618614export function searchMatchComparer ( elementA : RenderableMatch , elementB : RenderableMatch ) : number {
619- if ( elementA instanceof BaseFolderMatch && elementB instanceof BaseFolderMatch ) {
615+ if ( elementA instanceof FolderMatch && elementB instanceof FolderMatch ) {
620616 return elementA . index ( ) - elementB . index ( ) ;
621617 }
622618
@@ -636,9 +632,9 @@ export class SearchResult extends Disposable {
636632 private _onChange = this . _register ( new Emitter < IChangeEvent > ( ) ) ;
637633 readonly onChange : Event < IChangeEvent > = this . _onChange . event ;
638634
639- private _folderMatches : FolderMatch [ ] = [ ] ;
640- private _otherFilesMatch : BaseFolderMatch ;
641- private _folderMatchesMap : TernarySearchTree < FolderMatch > = TernarySearchTree . forPaths < FolderMatch > ( ) ;
635+ private _folderMatches : FolderMatchWithResource [ ] = [ ] ;
636+ private _otherFilesMatch : FolderMatch ;
637+ private _folderMatchesMap : TernarySearchTree < FolderMatchWithResource > = TernarySearchTree . forPaths < FolderMatchWithResource > ( ) ;
642638 private _showHighlights : boolean ;
643639 private _query : ITextQuery ;
644640
@@ -666,7 +662,7 @@ export class SearchResult extends Disposable {
666662 this . clear ( ) ;
667663 this . _folderMatches = ( query . folderQueries || [ ] )
668664 . map ( fq => fq . folder )
669- . map ( ( resource , index ) => this . createFolderMatch ( resource , resource . toString ( ) , index , query ) ) ;
665+ . map ( ( resource , index ) => this . createFolderMatchWithResource ( resource , resource . toString ( ) , index , query ) ) ;
670666
671667 this . _folderMatches . forEach ( fm => this . _folderMatchesMap . set ( fm . resource . toString ( ) , fm ) ) ;
672668 this . _otherFilesMatch = this . createOtherFilesFolderMatch ( 'otherFiles' , this . _folderMatches . length + 1 , query ) ;
@@ -681,15 +677,15 @@ export class SearchResult extends Disposable {
681677 }
682678 }
683679
684- private createFolderMatch ( resource : URI , id : string , index : number , query : ITextQuery ) : FolderMatch {
685- return < FolderMatch > this . _createBaseFolderMatch ( FolderMatch , resource , id , index , query ) ;
680+ private createFolderMatchWithResource ( resource : URI , id : string , index : number , query : ITextQuery ) : FolderMatchWithResource {
681+ return < FolderMatchWithResource > this . _createBaseFolderMatch ( FolderMatchWithResource , resource , id , index , query ) ;
686682 }
687683
688- private createOtherFilesFolderMatch ( id : string , index : number , query : ITextQuery ) : BaseFolderMatch {
689- return this . _createBaseFolderMatch ( BaseFolderMatch , null , id , index , query ) ;
684+ private createOtherFilesFolderMatch ( id : string , index : number , query : ITextQuery ) : FolderMatch {
685+ return this . _createBaseFolderMatch ( FolderMatch , null , id , index , query ) ;
690686 }
691687
692- private _createBaseFolderMatch ( folderMatchClass : typeof BaseFolderMatch | typeof FolderMatch , resource : URI | null , id : string , index : number , query : ITextQuery ) : BaseFolderMatch {
688+ private _createBaseFolderMatch ( folderMatchClass : typeof FolderMatch | typeof FolderMatchWithResource , resource : URI | null , id : string , index : number , query : ITextQuery ) : FolderMatch {
693689 const folderMatch = this . instantiationService . createInstance ( folderMatchClass , resource , id , index , query , this , this . _searchModel ) ;
694690 const disposable = folderMatch . onChange ( ( event ) => this . _onChange . fire ( event ) ) ;
695691 folderMatch . onDispose ( ( ) => disposable . dispose ( ) ) ;
@@ -734,9 +730,9 @@ export class SearchResult extends Disposable {
734730 }
735731 } ) ;
736732
737- matches = matches . filter ( m => m instanceof FileMatch ) ;
733+ const fileMatches : FileMatch [ ] = matches . filter ( m => m instanceof FileMatch ) as FileMatch [ ] ;
738734
739- const { byFolder, other } = this . groupFilesByFolder ( matches ) ;
735+ const { byFolder, other } = this . groupFilesByFolder ( fileMatches ) ;
740736 byFolder . forEach ( matches => {
741737 if ( ! matches . length ) {
742738 return ;
@@ -774,7 +770,7 @@ export class SearchResult extends Disposable {
774770 } ) ;
775771 }
776772
777- folderMatches ( ) : BaseFolderMatch [ ] {
773+ folderMatches ( ) : FolderMatch [ ] {
778774 return this . _otherFilesMatch ?
779775 [
780776 ...this . _folderMatches ,
@@ -837,7 +833,7 @@ export class SearchResult extends Disposable {
837833 return this . _rangeHighlightDecorations ;
838834 }
839835
840- private getFolderMatch ( resource : URI ) : BaseFolderMatch {
836+ private getFolderMatch ( resource : URI ) : FolderMatch {
841837 const folderMatch = this . _folderMatchesMap . findSubstr ( resource . toString ( ) ) ;
842838 return folderMatch ? folderMatch : this . _otherFilesMatch ;
843839 }
@@ -877,7 +873,7 @@ export class SearchResult extends Disposable {
877873 private disposeMatches ( ) : void {
878874 this . folderMatches ( ) . forEach ( folderMatch => folderMatch . dispose ( ) ) ;
879875 this . _folderMatches = [ ] ;
880- this . _folderMatchesMap = TernarySearchTree . forPaths < FolderMatch > ( ) ;
876+ this . _folderMatchesMap = TernarySearchTree . forPaths < FolderMatchWithResource > ( ) ;
881877 this . _rangeHighlightDecorations . removeHighlightRange ( ) ;
882878 }
883879
@@ -1063,7 +1059,7 @@ export class SearchModel extends Disposable {
10631059
10641060export type FileMatchOrMatch = FileMatch | Match ;
10651061
1066- export type RenderableMatch = BaseFolderMatch | FolderMatch | FileMatch | Match ;
1062+ export type RenderableMatch = FolderMatch | FolderMatchWithResource | FileMatch | Match ;
10671063
10681064export class SearchWorkbenchService implements ISearchWorkbenchService {
10691065
0 commit comments