Update ripgrep, enable --auto-hybrid-regex

Note, the invalid literal test is n/a with auto-hybrid-regex, it's ok because in vscode we would be in multiline mode in that case anyway
Fix #72459
This commit is contained in:
Rob Lourens 2019-07-02 11:08:50 -07:00
parent 2d6205a548
commit 85da8ee3f5
4 changed files with 11 additions and 25 deletions

View file

@ -49,7 +49,7 @@
"v8-inspect-profiler": "^0.0.20",
"vscode-chokidar": "1.6.5",
"vscode-proxy-agent": "0.4.0",
"vscode-ripgrep": "^1.2.5",
"vscode-ripgrep": "^1.3.1",
"vscode-sqlite3": "4.0.7",
"vscode-textmate": "^4.1.1",
"xterm": "3.15.0-beta50",

View file

@ -121,9 +121,10 @@ export class RipgrepTextSearchEngine {
* "failed" when a fatal error was produced.
*/
export function rgErrorMsgForDisplay(msg: string): Maybe<SearchError> {
const firstLine = msg.split('\n')[0].trim();
const lines = msg.split('\n');
const firstLine = lines[0].trim();
if (startsWith(firstLine, 'regex parse error')) {
if (lines.some(l => startsWith(l, 'regex parse error'))) {
return new SearchError('Regex parse error', SearchErrorCode.regexParseError);
}
@ -427,6 +428,7 @@ function getRgArgs(query: TextSearchQuery, options: TextSearchOptions): string[]
fixedRegexpQuery = fixRegexCRMatchingNonWordClass(fixedRegexpQuery, !!query.isMultiline);
fixedRegexpQuery = fixRegexCRMatchingWhitespaceClass(fixedRegexpQuery, !!query.isMultiline);
args.push('--regexp', fixedRegexpQuery);
args.push('--auto-hybrid-regex');
} else {
searchPatternAfterDoubleDashes = pattern;
args.push('--fixed-strings');

View file

@ -378,7 +378,7 @@ suite('Search-integration', function () {
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'foo' },
includePattern: {
'***': true
'{{}': true
}
};
@ -386,26 +386,10 @@ suite('Search-integration', function () {
throw new Error('expected fail');
}, err => {
const searchError = deserializeSearchError(err.message);
assert.equal(searchError.message, 'Error parsing glob \'***\': invalid use of **; must be one path component');
assert.equal(searchError.message, 'Error parsing glob \'/{{}\': nested alternate groups are not allowed');
assert.equal(searchError.code, SearchErrorCode.globParseError);
});
});
test('invalid literal', () => {
const config: ITextQuery = {
type: QueryType.Text,
folderQueries: ROOT_FOLDER_QUERY,
contentPattern: { pattern: 'foo\nbar', isRegExp: true }
};
return doSearchTest(config, 0).then(() => {
throw new Error('expected fail');
}, err => {
const searchError = deserializeSearchError(err.message);
assert.equal(searchError.message, 'The literal \'"\\n"\' is not allowed in a regex');
assert.equal(searchError.code, SearchErrorCode.invalidLiteral);
});
});
});
});

View file

@ -9490,10 +9490,10 @@ vscode-proxy-agent@0.4.0:
https-proxy-agent "2.2.1"
socks-proxy-agent "4.0.1"
vscode-ripgrep@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.2.5.tgz#2093c8f36d52bd2dab9eb45b003dd02533c5499c"
integrity sha512-n5XBm9od5hahpljw9T8wbkuMnAY7LlAG1OyEEtcCZEX9aCHFuBKSP0IcvciGRTbtWRovNuT83A2iRjt6PL3bLg==
vscode-ripgrep@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.3.1.tgz#51fb93debcd0c18a8b90dbc37f84f94333d0c486"
integrity sha512-4WLB/n4ZeWNi5AEzPTkfYrqbKtXlv0SlgmxbRVdulwZzGx/lfWeWPu9Shy32orM27IofQAQDuirbRBOYNJVzBA==
vscode-sqlite3@4.0.7:
version "4.0.7"