Skip to content

include! concat! env! OUT_DIR not auto completing #4482

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

Closed
chinedufn opened this issue May 16, 2020 · 15 comments
Closed

include! concat! env! OUT_DIR not auto completing #4482

chinedufn opened this issue May 16, 2020 · 15 comments

Comments

@chinedufn
Copy link
Contributor

chinedufn commented May 16, 2020

Hey!

I tried to use the latest nightly of rust-analyzer (as of approximately May 15) within VSCode to see if I could get auto complete for some constants that were generated in a build.rs.

The rust-analyzer tests suggest that it works in main.rs - and I'm seeing it work when I create a new project and try to auto-complete within main.rs.

As soon as I start to stray from that I lose auto-complete.

For example, if I move the include! call to mod bindings and type bindings:: I can no longer auto complete the constants.

Is this a known limitation at this time - or am I perhaps misconfigured? I have the setting to check out dirs on startup turned on.

I could whip up an example project (or rust-analyzer test case if you can point me into the right direction?) if needed - but as far as I can tell as soon as you start trying to import include!d types from other modules the auto complete stops working.

Thanks and cheers!


$ rustc -V
rustc 1.45.0-nightly (2454a68cf 2020-05-04)
@chinedufn chinedufn changed the title include! concat! env! OUT_DIR not working include! concat! env! OUT_DIR not auto completing May 16, 2020
@edwin0cheng
Copy link
Member

edwin0cheng commented May 16, 2020

Did you enable : rust-analyzer.cargo.loadOutDirsFromCheck ? It is off by default .

@chinedufn
Copy link
Contributor Author

Yup sure did ! I checked the check box in the VSCode rust-analyzer extension settings.

Not sure if it matters, but I originally ran into this in my project’s cargo workspace but I verified that I get the same issues in a non workspace as well.

@edwin0cheng
Copy link
Member

I could whip up an example project

Yeah, a minimal reproducible example will be nice to have to help here. !

@chinedufn
Copy link
Contributor Author

chinedufn commented May 18, 2020

example-screenshot

Sure!

Everything is captured in the attached screenshot. I expected the pictured auto-complete to include GENERATED_CONSTANT.

Here's a repository with the code above: https://github.com/chinedufn/rust-analyzer-issue-4482

@flodiebold
Copy link
Member

Hm, could it be a problem with relative paths, since the path inside the generated_constants module will be relative to src/generated_constants? 🤔

@chinedufn
Copy link
Contributor Author

@flodiebold thanks for the help! Sorry, I'm not quite getting what you're asking?

@flodiebold
Copy link
Member

I'm just speculating about the reason for the bug 😉

@chinedufn
Copy link
Contributor Author

@edwin0cheng anything happen to ring a bell in terms of what might be happening?

Cheers!

@edwin0cheng
Copy link
Member

No idea, and this week I am a bit busy, but I think I will be investigating this weekend.

@chinedufn
Copy link
Contributor Author

Awesome - no rush at all - thanks!

@edwin0cheng
Copy link
Member

Oh , I just tested it in master(00172d0) and it works:

4482

@lnicola

This comment has been minimized.

@chinedufn
Copy link
Contributor Author

chinedufn commented May 25, 2020

@edwin0cheng just upgraded to the latest nightly and that example works for me!

However, here's an example that does not work:

image

I would expect the generated_constants module to be in the suggestions (the constants aren't auto completed either).

I've updated the reproduction repository with the code in this screenshot.

@edwin0cheng
Copy link
Member

Um.. It works for me too :

4482_2

You may need to reload the VSCode after adding tests folder.

@chinedufn
Copy link
Contributor Author

Ah nice that works!

So I'm still seeing issues in my real crate such as:

image

But I suppose I can open separate issues for them with reproducible examples.

I'll give it some time then come back to rust-analyzer in case the issue happens to resolve itself like this issue did (just to avoid trying to reproduce this).

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants