Consider using modules instead of include!
lnicola opened this issue · comments
See rust-lang/rust-analyzer#4177.
Just like C headers, include!
can be problematic for IDEs because there's no way to offer a good experience in the presence of code like this.
I don't know if it works with full project, but an alternative is to produce something like:
#[path = "koans/00_greetings"]
mod greetings {
#[path = "00_greetings.rs"]
mod greetings;
}
instead of
include!("koans/00_greetings/00_greetings.rs");
The issue with using modules is that you would be running tests for all koans from the beginning.
I need to hide koans you haven't opened yet to the compiler, that's why I am using include
at the moment.
The koans
tool could insert the new module declaration(s) instead of the include!
line, so the file would still be empty and the start and grow with each new exercise.
I could give that a go, I'll check it out later.