@@ -7,6 +7,7 @@ import * as path from 'vs/base/common/path';
77import { mapArrayOrNot } from 'vs/base/common/arrays' ;
88import { CancellationToken , CancellationTokenSource } from 'vs/base/common/cancellation' ;
99import { toErrorMessage } from 'vs/base/common/errorMessage' ;
10+ import * as resources from 'vs/base/common/resources' ;
1011import * as glob from 'vs/base/common/glob' ;
1112import { URI } from 'vs/base/common/uri' ;
1213import { toCanonicalName } from 'vs/base/node/encoding' ;
@@ -198,6 +199,7 @@ export class TextSearchResultsCollector {
198199 private _batchedCollector : BatchedCollector < IFileMatch > ;
199200
200201 private _currentFolderIdx : number = - 1 ;
202+ private _currentUri : URI ;
201203 private _currentFileMatch : IFileMatch | null = null ;
202204
203205 constructor ( private _onResult : ( result : IFileMatch [ ] ) => void ) {
@@ -208,7 +210,7 @@ export class TextSearchResultsCollector {
208210 // Collects TextSearchResults into IInternalFileMatches and collates using BatchedCollector.
209211 // This is efficient for ripgrep which sends results back one file at a time. It wouldn't be efficient for other search
210212 // providers that send results in random order. We could do this step afterwards instead.
211- if ( this . _currentFileMatch && this . _currentFolderIdx !== folderIdx ) {
213+ if ( this . _currentFileMatch && ( this . _currentFolderIdx !== folderIdx || ! resources . isEqual ( this . _currentUri , data . uri ) ) ) {
212214 this . pushToCollector ( ) ;
213215 this . _currentFileMatch = null ;
214216 }
0 commit comments