Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -8,22 +8,22 @@
import * as childProcess from 'child_process';
import { StringDecoder, NodeStringDecoder } from 'string_decoder';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import fs = require('fs');
import path = require('path');
import * as fs from 'fs';
import * as path from 'path';
import { isEqualOrParent } from 'vs/base/common/paths';
import { Readable } from 'stream';
import { TPromise } from 'vs/base/common/winjs.base';
import objects = require('vs/base/common/objects');
import arrays = require('vs/base/common/arrays');
import platform = require('vs/base/common/platform');
import strings = require('vs/base/common/strings');
import types = require('vs/base/common/types');
import glob = require('vs/base/common/glob');
import * as objects from 'vs/base/common/objects';
import * as arrays from 'vs/base/common/arrays';
import * as platform from 'vs/base/common/platform';
import * as strings from 'vs/base/common/strings';
import * as types from 'vs/base/common/types';
import * as glob from 'vs/base/common/glob';
import { IProgress, IUncachedSearchStats } from 'vs/platform/search/common/search';
import extfs = require('vs/base/node/extfs');
import flow = require('vs/base/node/flow');
import * as extfs from 'vs/base/node/extfs';
import * as flow from 'vs/base/node/flow';
import { IRawFileMatch, ISerializedSearchComplete, IRawSearch, ISearchEngine, IFolderSearch } from './search';
import { spawnRipgrepCmd } from './ripgrepFileSearch';
import { rgErrorMsgForDisplay } from './ripgrepTextSearch';

View File

