Skip to content

Module declaration missing warning in IntelliJ #1825

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
tastapod opened this issue Jan 15, 2024 · 5 comments
Closed

Module declaration missing warning in IntelliJ #1825

tastapod opened this issue Jan 15, 2024 · 5 comments

Comments

@tastapod
Copy link

First up, I'm loving rustlings. It's addictive!

In IntelliJ 2023.3.2 with the JetBrains Rust plugin (233.23135.116) I get a warning whenever I open a module, that says Module declaration missing. This may impact smart editing features and auto-completion. (See image below.)

I think it is because all the exercises are technically detached modules; they aren't referenced in a lib.rs or main.rs elsewhere.

I can suppress this warning by disabling the Detached file inspection in the project settings (Editor -> Inspections -> Rust -> Detached file).

The Rust plugin seems to be working ok, with completions, etc., and the rustlings watch process is working fine too, so I'm posting this issue mostly for awareness.

ObSetup:

  • OS: macOS 14.2.1
  • rustc version 1.75.0 (82e1608df 2023-12-21)
  • rustlings version 5.6.1

image

@manyinsects
Copy link
Member

Did you run rustlings lsp to see if that helps? AFAIK IntelliJ editors don't use rust-analyzer, but they may still respect the rust-project.json that that command generates, not sure though...

@tastapod
Copy link
Author

I just tried that and re-enabled the inspection, and the warning returned.

@manyinsects
Copy link
Member

Right, then I think that's just going to be something that the editor will keep complaining about, I'm afraid. It's good that there's a way to disable the warning, at least.

@tastapod
Copy link
Author

I just noticed something else, which I think is related. I can't navigate to rustlings code in the same file.

In structs3.rs when I go to Package::new on line 53, I can't navigate to the definition of new using Cmd-B (which is a few lines above), but I can navigate to e.g. String::from in the core library. So IntelliJ isn't able to index the current file.

So the package indexing is definitely A Thing in the exercise sources, I just can't figure out how to resolve it.

@mo8it
Copy link
Contributor

mo8it commented Mar 30, 2024

Closing because this should be fixed in #1935

Also this might be outdated anyway since there is RustRover now.

@mo8it mo8it closed this as completed Mar 30, 2024
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

Successfully merging a pull request may close this issue.

3 participants