Skip to content

rust-analyzer doesn't work fully for rust files which not in src folder #8009

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
BruceChen2017 opened this issue Mar 14, 2021 · 5 comments
Closed

Comments

@BruceChen2017
Copy link

BruceChen2017 commented Mar 14, 2021

For example, you open git repo rustlings. Then in the rustings/src directory, rust-analyzer works well. But in rustlings/exercises/some_topic/some_rust_file, rust-analyzer does not work except that it gives syntax error message if you have. I also test official rust extension independently, rls works in rustlings/exercises/some_topic/some_rust_file.

Note: When using rust-analyzer, I have disabled official rust extension.

@flodiebold
Copy link
Member

This is a problem with the rustlings project structure, which does some special things that don't work with IDEs. See rust-lang/rustlings#443. On RA side, this is mostly a duplicate of #6388, which would make most features work in the exercise files.

@jackos
Copy link
Contributor

jackos commented Jan 9, 2022

A fix specifically for rustlings: https://gist.github.com/jackos/7332fa8ab0b67a87f382fd566696f412

@flodiebold
Copy link
Member

@jackos great! Maybe rustlings could generate this file automatically? 🤔

@jackos
Copy link
Contributor

jackos commented Jan 12, 2022

@flodiebold I opened a pull request to do that: rust-lang/rustlings#911

@jackos
Copy link
Contributor

jackos commented Jan 13, 2022

@flodiebold also I add this crate: https://crates.io/crates/rustlings-fix

Just go into rustlings folder and do:

cargo install rustlings-fix
rustlings-fix

And it'll generate the file

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

3 participants