@@ -5,15 +5,15 @@
'use strict';
import fs = require('fs');
import { isAbsolute, sep } from 'path';
import * as fs from 'fs';
import { isAbsolute, sep, join } from 'path';
import gracefulFs = require('graceful-fs');
import * as gracefulFs from 'graceful-fs';
gracefulFs.gracefulify(fs);
import arrays = require('vs/base/common/arrays');
import objects = require('vs/base/common/objects');
import strings = require('vs/base/common/strings');
import * as arrays from 'vs/base/common/arrays';
import * as objects from 'vs/base/common/objects';
import * as strings from 'vs/base/common/strings';
import { PPromise, TPromise } from 'vs/base/common/winjs.base';
import { FileWalker, Engine as FileSearchEngine } from 'vs/workbench/services/search/node/fileSearch';
import { MAX_FILE_SIZE } from 'vs/platform/files/node/files';
@@ -22,7 +22,6 @@ import { Engine as TextSearchEngine } from 'vs/workbench/services/search/node/te
import { TextSearchWorkerProvider } from 'vs/workbench/services/search/node/textSearchWorkerProvider';
import { IRawSearchService, IRawSearch, IRawFileMatch, ISerializedFileMatch, ISerializedSearchProgressItem, ISerializedSearchComplete, ISearchEngine, IFileSearchProgressItem, ITelemetryEvent } from './search';
import { ICachedSearchStats, IProgress } from 'vs/platform/search/common/search';
import { fuzzyContains } from 'vs/base/common/strings';
import { compareItemsByScore, IItemAccessor, ScorerCache, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
export class SearchService implements IRawSearchService {
@@ -133,7 +132,7 @@ export class SearchService implements IRawSearchService {
}
private rawMatchToSearchItem(match: IRawFileMatch): ISerializedFileMatch {
return { path: match.base ? [match.base, match.relativePath].join(sep) : match.relativePath };
return { path: match.base ? join(match.base, match.relativePath) : match.relativePath };
}
private doSortedSearch(engine: ISearchEngine<IRawFileMatch>, config: IRawSearch): PPromise<[ISerializedSearchComplete, IRawFileMatch[]], IProgress> {
@@ -144,6 +143,7 @@ export class SearchService implements IRawSearchService {
.then(result => {
c([result, results]);
if (this.telemetryPipe) {
// __GDPR__TODO__ classify event
this.telemetryPipe({
eventName: 'fileSearch',
data: result.stats
@@ -310,7 +310,7 @@ export class SearchService implements IRawSearchService {
let entry = cachedEntries[i];
// Check if this entry is a match for the search value
if (!fuzzyContains(entry.relativePath, normalizedSearchValueLowercase)) {
if (!strings.fuzzyContains(entry.relativePath, normalizedSearchValueLowercase)) {
continue;
}

View File

@@ -32,14 +32,29 @@ function getRgArgs(config: IRawSearch, folderQuery: IFolderSearch, includePatter
// includePattern can't have siblingClauses
foldersToIncludeGlobs([folderQuery], includePattern, false).forEach(globArg => {
args.push('-g', anchor(isMac ? normalizeNFD(globArg) : globArg));
const inclusion = anchor(globArg);
args.push('-g', inclusion);
if (isMac) {
const normalized = normalizeNFD(inclusion);
if (normalized !== inclusion) {
args.push('-g', normalized);
}
}
});
let siblingClauses: glob.IExpression;
const rgGlobs = foldersToRgExcludeGlobs([folderQuery], excludePattern, undefined, false);
rgGlobs.globArgs
.forEach(rgGlob => args.push('-g', `!${anchor(isMac ? normalizeNFD(rgGlob) : rgGlob)}`));
rgGlobs.globArgs.forEach(globArg => {
const exclusion = `!${anchor(globArg)}`;
args.push('-g', exclusion);
if (isMac) {
const normalized = normalizeNFD(exclusion);
if (normalized !== exclusion) {
args.push('-g', normalized);
}
}
});
siblingClauses = rgGlobs.siblingClauses;
if (folderQuery.disregardIgnoreFiles !== false) {

View File

@@ -11,8 +11,8 @@ import { StringDecoder, NodeStringDecoder } from 'string_decoder';
import * as cp from 'child_process';
import { rgPath } from 'vscode-ripgrep';
import objects = require('vs/base/common/objects');
import platform = require('vs/base/common/platform');
import * as objects from 'vs/base/common/objects';
import * as platform from 'vs/base/common/platform';
import * as strings from 'vs/base/common/strings';
import * as paths from 'vs/base/common/paths';
import * as extfs from 'vs/base/node/extfs';
@@ -29,7 +29,7 @@ const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.u
export class RipgrepEngine {
private isDone = false;
private rgProc: cp.ChildProcess;
private killRgProcFn: Function;
private killRgProcFn: (code?: number) => void;
private postProcessExclusions: glob.ParsedExpression;
private ripgrepParser: RipgrepParser;
@@ -169,11 +169,11 @@ export function rgErrorMsgForDisplay(msg: string): string | undefined {
}
export class RipgrepParser extends EventEmitter {
private static readonly RESULT_REGEX = /^\u001b\[m(\d+)\u001b\[m:(.*)(\r?)/;
private static readonly FILE_REGEX = /^\u001b\[m(.+)\u001b\[m$/;
private static readonly RESULT_REGEX = /^\u001b\[0m(\d+)\u001b\[0m:(.*)(\r?)/;
private static readonly FILE_REGEX = /^\u001b\[0m(.+)\u001b\[0m$/;
public static readonly MATCH_START_MARKER = '\u001b[m\u001b[31m';
public static readonly MATCH_END_MARKER = '\u001b[m';
public static readonly MATCH_START_MARKER = '\u001b[0m\u001b[31m';
public static readonly MATCH_END_MARKER = '\u001b[0m';
private fileMatch: FileMatch;
private remainder: string;

View File

@@ -6,8 +6,8 @@
import { PPromise, TPromise } from 'vs/base/common/winjs.base';
import uri from 'vs/base/common/uri';
import objects = require('vs/base/common/objects');
import strings = require('vs/base/common/strings');
import * as objects from 'vs/base/common/objects';
import * as strings from 'vs/base/common/strings';
import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc';
import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp';
import { IProgress, LineMatch, FileMatch, ISearchComplete, ISearchProgressItem, QueryType, IFileMatch, ISearchQuery, IFolderQuery, ISearchConfiguration, ISearchService, pathIncludedInQuery, ISearchResultProvider } from 'vs/platform/search/common/search';

View File

@@ -6,16 +6,14 @@
'use strict';
import * as fs from 'fs';
import gracefulFs = require('graceful-fs');
import * as gracefulFs from 'graceful-fs';
gracefulFs.gracefulify(fs);
import { onUnexpectedError } from 'vs/base/common/errors';
import * as strings from 'vs/base/common/strings';
import { TPromise } from 'vs/base/common/winjs.base';
import { LineMatch, FileMatch } from '../search';
import * as baseMime from 'vs/base/common/mime';
import { UTF16le, UTF16be, UTF8, UTF8_with_bom, encodingExists, decode, bomLength } from 'vs/base/node/encoding';
import { detectMimeAndEncodingFromBuffer } from 'vs/base/node/mime';
import { UTF16le, UTF16be, UTF8, UTF8_with_bom, encodingExists, decode, bomLength, detectEncodingFromBuffer } from 'vs/base/node/encoding';
import { ISearchWorker, ISearchWorkerSearchArgs, ISearchWorkerSearchResult } from './searchWorkerIpc';
@@ -208,13 +206,13 @@ export class SearchWorkerEngine {
// Detect encoding and mime when this is the beginning of the file
if (isFirstRead) {
const mimeAndEncoding = detectMimeAndEncodingFromBuffer({ buffer, bytesRead }, false);
if (mimeAndEncoding.mimes[mimeAndEncoding.mimes.length - 1] !== baseMime.MIME_TEXT) {
const detected = detectEncodingFromBuffer({ buffer, bytesRead }, false);
if (detected.seemsBinary) {
return clb(null); // skip files that seem binary
}
// Check for BOM offset
switch (mimeAndEncoding.encoding) {
switch (detected.encoding) {
case UTF8:
pos = i = bomLength(UTF8);
options.encoding = UTF8;

View File

@@ -5,11 +5,11 @@
'use strict';
import path = require('path');
import assert = require('assert');
import * as path from 'path';
import * as assert from 'assert';
import * as arrays from 'vs/base/common/arrays';
import platform = require('vs/base/common/platform');
import * as platform from 'vs/base/common/platform';
import { RipgrepParser, getAbsoluteGlob, fixDriveC } from 'vs/workbench/services/search/node/ripgrepTextSearch';
import { ISerializedFileMatch } from 'vs/workbench/services/search/node/search';
@@ -20,11 +20,11 @@ suite('RipgrepParser', () => {
const fileSectionEnd = '\n';
function getFileLine(relativePath: string): string {
return `\u001b\[m${relativePath}\u001b\[m`;
return `\u001b\[0m${relativePath}\u001b\[0m`;
}
function getMatchLine(lineNum: number, matchParts: string[]): string {
let matchLine = `\u001b\[m${lineNum}\u001b\[m:` +
let matchLine = `\u001b\[0m${lineNum}\u001b\[0m:` +
`${matchParts.shift()}${RipgrepParser.MATCH_START_MARKER}${matchParts.shift()}${RipgrepParser.MATCH_END_MARKER}${matchParts.shift()}`;
while (matchParts.length) {
@@ -156,21 +156,21 @@ suite('RipgrepParser', () => {
});
test('Parses chunks broken in the middle of a multibyte character', () => {
const multibyteStr = '';
const multibyteBuf = Buffer.from(multibyteStr);
const text = getFileLine('foo/bar') + '\n' + getMatchLine(0, ['before', 'match', 'after']) + '\n';
const text = getFileLine('foo/bar') + '\n' + getMatchLine(0, ['before漢', 'match', 'after']) + '\n';
const buf = new Buffer(text);
// Split the multibyte char into two pieces and divide between the two buffers
const beforeIndex = 24;
const inputBufs = [
Buffer.concat([Buffer.from(text.substr(0, beforeIndex)), multibyteBuf.slice(0, 2)]),
Buffer.concat([multibyteBuf.slice(2), Buffer.from(text.substr(beforeIndex))])
];
// Split the buffer at every possible position - it should still be parsed correctly
for (let i = 0; i < buf.length; i++) {
const inputBufs = [
buf.slice(0, i),
buf.slice(i)
];
const results = parseInput(inputBufs);
assert.equal(results.length, 1);
assert.equal(results[0].lineMatches.length, 1);
assert.deepEqual(results[0].lineMatches[0].offsetAndLengths, [[7, 5]]);
const results = parseInput(inputBufs);
assert.equal(results.length, 1);
assert.equal(results[0].lineMatches.length, 1);
assert.deepEqual(results[0].lineMatches[0].offsetAndLengths, [[7, 5]]);
}
});
});

View File

@@ -5,8 +5,8 @@
'use strict';
import path = require('path');
import assert = require('assert');
import * as path from 'path';
import * as assert from 'assert';
import { join, normalize } from 'vs/base/common/paths';
import * as platform from 'vs/base/common/platform';
@@ -483,6 +483,26 @@ suite('FileSearchEngine', () => {
});
});
test('Files: *.* include with unicode', function (done: () => void) {
this.timeout(testTimeout);
let engine = new FileSearchEngine({
folderQueries: ROOT_FOLDER_QUERY,
filePattern: '*.*',
includePattern: { '**/üm laut汉语/*': true }
});
let count = 0;
engine.search((result) => {
if (result) {
count++;
}
}, () => { }, (error) => {
assert.ok(!error);
assert.equal(count, 1);
done();
});
});
test('Files: multiroot with exclude', function (done: () => void) {
this.timeout(testTimeout);
const folderQueries: IFolderSearch[] = [

View File

@@ -6,8 +6,7 @@
'use strict';
import * as assert from 'assert';
import { normalize } from 'path';
import path = require('path');
import * as path from 'path';
import { IProgress, IUncachedSearchStats } from 'vs/platform/search/common/search';
import { ISearchEngine, IRawSearch, IRawFileMatch, ISerializedFileMatch, ISerializedSearchComplete, IFolderSearch } from 'vs/workbench/services/search/node/search';
@@ -15,7 +14,7 @@ import { SearchService as RawSearchService } from 'vs/workbench/services/search/
import { DiskSearch } from 'vs/workbench/services/search/node/searchService';
const TEST_FOLDER_QUERIES = [
{ folder: normalize('/some/where') }
{ folder: path.normalize('/some/where') }
];
const TEST_FIXTURES = path.normalize(require.toUrl('./fixtures'));
@@ -85,14 +84,14 @@ suite('SearchService', () => {
};
const rawMatch: IRawFileMatch = {
base: normalize('/some'),
base: path.normalize('/some'),
relativePath: 'where',
basename: 'where',
size: 123
};
const match: ISerializedFileMatch = {
path: normalize('/some/where')
path: path.normalize('/some/where')
};
test('Individual results', function () {
@@ -110,7 +109,7 @@ suite('SearchService', () => {
assert.deepStrictEqual(value, match);
results++;
} else {
assert.fail(value);
assert.fail(JSON.stringify(value));
}
});
});
@@ -132,7 +131,7 @@ suite('SearchService', () => {
});
results.push(value.length);
} else {
assert.fail(value);
assert.fail(JSON.stringify(value));
}
});
});
@@ -198,7 +197,7 @@ suite('SearchService', () => {
this.timeout(testTimeout);
const paths = ['bab', 'bbc', 'abb'];
const matches: IRawFileMatch[] = paths.map(relativePath => ({
base: normalize('/some/where'),
base: path.normalize('/some/where'),
relativePath,
basename: relativePath,
size: 3
@@ -214,12 +213,12 @@ suite('SearchService', () => {
maxResults: 2
}, 1).then(() => {
assert.notStrictEqual(typeof TestSearchEngine.last.config.maxResults, 'number');
assert.deepStrictEqual(results, [normalize('/some/where/bbc'), normalize('/some/where/bab')]);
assert.deepStrictEqual(results, [path.normalize('/some/where/bbc'), path.normalize('/some/where/bab')]);
}, null, value => {
if (Array.isArray(value)) {
results.push(...value.map(v => v.path));
} else {
assert.fail(value);
assert.fail(JSON.stringify(value));
}
});
});
@@ -246,7 +245,7 @@ suite('SearchService', () => {
});
results.push(value.length);
} else {
assert.fail(value);
assert.fail(JSON.stringify(value));
}
});
});
@@ -255,7 +254,7 @@ suite('SearchService', () => {
this.timeout(testTimeout);
const paths = ['bcb', 'bbc', 'aab'];
const matches: IRawFileMatch[] = paths.map(relativePath => ({
base: normalize('/some/where'),
base: path.normalize('/some/where'),
relativePath,
basename: relativePath,
size: 3
@@ -271,12 +270,12 @@ suite('SearchService', () => {
cacheKey: 'x'
}, -1).then(complete => {
assert.strictEqual(complete.stats.fromCache, false);
assert.deepStrictEqual(results, [normalize('/some/where/bcb'), normalize('/some/where/bbc'), normalize('/some/where/aab')]);
assert.deepStrictEqual(results, [path.normalize('/some/where/bcb'), path.normalize('/some/where/bbc'), path.normalize('/some/where/aab')]);
}, null, value => {
if (Array.isArray(value)) {
results.push(...value.map(v => v.path));
} else {
assert.fail(value);
assert.fail(JSON.stringify(value));
}
}).then(() => {
const results = [];
@@ -287,19 +286,19 @@ suite('SearchService', () => {
cacheKey: 'x'
}, -1).then(complete => {
assert.ok(complete.stats.fromCache);
assert.deepStrictEqual(results, [normalize('/some/where/bcb'), normalize('/some/where/bbc')]);
assert.deepStrictEqual(results, [path.normalize('/some/where/bcb'), path.normalize('/some/where/bbc')]);
}, null, value => {
if (Array.isArray(value)) {
results.push(...value.map(v => v.path));
} else {
assert.fail(value);
assert.fail(JSON.stringify(value));
}
});
}).then(() => {
return service.clearCache('x');
}).then(() => {
matches.push({
base: normalize('/some/where'),
base: path.normalize('/some/where'),
relativePath: 'bc',
basename: 'bc',
size: 3
@@ -312,12 +311,12 @@ suite('SearchService', () => {
cacheKey: 'x'
}, -1).then(complete => {
assert.strictEqual(complete.stats.fromCache, false);
assert.deepStrictEqual(results, [normalize('/some/where/bc')]);
assert.deepStrictEqual(results, [path.normalize('/some/where/bc')]);
}, null, value => {
if (Array.isArray(value)) {
results.push(...value.map(v => v.path));
} else {
assert.fail(value);
assert.fail(JSON.stringify(value));
}
});
});

View File

@@ -5,8 +5,8 @@
'use strict';
import path = require('path');
import assert = require('assert');
import * as path from 'path';
import * as assert from 'assert';
import * as glob from 'vs/base/common/glob';
import { TPromise } from 'vs/base/common/winjs.base';
@@ -87,128 +87,127 @@ function doRipgrepSearchTest(config: IRawSearch, expectedResultCount: number | F
});
}
function doSearchTest(config: IRawSearch, expectedResultCount: number, done) {
function doSearchTest(config: IRawSearch, expectedResultCount: number) {
return doLegacySearchTest(config, expectedResultCount)
.then(() => doRipgrepSearchTest(config, expectedResultCount))
.then(done, done);
.then(() => doRipgrepSearchTest(config, expectedResultCount));
}
suite('Search-integration', function () {
this.timeout(1000 * 60); // increase timeout for this suite
test('Text: GameOfLife', function (done: () => void) {
test('Text: GameOfLife', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'GameOfLife' },
};
doSearchTest(config, 4, done);
return doSearchTest(config, 4);
});
test('Text: GameOfLife (RegExp)', function (done: () => void) {
test('Text: GameOfLife (RegExp)', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'Game.?fL\\w?fe', isRegExp: true }
};
doSearchTest(config, 4, done);
return doSearchTest(config, 4);
});
test('Text: GameOfLife (RegExp to EOL)', function (done: () => void) {
test('Text: GameOfLife (RegExp to EOL)', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'GameOfLife.*', isRegExp: true }
};
doSearchTest(config, 4, done);
return doSearchTest(config, 4);
});
test('Text: GameOfLife (Word Match, Case Sensitive)', function (done: () => void) {
test('Text: GameOfLife (Word Match, Case Sensitive)', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'GameOfLife', isWordMatch: true, isCaseSensitive: true }
};
doSearchTest(config, 4, done);
return doSearchTest(config, 4);
});
test('Text: GameOfLife (Word Match, Spaces)', function (done: () => void) {
test('Text: GameOfLife (Word Match, Spaces)', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: ' GameOfLife ', isWordMatch: true }
};
doSearchTest(config, 1, done);
return doSearchTest(config, 1);
});
test('Text: GameOfLife (Word Match, Punctuation and Spaces)', function (done: () => void) {
test('Text: GameOfLife (Word Match, Punctuation and Spaces)', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: ', as =', isWordMatch: true }
};
doSearchTest(config, 1, done);
return doSearchTest(config, 1);
});
test('Text: Helvetica (UTF 16)', function (done: () => void) {
test('Text: Helvetica (UTF 16)', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'Helvetica' }
};
doSearchTest(config, 3, done);
return doSearchTest(config, 3);
});
test('Text: e', function (done: () => void) {
test('Text: e', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'e' }
};
doSearchTest(config, 776, done);
return doSearchTest(config, 776);
});
test('Text: e (with excludes)', function (done: () => void) {
test('Text: e (with excludes)', () => {
const config: any = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'e' },
excludePattern: { '**/examples': true }
};
doSearchTest(config, 394, done);
return doSearchTest(config, 394);
});
test('Text: e (with includes)', function (done: () => void) {
test('Text: e (with includes)', () => {
const config: any = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'e' },
includePattern: { '**/examples/**': true }
};
doSearchTest(config, 382, done);
return doSearchTest(config, 382);
});
test('Text: e (with absolute path excludes)', function (done: () => void) {
test('Text: e (with absolute path excludes)', () => {
const config: any = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'e' },
excludePattern: makeExpression(path.join(TEST_FIXTURES, '**/examples'))
};
doSearchTest(config, 394, done);
return doSearchTest(config, 394);
});
test('Text: e (with mixed absolute/relative path excludes)', function (done: () => void) {
test('Text: e (with mixed absolute/relative path excludes)', () => {
const config: any = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'e' },
excludePattern: makeExpression(path.join(TEST_FIXTURES, '**/examples'), '*.css')
};
doSearchTest(config, 310, done);
return doSearchTest(config, 310);
});
test('Text: sibling exclude', function (done: () => void) {
test('Text: sibling exclude', () => {
const config: any = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'm' },
@@ -216,10 +215,10 @@ suite('Search-integration', function () {
excludePattern: { '*.css': { when: '$(basename).less' } }
};
doSearchTest(config, 1, done);
return doSearchTest(config, 1);
});
test('Text: e (with includes and exclude)', function (done: () => void) {
test('Text: e (with includes and exclude)', () => {
const config: any = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'e' },
@@ -227,10 +226,10 @@ suite('Search-integration', function () {
excludePattern: { '**/examples/small.js': true }
};
doSearchTest(config, 361, done);
return doSearchTest(config, 361);
});
test('Text: a (capped)', function (done: () => void) {
test('Text: a (capped)', () => {
const maxResults = 520;
const config = {
folderQueries: ROOT_FOLDER_QUERY,
@@ -241,58 +240,57 @@ suite('Search-integration', function () {
// (Legacy) search can go over the maxResults because it doesn't trim the results from its worker processes to the exact max size.
// But the worst-case scenario should be 2*max-1
return doLegacySearchTest(config, count => count < maxResults * 2)
.then(() => doRipgrepSearchTest(config, maxResults))
.then(done, done);
.then(() => doRipgrepSearchTest(config, maxResults));
});
test('Text: a (no results)', function (done: () => void) {
test('Text: a (no results)', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'ahsogehtdas' }
};
doSearchTest(config, 0, done);
return doSearchTest(config, 0);
});
test('Text: -size', function (done: () => void) {
test('Text: -size', () => {
const config = {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: '-size' }
};
doSearchTest(config, 9, done);
return doSearchTest(config, 9);
});
test('Multiroot: Conway', function (done: () => void) {
test('Multiroot: Conway', () => {
const config: IRawSearch = {
folderQueries: MULTIROOT_QUERIES,
contentPattern: { pattern: 'conway' }
};
doSearchTest(config, 8, done);
return doSearchTest(config, 8);
});
test('Multiroot: e with partial global exclude', function (done: () => void) {
test('Multiroot: e with partial global exclude', () => {
const config: IRawSearch = {
folderQueries: MULTIROOT_QUERIES,
contentPattern: { pattern: 'e' },
excludePattern: makeExpression('**/*.txt')
};
doSearchTest(config, 382, done);
return doSearchTest(config, 382);
});
test('Multiroot: e with global excludes', function (done: () => void) {
test('Multiroot: e with global excludes', () => {
const config: IRawSearch = {
folderQueries: MULTIROOT_QUERIES,
contentPattern: { pattern: 'e' },
excludePattern: makeExpression('**/*.txt', '**/*.js')
};
doSearchTest(config, 0, done);
return doSearchTest(config, 0);
});
test('Multiroot: e with folder exclude', function (done: () => void) {
test('Multiroot: e with folder exclude', () => {
const config: IRawSearch = {
folderQueries: [
{ folder: EXAMPLES_FIXTURES, excludePattern: makeExpression('**/e*.js') },
@@ -301,7 +299,7 @@ suite('Search-integration', function () {
contentPattern: { pattern: 'e' }
};
doSearchTest(config, 286, done);
return doSearchTest(config, 286);
});
});