Skip to content

Commit 191ecb9

Browse files
author
Benjamin Pasero
committed
Revert "Fix rawSearchService to handle maxResults=0 correctly"
This reverts commit 5f36b0e.
1 parent bfa3db2 commit 191ecb9

2 files changed

Lines changed: 1 addition & 20 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export class SearchService implements IRawSearchService {
254254
const query = prepareQuery(config.filePattern || '');
255255
const compare = (matchA: IRawFileMatch, matchB: IRawFileMatch) => compareItemsByScore(matchA, matchB, query, true, FileMatchItemAccessor, scorerCache);
256256

257-
const maxResults = typeof config.maxResults === 'number' ? config.maxResults : Number.MAX_VALUE;
257+
const maxResults = config.maxResults || Number.MAX_VALUE;
258258
return arrays.topAsync(results, compare, maxResults, 10000, token);
259259
}
260260

src/vs/workbench/services/search/test/node/rawSearchService.test.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,6 @@ suite('RawSearchService', () => {
185185
assert.strictEqual(result.results.length, 1, 'Result');
186186
});
187187

188-
test('Handles maxResults=0 correctly', async function () {
189-
this.timeout(testTimeout);
190-
const service = new RawSearchService();
191-
192-
const query: IFileQuery = {
193-
type: QueryType.File,
194-
folderQueries: MULTIROOT_QUERIES,
195-
maxResults: 0,
196-
sortByScore: true,
197-
includePattern: {
198-
'*.txt': true,
199-
'*.js': true
200-
},
201-
};
202-
203-
const result = await DiskSearch.collectResultsFromEvent(service.fileSearch(query));
204-
assert.strictEqual(result.results.length, 0, 'Result');
205-
});
206-
207188
test('Multi-root with include pattern and exists', async function () {
208189
this.timeout(testTimeout);
209190
const service = new RawSearchService();

0 commit comments

Comments
 (0)