-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
include! concat! env! OUT_DIR not auto completing in cargo workspace #5040
Comments
Do you have |
Yup! Just updated my issue comment to explicitly show that, thanks! |
This comment has been minimized.
This comment has been minimized.
I’m on nightly-2020-06-22 |
From my brief run in with how we do VFS glob matching, the issue might be that |
I've updated the example repo to include Still doesn't work unfortunately |
I also have this problem, are there any means of obtaining logs from the server so we can attach? |
Also it used to work for me, then I think I updated and it didn't work anymore |
I'm experiencing this outside of a workspace and definitely have the setting enabled. Checking out this project, highlighting Not sure if that is a different issue given the absence of a workspace, but figured it might be at least another data point. Thanks. |
@chinedufn I think I know what's going on in your example. Note that your example project structure is :
And the root Cargo.toml is : [package]
name = "rust-analyzer-cargo-workspace"
version = "0.1.0"
authors = ["Chinedu Francis Nwafili <frankie.nwafili@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
[workspace]
members = [
"crates/crate1",
"crates/crate2",
] Note that the workspace session in root Cargo.toml is redundant, because the root crate exists. if you changed to : [package]
name = "rust-analyzer-cargo-workspace"
version = "0.1.0"
authors = ["Chinedu Francis Nwafili <frankie.nwafili@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
crate1 = {path="crates/crate1"}
crate2 = {path="crates/crate2"} Then the problem you mentioned will be solved. |
OTHO, I think it is some bug in cargo-metadata for this situation or it is by design ? |
@ndarilek I think it is working now, I remember I fixed some bugs in previous weeks related on that. |
No, sorry, not with the latest rust-analyzer as of yesterday.
For instance, placing my cursor over `SpeechSynthesizer` in
https://github.com/ndarilek/tts-rs/blob/master/src/backends/winrt.rs#L25
just loads lib.rs:
include!(concat!(env!("OUT_DIR"), "/winrt.rs"));
It doesn't take me to the definition.
|
@edwin0cheng thanks for looking into this! The use case for You could get around this by just not using the root crate so that you can give it bogus dependencies, as I think you're proposing, but then if you use something like With that in mind I think it would be better if this worked with a crate that uses Is this possible? I'm not so familiar with how all of this go-to definition and completion stuff works. Thanks! |
goto-definition is for yeah, It definitely is a bug of RA , and the bug is related to how we treat the root crate dependencies. IIRC, we use "cargo check" on the workspace to fetch the OUTDIR (which is used for include! macro). Here is the related code : Maybe 'cargo check' didn't check the members in this case ? |
@edwin0cheng would |
IIUC, it should do the trick, something like this will work : cmd.args(&["check", "--message-format=json", "--manifest-path", "--workspace"]).arg(cargo_toml); For the reference It is the doc from
And in your case, it is a non-virtual workspace . |
7264: Use --workspace when loading extern resources r=edwin0cheng a=chinedufn #5040 (comment) Co-authored-by: Chinedu Francis Nwafili <frankie.nwafili@gmail.com>
Closed via #7264 |
I'm having an issue with a dependency that has a file that is just I can't find any "Load out dirs" setting as mentioned in the OP. Cargo/Rust itself has no trouble using these types/functions. |
Related to #4482, I've never had the OUT_DIR support work in my project.
I've created a new repository to demonstrate the issue.
https://github.com/chinedufn/rust-analyzer-issue-5040
In the screenshot below I expected
crate1::
to autocomplete withHELLO
, the name of the generated constant from thebuild.rs
in the bottom left.Instead there are only
crate1::{super,self}
as options for completion.Load out dirs is checked
\cc @flodiebold @edwin0cheng
The text was updated successfully, but these errors were encountered: