New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

vscode-ripgrep-utils

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-ripgrep-utils

Utils to make it easy to call ripgrep in VSCode's extensions.

latest
Source
npmnpm
Version
0.6.0
Version published
Weekly downloads
6
500%
Maintainers
1
Weekly downloads
 
Created
Source

vscode-ripgrep-utils

npm coverage build license

Utils to make it easy to call ripgrep in VSCode's extensions.

Install

yarn add vscode-ripgrep-utils

Usage

VSCode use ripgrep to search files. There is a rg binary in VSCode's installation directory, but the location differs on different platforms and different versions. This package provides a getBinPath function to get the absolute path of the rg binary.

import * as vscode from "vscode";
import { getBinPath } from "vscode-ripgrep-utils";

await getBinPath(vscode.env.appRoot);

Then you can use the high level search function to search files, or the low level exec/execJson functions to execute ripgrep with custom arguments.

import * as vscode from "vscode";
import { getBinPath, search, exec, execJson } from "vscode-ripgrep-utils";

const bin = await getBinPath(vscode.env.appRoot);
await search({ bin, folder: "./", regex: "123" });
await exec(bin, "--version");
await execJson(bin, "-e", "123");

Enable debug to see what command is executed.

import { config } from "vscode-ripgrep-utils";

config.debug = true;

Credit

This project is inspired by Gruntfuggly/todo-tree and alexlafroscia/ripgrep-js.

CHANGELOG

Keywords

ripgrep

FAQs

Package last updated on 08 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts