Skip to content

Consider using modules instead of include! #33

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
lnicola opened this issue Apr 28, 2020 · 3 comments · Fixed by #34
Closed

Consider using modules instead of include! #33

lnicola opened this issue Apr 28, 2020 · 3 comments · Fixed by #34

Comments

@lnicola
Copy link

lnicola commented Apr 28, 2020

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");
@LukeMathWalker
Copy link
Owner

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.

@lnicola
Copy link
Author

lnicola commented Apr 28, 2020

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.

@LukeMathWalker
Copy link
Owner

I could give that a go, I'll check it out later.

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