(dirUri: string, args: string[])
| 442 | } |
| 443 | |
| 444 | runRipgrepQuery(dirUri: string, args: string[]) { |
| 445 | const relativeDir = vscode.Uri.parse(dirUri).fsPath; |
| 446 | const ripGrepUri = vscode.Uri.joinPath( |
| 447 | getExtensionUri(), |
| 448 | "out/node_modules/@vscode/ripgrep/bin/rg", |
| 449 | ); |
| 450 | const p = child_process.spawn(ripGrepUri.fsPath, args, { |
| 451 | cwd: relativeDir, |
| 452 | }); |
| 453 | let output = ""; |
| 454 | |
| 455 | p.stdout.on("data", (data) => { |
| 456 | output += data.toString(); |
| 457 | }); |
| 458 | |
| 459 | return new Promise<string>((resolve, reject) => { |
| 460 | p.on("error", reject); |
| 461 | p.on("close", (code) => { |
| 462 | if (code === 0) { |
| 463 | resolve(output); |
| 464 | } else if (code === 1) { |
| 465 | // No matches |
| 466 | resolve( |
| 467 | "No matches found. Build, secrets, etc. dirs and files are not included.", |
| 468 | ); |
| 469 | } else { |
| 470 | reject(new Error(`Process exited with code ${code}`)); |
| 471 | } |
| 472 | }); |
| 473 | }); |
| 474 | } |
| 475 | |
| 476 | async getFileResults( |
| 477 | pattern: string, |
no test coverage detected