From 109add76dad3dd1cbe05215d26cb62be6dbfdc47 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 3 Sep 2019 15:31:44 -0700 Subject: [PATCH] Fix search tests after strictPropInit --- src/vs/workbench/services/search/node/fileSearch.ts | 4 +++- src/vs/workbench/services/search/node/textSearchManager.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/services/search/node/fileSearch.ts b/src/vs/workbench/services/search/node/fileSearch.ts index 8df60ae29c1..fc838b95e80 100644 --- a/src/vs/workbench/services/search/node/fileSearch.ts +++ b/src/vs/workbench/services/search/node/fileSearch.ts @@ -318,7 +318,9 @@ export class FileWalker { if (err || last) { onData = () => { }; - this.cmdSW!.stop(); + if (this.cmdSW) { + this.cmdSW.stop(); + } } cb(err, stdout, last); }; diff --git a/src/vs/workbench/services/search/node/textSearchManager.ts b/src/vs/workbench/services/search/node/textSearchManager.ts index d8f7674c7e5..9d566a9bdab 100644 --- a/src/vs/workbench/services/search/node/textSearchManager.ts +++ b/src/vs/workbench/services/search/node/textSearchManager.ts @@ -7,6 +7,7 @@ import * as path from 'vs/base/common/path'; import { mapArrayOrNot } from 'vs/base/common/arrays'; import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation'; import { toErrorMessage } from 'vs/base/common/errorMessage'; +import * as resources from 'vs/base/common/resources'; import * as glob from 'vs/base/common/glob'; import { URI } from 'vs/base/common/uri'; import { toCanonicalName } from 'vs/base/node/encoding'; @@ -198,6 +199,7 @@ export class TextSearchResultsCollector { private _batchedCollector: BatchedCollector; private _currentFolderIdx: number = -1; + private _currentUri: URI; private _currentFileMatch: IFileMatch | null = null; constructor(private _onResult: (result: IFileMatch[]) => void) { @@ -208,7 +210,7 @@ export class TextSearchResultsCollector { // Collects TextSearchResults into IInternalFileMatches and collates using BatchedCollector. // This is efficient for ripgrep which sends results back one file at a time. It wouldn't be efficient for other search // providers that send results in random order. We could do this step afterwards instead. - if (this._currentFileMatch && this._currentFolderIdx !== folderIdx) { + if (this._currentFileMatch && (this._currentFolderIdx !== folderIdx || !resources.isEqual(this._currentUri, data.uri))) { this.pushToCollector(); this._currentFileMatch = null; }