vscode-rust icon indicating copy to clipboard operation
vscode-rust copied to clipboard

Feature - Specify Project Directory

Open bryaan opened this issue 8 years ago • 6 comments
trafficstars

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`

bryaan avatar Mar 20 '17 18:03 bryaan

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 avatar Mar 20 '17 23:03 redactedscribe

@redactedscribe Tried both absolute and relative paths initially, but no luck.

bryaan avatar Mar 21 '17 02:03 bryaan

@bryaan, There is no way to do that. I will look into your problem.

KalitaAlexey avatar Mar 21 '17 07:03 KalitaAlexey

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.

icorderi avatar Mar 30 '17 20:03 icorderi

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.

icorderi avatar Mar 30 '17 21:03 icorderi

Any news about this?

nox avatar May 09 '19 09:05 nox