提交 727a838c 编写于 作者: R Rob Lourens

Bump ripgrep

上级 8e788534
...@@ -164,11 +164,11 @@ export function rgErrorMsgForDisplay(msg: string): string | undefined { ...@@ -164,11 +164,11 @@ export function rgErrorMsgForDisplay(msg: string): string | undefined {
} }
export class RipgrepParser extends EventEmitter { export class RipgrepParser extends EventEmitter {
private static readonly RESULT_REGEX = /^\u001b\[m(\d+)\u001b\[m:(.*)(\r?)/; private static readonly RESULT_REGEX = /^\u001b\[0m(\d+)\u001b\[0m:(.*)(\r?)/;
private static readonly FILE_REGEX = /^\u001b\[m(.+)\u001b\[m$/; private static readonly FILE_REGEX = /^\u001b\[0m(.+)\u001b\[0m$/;
public static readonly MATCH_START_MARKER = '\u001b[m\u001b[31m'; public static readonly MATCH_START_MARKER = '\u001b[0m\u001b[31m';
public static readonly MATCH_END_MARKER = '\u001b[m'; public static readonly MATCH_END_MARKER = '\u001b[0m';
private fileMatch: FileMatch; private fileMatch: FileMatch;
private remainder: string; private remainder: string;
......
...@@ -20,11 +20,11 @@ suite('RipgrepParser', () => { ...@@ -20,11 +20,11 @@ suite('RipgrepParser', () => {
const fileSectionEnd = '\n'; const fileSectionEnd = '\n';
function getFileLine(relativePath: string): string { function getFileLine(relativePath: string): string {
return `\u001b\[m${relativePath}\u001b\[m`; return `\u001b\[0m${relativePath}\u001b\[0m`;
} }
function getMatchLine(lineNum: number, matchParts: string[]): string { 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()}`; `${matchParts.shift()}${RipgrepParser.MATCH_START_MARKER}${matchParts.shift()}${RipgrepParser.MATCH_END_MARKER}${matchParts.shift()}`;
while (matchParts.length) { while (matchParts.length) {
...@@ -156,21 +156,21 @@ suite('RipgrepParser', () => { ...@@ -156,21 +156,21 @@ suite('RipgrepParser', () => {
}); });
test('Parses chunks broken in the middle of a multibyte character', () => { test('Parses chunks broken in the middle of a multibyte character', () => {
const multibyteStr = ''; const text = getFileLine('foo/bar') + '\n' + getMatchLine(0, ['before漢', 'match', 'after']) + '\n';
const multibyteBuf = new Buffer(multibyteStr); const buf = new Buffer(text);
const text = getFileLine('foo/bar') + '\n' + getMatchLine(0, ['before', 'match', 'after']) + '\n';
// Split the buffer at every possible position - it should still be parsed correctly
// Split the multibyte char into two pieces and divide between the two buffers for (let i = 0; i < buf.length; i++) {
const beforeIndex = 24; const inputBufs = [
const inputBufs = [ buf.slice(0, i),
Buffer.concat([new Buffer(text.substr(0, beforeIndex)), multibyteBuf.slice(0, 2)]), buf.slice(i)
Buffer.concat([multibyteBuf.slice(2), new Buffer(text.substr(beforeIndex))]) ];
];
const results = parseInput(inputBufs);
const results = parseInput(inputBufs); assert.equal(results.length, 1);
assert.equal(results.length, 1); assert.equal(results[0].lineMatches.length, 1);
assert.equal(results[0].lineMatches.length, 1); assert.deepEqual(results[0].lineMatches[0].offsetAndLengths, [[7, 5]]);
assert.deepEqual(results[0].lineMatches[0].offsetAndLengths, [[7, 5]]); }
}); });
}); });
......
...@@ -5992,9 +5992,9 @@ vscode-nls-dev@3.0.7: ...@@ -5992,9 +5992,9 @@ vscode-nls-dev@3.0.7:
xml2js "^0.4.19" xml2js "^0.4.19"
yargs "^10.1.1" yargs "^10.1.1"
vscode-ripgrep@^0.7.1-patch.0: vscode-ripgrep@0.7.1-patch.1.1:
version "0.7.1-patch.0" version "0.7.1-patch.1.1"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-0.7.1-patch.0.tgz#738be8b6da5cb9a8807b528595a884b0dfcb60a5" resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-0.7.1-patch.1.1.tgz#d5fd19979998ccd040fd54c144c4190135e9e5c2"
vscode-textmate@^3.2.0: vscode-textmate@^3.2.0:
version "3.2.0" version "3.2.0"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册