mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Add extra rg logging for #100373
This commit is contained in:
@@ -205,7 +205,7 @@ export class FileWalker {
|
||||
.map(arg => arg.match(/^-/) ? arg : `'${arg}'`)
|
||||
.join(' ');
|
||||
|
||||
let rgCmd = `rg ${escapedArgs}\n - cwd: ${ripgrep.cwd}`;
|
||||
let rgCmd = `${ripgrep.rgDiskPath} ${escapedArgs}\n - cwd: ${ripgrep.cwd}`;
|
||||
if (ripgrep.rgArgs.siblingClauses) {
|
||||
rgCmd += `\n - Sibling clauses: ${JSON.stringify(ripgrep.rgArgs.siblingClauses)}`;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export function spawnRipgrepCmd(config: IFileQuery, folderQuery: IFolderQuery, i
|
||||
const cwd = folderQuery.folder.fsPath;
|
||||
return {
|
||||
cmd: cp.spawn(rgDiskPath, rgArgs.args, { cwd }),
|
||||
rgDiskPath,
|
||||
siblingClauses: rgArgs.siblingClauses,
|
||||
rgArgs,
|
||||
cwd
|
||||
|
||||
@@ -44,7 +44,7 @@ export class RipgrepTextSearchEngine {
|
||||
const escapedArgs = rgArgs
|
||||
.map(arg => arg.match(/^-/) ? arg : `'${arg}'`)
|
||||
.join(' ');
|
||||
this.outputChannel.appendLine(`rg ${escapedArgs}\n - cwd: ${cwd}`);
|
||||
this.outputChannel.appendLine(`${rgDiskPath} ${escapedArgs}\n - cwd: ${cwd}`);
|
||||
|
||||
let rgProc: Maybe<cp.ChildProcess> = cp.spawn(rgDiskPath, rgArgs, { cwd });
|
||||
rgProc.on('error', e => {
|
||||
@@ -57,6 +57,7 @@ export class RipgrepTextSearchEngine {
|
||||
const ripgrepParser = new RipgrepParser(options.maxResults, cwd, options.previewOptions);
|
||||
ripgrepParser.on('result', (match: TextSearchResult) => {
|
||||
gotResult = true;
|
||||
dataWithoutResult = '';
|
||||
progress.report(match);
|
||||
});
|
||||
|
||||
@@ -79,8 +80,12 @@ export class RipgrepTextSearchEngine {
|
||||
cancel();
|
||||
});
|
||||
|
||||
let dataWithoutResult = '';
|
||||
rgProc.stdout!.on('data', data => {
|
||||
ripgrepParser.handleData(data);
|
||||
if (!gotResult) {
|
||||
dataWithoutResult += data;
|
||||
}
|
||||
});
|
||||
|
||||
let gotData = false;
|
||||
@@ -96,7 +101,12 @@ export class RipgrepTextSearchEngine {
|
||||
rgProc.on('close', () => {
|
||||
this.outputChannel.appendLine(gotData ? 'Got data from stdout' : 'No data from stdout');
|
||||
this.outputChannel.appendLine(gotResult ? 'Got result from parser' : 'No result from parser');
|
||||
if (dataWithoutResult) {
|
||||
this.outputChannel.appendLine(`Got data without result: ${dataWithoutResult}`);
|
||||
}
|
||||
|
||||
this.outputChannel.appendLine('');
|
||||
|
||||
if (isDone) {
|
||||
resolve({ limitHit });
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user