Skip to content

Commit 109add7

Browse files
committed
Fix search tests after strictPropInit
1 parent e8fc7db commit 109add7

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/vs/workbench/services/search/node/fileSearch.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ export class FileWalker {
318318
if (err || last) {
319319
onData = () => { };
320320

321-
this.cmdSW!.stop();
321+
if (this.cmdSW) {
322+
this.cmdSW.stop();
323+
}
322324
}
323325
cb(err, stdout, last);
324326
};

src/vs/workbench/services/search/node/textSearchManager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as path from 'vs/base/common/path';
77
import { mapArrayOrNot } from 'vs/base/common/arrays';
88
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
99
import { toErrorMessage } from 'vs/base/common/errorMessage';
10+
import * as resources from 'vs/base/common/resources';
1011
import * as glob from 'vs/base/common/glob';
1112
import { URI } from 'vs/base/common/uri';
1213
import { 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

Comments
 (0)