-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Support repo-relative paths in rust-analyzer.server.path
#13939
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
Comments
rust-analyzer.server.path
rust-analyzer.server.path
If you can set |
@lnicola .. Thanks for the suggestion! But as it requires changing the environment BEFORE loading VS Code, I'm not sure it would be ideal/as easy for most use cases:
|
I think the fix would come to setting rust-analyzer/editors/code/src/util.ts Lines 115 to 124 in a119352
|
I think you can set |
@bjorn3 thanks for the suggestion. can you please clarify? something like below won't work, since:
"rust-analyzer.server.extraEnv": {
"PATH": "$PATH:${workspaceFolder}/bin"
} |
I see, I assumed it would work. |
"rust-analyzer.server.path": "${workspaceFolder}/bin/rust-analyzer", should work |
@Veykril It does not. See logs below:
It has been a while since I worked with VS Code extensions, but my understanding is that VSCode itself does not resolve See this for more information: microsoft/vscode#2809 |
Ah, apologies, we do support variable substitution (we re-implemented it), but we do it after spawning the server I think. That is, that should work but it currently doesn't. |
rust-analyzer/editors/code/src/ctx.ts Lines 155 to 161 in 6e52c64
Yep, we pull the server path first, then substitute the configs, that's the wrong order. |
The VS Code configuration
rust-analyzer.server.path
exists to use a local binary, which is great when testing stuff, and also when using from a dev container. However, it expects a full path, which doesn't work well with version-controlled binaries. For example, if I set it to:The extension will fail, printing the following error to
Rust Analyzer Client
VS Code output channel:I wanted to propose executing that command relative to the workspace directory, to allow users to specify paths that are relative to the repository they are working on, instead of forcing them to use machine-wide installations.
The text was updated successfully, but these errors were encountered: