Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)

* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f

* fix various icon issues

* fix preview features
This commit is contained in:
Anthony Dresser
2019-09-19 21:50:52 -07:00
committed by GitHub
parent 9d3d64eef3
commit db498db0a8
459 changed files with 10195 additions and 7528 deletions

View File

@@ -125,7 +125,7 @@ export function rgErrorMsgForDisplay(msg: string): Maybe<SearchError> {
const firstLine = lines[0].trim();
if (lines.some(l => startsWith(l, 'regex parse error'))) {
return new SearchError('Regex parse error', SearchErrorCode.regexParseError);
return new SearchError(buildRegexParseError(lines), SearchErrorCode.regexParseError);
}
const match = firstLine.match(/grep config error: unknown encoding: (.*)/);
@@ -150,6 +150,21 @@ export function rgErrorMsgForDisplay(msg: string): Maybe<SearchError> {
return undefined;
}
export function buildRegexParseError(lines: string[]): string {
let errorMessage: string[] = ['Regex parse error'];
let pcre2ErrorLine = lines.filter(l => (startsWith(l, 'PCRE2:')));
if (pcre2ErrorLine.length >= 1) {
let pcre2ErrorMessage = pcre2ErrorLine[0].replace('PCRE2:', '');
if (pcre2ErrorMessage.indexOf(':') !== -1 && pcre2ErrorMessage.split(':').length >= 2) {
let pcre2ActualErrorMessage = pcre2ErrorMessage.split(':')[1];
errorMessage.push(':' + pcre2ActualErrorMessage);
}
}
return errorMessage.join('');
}
export class RipgrepParser extends EventEmitter {
private remainder = '';
private isDone = false;