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

rust-analyzer.server.extraEnv not passed to isValidExecutable #15440

Closed
alecmocatta opened this issue Aug 11, 2023 · 0 comments · Fixed by #15446
Closed

rust-analyzer.server.extraEnv not passed to isValidExecutable #15440

alecmocatta opened this issue Aug 11, 2023 · 0 comments · Fixed by #15446
Labels
C-bug Category: bug

Comments

@alecmocatta
Copy link

Line 23 here fails due to rust-analyzer.server.extraEnv not being passed to the invoked rust-analyzer.

const path = await getServer(context, config, state);
if (!path) {
throw new Error(
"Rust Analyzer Language Server is not available. " +
"Please, ensure its [proper installation](https://rust-analyzer.github.io/manual.html#installation).",
);
}
log.info("Using server binary at", path);
if (!isValidExecutable(path)) {
if (config.serverPath) {
throw new Error(`Failed to execute ${path} --version. \`config.server.path\` or \`config.serverPath\` has been set explicitly.\
Consider removing this config or making a valid server binary available at that path.`);
} else {
throw new Error(`Failed to execute ${path} --version`);
}
}

In my case, I have "rust-analyzer.server.path": "rust-analyzer" and "rust-analyzer.server.extraEnv": { "RUSTUP_TOOLCHAIN": "nightly-2023-06-04" } but as this isn't getting passed, rust-analyzer (actually rustup's shim) returns this error:

INFO [11/08/2023, 12:36:15]: Starting language client
INFO [11/08/2023, 12:36:15]: Using server binary at rust-analyzer
INFO [11/08/2023, 12:36:16]: rust-analyzer --version: {
  status: 1,
  signal: null,
  output: [
    null,
    '',
    "error: 'rust-analyzer' is not installed for the toolchain 'stable-aarch64-apple-darwin'\n"
  ],
  pid: 34991,
  stdout: '',
  stderr: "error: 'rust-analyzer' is not installed for the toolchain 'stable-aarch64-apple-darwin'\n"
}
ERROR [11/08/2023, 12:36:16]: Bootstrap error Error: Failed to execute rust-analyzer --version. `config.server.path` or `config.serverPath` has been set explicitly.            Consider removing this config or making a valid server binary available at that path.
    at kv (/Users/alecmocatta/.vscode/extensions/rust-lang.rust-analyzer-0.3.1615-darwin-arm64/out/main.js:40:9565)
    at wa.getOrCreateClient (/Users/alecmocatta/.vscode/extensions/rust-lang.rust-analyzer-0.3.1615-darwin-arm64/out/main.js:53:2237)
    at wa.start (/Users/alecmocatta/.vscode/extensions/rust-lang.rust-analyzer-0.3.1615-darwin-arm64/out/main.js:53:3494)
    at /Users/alecmocatta/.vscode/extensions/rust-lang.rust-analyzer-0.3.1615-darwin-arm64/out/main.js:371:174
    at a.h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:77769)
INFO [11/08/2023, 12:36:19]: Extension version: 0.3.1615

rust-analyzer version: stable / nightly / nightly-2023-06-04

rustc version: nightly-2023-06-04

relevant settings:

{
    "rust-analyzer.server.path": "rust-analyzer",
    "rust-analyzer.server.extraEnv": {
        "RUSTUP_TOOLCHAIN": "nightly-2023-06-04",
    },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant