From 8dff81ed5518abed524c473a697a423653c7da18 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 20 Jul 2020 21:24:53 -0700 Subject: [PATCH] Add extra rg logging for #100373 --- src/vs/workbench/services/search/node/fileSearch.ts | 2 +- .../services/search/node/ripgrepFileSearch.ts | 1 + .../services/search/node/ripgrepTextSearchEngine.ts | 12 +++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/services/search/node/fileSearch.ts b/src/vs/workbench/services/search/node/fileSearch.ts index ec87a8453da..2042e69d335 100644 --- a/src/vs/workbench/services/search/node/fileSearch.ts +++ b/src/vs/workbench/services/search/node/fileSearch.ts @@ -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)}`; } diff --git a/src/vs/workbench/services/search/node/ripgrepFileSearch.ts b/src/vs/workbench/services/search/node/ripgrepFileSearch.ts index 7e072a9efd8..fdf210f00e6 100644 --- a/src/vs/workbench/services/search/node/ripgrepFileSearch.ts +++ b/src/vs/workbench/services/search/node/ripgrepFileSearch.ts @@ -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 diff --git a/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts b/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts index 7db49ba8ef9..c83fd60118f 100644 --- a/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts +++ b/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts @@ -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.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 { -- GitLab