Revert "Revert "Bump ripgrep""

This reverts commit 50976d6e15.
This commit is contained in:
Rob Lourens 2018-03-11 18:22:10 -07:00
parent 1c91b6ba4a
commit 0ebf6fc66f
4 changed files with 23 additions and 23 deletions

View file

@ -44,7 +44,7 @@
"vscode-chokidar": "1.6.2",
"vscode-debugprotocol": "1.27.0",
"vscode-nsfw": "1.0.17",
"vscode-ripgrep": "0.7.1-patch.0.1",
"vscode-ripgrep": "0.7.1-patch.1.1",
"vscode-textmate": "^3.2.0",
"vscode-xterm": "3.3.0-beta5",
"yauzl": "2.8.0"

View file

@ -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

@ -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

@ -5989,9 +5989,9 @@ vscode-nsfw@1.0.17:
nan "^2.0.0"
promisify-node "^0.3.0"
vscode-ripgrep@0.7.1-patch.0.1:
version "0.7.1-patch.0.1"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-0.7.1-patch.0.1.tgz#f05d2f093fd7f6a9d10fb935171e72620feaf999"
vscode-ripgrep@0.7.1-patch.1.1:
version "0.7.1-patch.1.1"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-0.7.1-patch.1.1.tgz#d5fd19979998ccd040fd54c144c4190135e9e5c2"
vscode-textmate@^3.2.0:
version "3.2.0"