Skip to content

Commit 8dff81e

Browse files
committed
Add extra rg logging for microsoft#100373
1 parent ca7f73b commit 8dff81e

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/vs/workbench/services/search/node/fileSearch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export class FileWalker {
205205
.map(arg => arg.match(/^-/) ? arg : `'${arg}'`)
206206
.join(' ');
207207

208-
let rgCmd = `rg ${escapedArgs}\n - cwd: ${ripgrep.cwd}`;
208+
let rgCmd = `${ripgrep.rgDiskPath} ${escapedArgs}\n - cwd: ${ripgrep.cwd}`;
209209
if (ripgrep.rgArgs.siblingClauses) {
210210
rgCmd += `\n - Sibling clauses: ${JSON.stringify(ripgrep.rgArgs.siblingClauses)}`;
211211
}

src/vs/workbench/services/search/node/ripgrepFileSearch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function spawnRipgrepCmd(config: IFileQuery, folderQuery: IFolderQuery, i
2323
const cwd = folderQuery.folder.fsPath;
2424
return {
2525
cmd: cp.spawn(rgDiskPath, rgArgs.args, { cwd }),
26+
rgDiskPath,
2627
siblingClauses: rgArgs.siblingClauses,
2728
rgArgs,
2829
cwd

src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class RipgrepTextSearchEngine {
4444
const escapedArgs = rgArgs
4545
.map(arg => arg.match(/^-/) ? arg : `'${arg}'`)
4646
.join(' ');
47-
this.outputChannel.appendLine(`rg ${escapedArgs}\n - cwd: ${cwd}`);
47+
this.outputChannel.appendLine(`${rgDiskPath} ${escapedArgs}\n - cwd: ${cwd}`);
4848

4949
let rgProc: Maybe<cp.ChildProcess> = cp.spawn(rgDiskPath, rgArgs, { cwd });
5050
rgProc.on('error', e => {
@@ -57,6 +57,7 @@ export class RipgrepTextSearchEngine {
5757
const ripgrepParser = new RipgrepParser(options.maxResults, cwd, options.previewOptions);
5858
ripgrepParser.on('result', (match: TextSearchResult) => {
5959
gotResult = true;
60+
dataWithoutResult = '';
6061
progress.report(match);
6162
});
6263

@@ -79,8 +80,12 @@ export class RipgrepTextSearchEngine {
7980
cancel();
8081
});
8182

83+
let dataWithoutResult = '';
8284
rgProc.stdout!.on('data', data => {
8385
ripgrepParser.handleData(data);
86+
if (!gotResult) {
87+
dataWithoutResult += data;
88+
}
8489
});
8590

8691
let gotData = false;
@@ -96,7 +101,12 @@ export class RipgrepTextSearchEngine {
96101
rgProc.on('close', () => {
97102
this.outputChannel.appendLine(gotData ? 'Got data from stdout' : 'No data from stdout');
98103
this.outputChannel.appendLine(gotResult ? 'Got result from parser' : 'No result from parser');
104+
if (dataWithoutResult) {
105+
this.outputChannel.appendLine(`Got data without result: ${dataWithoutResult}`);
106+
}
107+
99108
this.outputChannel.appendLine('');
109+
100110
if (isDone) {
101111
resolve({ limitHit });
102112
} else {

0 commit comments

Comments
 (0)