-
Notifications
You must be signed in to change notification settings - Fork 10.6k
feat: add fake manifest for analyzers/IDEs (fixes #443) #448
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
Conversation
exercises/Cargo.toml
Outdated
@@ -0,0 +1,286 @@ | |||
# This Cargo.toml is AUTOGENERATED, you shouldn't need to edit it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could generate this on the fly, but it does seem a bit more error-prone
src/exercise.rs
Outdated
@@ -167,9 +167,10 @@ path = "{}.rs""#, | |||
fn run(&self) -> Result<ExerciseOutput, ExerciseOutput> { | |||
let arg = match self.mode { | |||
Mode::Test => "--show-output", | |||
_ => "" | |||
_ => "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some cargo fmt
noise here and there.
tooling/Cargo.toml
Outdated
@@ -0,0 +1,11 @@ | |||
[package] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maintenance commands are hidden behind a lib and a feature so it does not interfere with the normal build. It is also exposed as an alias in .cargo/config
to help prospective contributors.
exercises/Cargo.toml
Outdated
authors = ['The Rustlings Maintainers'] | ||
publish = false | ||
|
||
[[bin]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All targets are configured as [[bin]]
. I'm not sure if this could be problematic for exercises without main
(maybe some analyzers will complain that is missing?).
We can't have multiple lib targets though, so if [[bin]]
doesn't work we might need to get creative with [[examples]]
and others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors are produced for each target without a main
fn.
I tried this:
The Rust extension began working for quite a while, processing all the binaries. Eventually, it resulted in in-editor intellisense linting for each of the exercise files. However, all of the problems from all files appear in the Problems panel at once. This might be all that is possible (I'm not sure how the Rust extension handles problem reporting). In comparison, the TypeScript language server only reports problems for files which are currently open in editor tabs. Is there a way to get problem reporting without actually running all the debug incremental builds? It would speed things up tremendously. Aside: Interestingly, this was among the reported problems:
|
@jsejcksn Thanks for your testing. Out of curiosity, what analyzer were you using with VSCode? In fact, a plain old |
@jrvidal Whatever the Rust extension uses by default |
I've been looking into this a bit more. The problem with an all-encompassing manifest is that I'll update the review soon trying a different approach: making the manifest point to the "current" exercise, per |
90c148d
to
47b2dfc
Compare
@jrvidal The strategy I shared in #443 (comment) works well to address that issue. |
Is there a reason that this was never merged? |
@jrvidal I like your idea. Do you plan to update your PR? |
It is an open question whether we want IDE integration or not: figuring out things "manually" might be a core part of the experience we want to provide. I wouldn't mind updating the PR, but I'd like to hear @fmoko's thoughts first. |
@jrvidal I think that the option to enable or disable IDE integration should up to the user. Each of us learns in a different way. For some they will have a better/faster learning experience not having IDE integration. Others will do better with it. I think that the best solution would be to provide the learner with the option to enable/disable and some docs on why they would want one or the other. |
Closing in favor of something like #911. |
This enables analyzers to work correctly as if the
exercises
folder were a true Cargo project.Cargo.toml
. This has pros and cons.exercises
folder for the analyzer to work.