vscode-rust
vscode-rust copied to clipboard
Feature - Specify Project Directory
My rust project is in a child directory of my main project.
How can I specify the directory containing the Cargo.toml when using RLS mode?
Did some searching on vscode-rust, RLS, and rustup, and cannot find a way to specify the project directory.
thread '<unnamed>' panicked at 'could not find root manifest: could not find `Cargo.toml` in
`/Users/bryan/Developer/tibra` or any parent directory', src/libcore/result.rs:859`
This should be what you're looking for:
// Specifies the path of the directory where a cargo command would be executed
"rust.cargoCwd": null,
@redactedscribe Tried both absolute and relative paths initially, but no luck.
@bryaan, There is no way to do that. I will look into your problem.
I run into this same bug but described it at #158.
The Cargo.toml associated with a given *.rs should be the first Cargo.toml from that file up, NOT from the root of the [vscode-]workspace.
We should not need to specify a project directory, that would prevent us from having multiple rust projects on the same vscode-workspace.
Did some digging, this is what I found so far.
The RLS looks for the manifest here.
let root = find_root_manifest_for_wd(None, config.cwd()).expect("could not find root manifest");
Which seems to get it's starting dir from a build_dir flying around that can be tracked to the request_build(2) here.
After reading the RLS code it's not entirely clear to me how to specify a manifest-path does is different than the build_dir.
But if we pass it a build_dir based on our cwd we should be ok for now given that it is looking for the Cargo.toml recursively up from the active document.
I couldn't find where in the language_client/manger to hook it up.
We might want to fire up a question to the RLS folks to check if that is what they had in mind.
Any news about this?