Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
searchInDirectory(directory, regexp, options, numPathsFound) {
// Delay the require of vscode-ripgrep to not mess with the snapshot creation.
if (!this.rgPath) {
this.rgPath = require('vscode-ripgrep').rgPath.replace(
/\bapp\.asar\b/,
'app.asar.unpacked'
);
}
const directoryPath = directory.getPath();
const regexpStr = this.prepareRegexp(regexp.source);
const args = ['--hidden', '--json', '--regexp', regexpStr];
if (options.leadingContextLineCount) {
args.push('--before-context', options.leadingContextLineCount);
}
if (options.trailingContextLineCount) {
args.push('--after-context', options.trailingContextLineCount);
}
if (regexp.ignoreCase) {
// This file is prepended to loader/entry code (like our main.js or VS Code's
// bootstrap-fork.js). {{ROOT_PATH}} is replaced during the build process.
if (!global.NBIN_LOADED) {
try {
const nbin = require("nbin");
nbin.shimNativeFs("{{ROOT_PATH}}");
global.NBIN_LOADED = true;
const path = require("path");
const rg = require("vscode-ripgrep");
rg.binaryRgPath = rg.rgPath;
rg.rgPath = path.join(
require("os").tmpdir(),
`code-server/${path.basename(rg.binaryRgPath)}`
);
} catch (error) { /* Not in the binary. */ }
}
const vscode = require('vscode')
const querystring = require('querystring')
const rgPath = require('vscode-ripgrep').rgPath
const {
execSync
} = require('child_process')
const rootPath = vscode.workspace.rootPath
const execOpts = {
cwd: rootPath,
maxBuffer: 1024 * 1000
}
class SearchyProvider {
constructor() {
this.links = []
this._subscriptions = vscode.workspace.onDidCloseTextDocument(doc => {
this.links[doc.uri.toString()] = []