Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action needed: update your import of the built-in ripgrep #56

Open
connor4312 opened this issue Jan 12, 2022 · 1 comment · May be fixed by #77
Open

Action needed: update your import of the built-in ripgrep #56

connor4312 opened this issue Jan 12, 2022 · 1 comment · May be fixed by #77

Comments

@connor4312
Copy link

Hello from the VS Code team 👋

We're doing some housekeeping that involves renaming some of our internal packages. Namely, vscode-ripgrep will be renamed to @vscode/ripgrep, which affects its location in VS Code's node_modules folder. It looks like this extension depends on vscode-ripgrep in a way that will break when this rename happens.

We suggest either:

  1. Adding an extra check for the renamed binary path in your extension, or
  2. Updating your extension to import vscode-ripgrep and retrieve the binary path from there. We will alias the require statement, so that the renamed package is always resolved correctly, and vscode-ripgrep exports the binary path. For example:
function getCoreNodeModule(moduleName) {
    try {
        return require(`${vscode.env.appRoot}/node_modules.asar/${moduleName}`);
    } catch (err) {
        try {
            return require(`${vscode.env.appRoot}/node_modules/${moduleName}`);
        } catch (err) {
            return undefined;
        }
    }
}

const { rgPath } = getCoreNodeModule('vscode-ripgrep');
// then child_process.spawn(rgPath, [...

Note that if you're building your extension with Webpack, you will want to use __non_webpack_require__ instead of require, otherwise webpack will try to (incorrectly) resolve the request by itself.

@stef-levesque
Copy link
Owner

Hey @connor4312 , I'm trying your suggestion but this doesn't work for me on macOS with VSCode 1.85.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants