-
Notifications
You must be signed in to change notification settings - Fork 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
rust-analyzer unresolved module #133
Comments
Yes, I have seen problems with this too. I have kind of assumed it is a limitation in rust-analyzer, as the ordinary compiler or clippy don't give me any warning that seems related. The rust-analyzer issue you mention seems related, but has been fixed since 2021. So maybe ructe is doing something stranger than what that fix was about. I didn't find any mention of the Could you write a test program, where a build.rs writes two files in |
Just tested it. It seems you are right, the issue persisted. I just created a minimal reproduction, I will open an issue in rust-analyzer. |
Did you create an issue in rust-analyzer, @YUCLing ? Could you link it here for tracking? |
I am not sure it is an R-A issue. Honestly, I'm more concerned that cargo accepts the, uhh, interesting folder structure emitted by |
Huh? What's "interesting" about the folder structure? Why should it not be discoverable when included? |
https://github.com/Zynh0722/ructe/tree/rust-analyzer-workaround Super crude workaround that I whipped up just compiles all the of the template modules into a single file. Worth noting that this specific setup almost certainly wont work for statics, or anything other than just a dirt simple setup with just Something similar might be possible with statics, I just havent begun using them yet, so Im just pretending they dont exist. |
This part is also mildly surprising to me, as well as to the people on reddit that I brought this same issue up to. Also everyone seems to be trying to state its an invalid module structure. It most certainly is valid lol. The reason I thought it might not be discoverable is because of the assumption that the |
The If that does not with rust-analyzer, then that is a problem in rust-analyzer. (Here's the comment on my blog where Jethro Beekman told me that this should work.) |
Haha, I am glad we all agree it is indeed a bit magical, though unlike normal I think that is a good thing here. I do definitely agree the problem is with R-A, as both cargo check and obv following, the compiler itself handle the whole of your implementation quite well. Hence why I didn't make a PR or suggest the change I made, simply provided a short term workaround for those wanting their IDE experience to not be subpar. Overall I am quite happy with ructe thus far, and I very much appreciate the effort that's been put into it. If someone asks, or if I end up using statics, which is more probable by the moment, I will likely extend that workaround to work for those as well, but honestly I don't know if that will be as trivial as compile_templates was, and that is a lot of work to skirt a bug of sorts with R-A. Otherwise I wouldn't recommend the workaround at all, for I don't understand the implications of my edits, I just know I got the types I wanted being spit out of cmp lmao |
I'm having issues with including the templates built by ructe, I'm not sure is it a ructe issue or rust-analyzer issue.
I set up my project with ructe and rust-analyzer claims
unresolved module, can't find module file: _utils.rs, or _utils/mod.rs
error. The same error appears inside the example code too. Both projects can be compiled without any errors.I've tried different versions of rust-analyzer, all the same. Also I found an issue in rust-analyzer: rust-lang/rust-analyzer#7846, however it's fixed already.
rust-analyzer version: v0.3.1599
rustc version: 1.71.0
The text was updated successfully, but these errors were encountered: