Skip to content
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

Diagnose files that aren't in the crate hierarchy #6377

Closed
jonas-schievink opened this issue Oct 26, 2020 · 7 comments · Fixed by #7966
Closed

Diagnose files that aren't in the crate hierarchy #6377

jonas-schievink opened this issue Oct 26, 2020 · 7 comments · Fixed by #7966
Labels
A-diagnostics diagnostics / error reporting S-actionable Someone could pick this issue up and work on it right now

Comments

@jonas-schievink
Copy link
Contributor

As of recently, we diagnose mod m; with a #[cfg] that is currently inactive. We do not emit a diagnostic for the contents of m.rs though, which can be pretty confusing, since it just shows up as "IDE is not working" while editing m.rs.

@flodiebold flodiebold added the S-actionable Someone could pick this issue up and work on it right now label Dec 21, 2020
@flodiebold
Copy link
Member

It'd also be really great to have a big warning when editing a file that isn't in the module tree at all.

@lnicola lnicola added the A-diagnostics diagnostics / error reporting label Dec 21, 2020
@Kimundi
Copy link
Member

Kimundi commented Feb 26, 2021

According to the Rust discord, warnign about this is also apparently a feature in jetbrains. Would also address issues like this: #7345

@JDuchniewicz
Copy link

Can we force rust-analyzer to include the file in the tree?

@jonas-schievink
Copy link
Contributor Author

I'm planning to add a quickfix that treats files like this as standalone crates instead. Blindly injecting them into the module hierarchy doesn't seem like the best idea.

@JDuchniewicz
Copy link

This is probably the best idea, most of the time when you are writing a standalone file, you only need standard completion and features. Unless other people have different experiences.

bors bot added a commit that referenced this issue Mar 15, 2021
7966: Diagnose files that aren't in the module tree r=jonas-schievink a=jonas-schievink

Fixes #6377

I'm not sure if this is the best way to do this. It will cause false positives for all `include!`d files (though I'm not sure how much IDE functionality we have for these).

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
bors bot added a commit that referenced this issue Mar 15, 2021
7966: Diagnose files that aren't in the module tree r=jonas-schievink a=jonas-schievink

Fixes #6377

I'm not sure if this is the best way to do this. It will cause false positives for all `include!`d files (though I'm not sure how much IDE functionality we have for these).

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
@bors bors bot closed this as completed in de36027 Mar 15, 2021
@jonas-schievink
Copy link
Contributor Author

I'm planning to add a quickfix that treats files like this as standalone crates instead.

I added a quickfix that adds the appropriate mod name; item instead

@cbrit
Copy link

cbrit commented Oct 20, 2021

Is this going anywhere? Would be a wonderful feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants