-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add resolve diagnostics #3569
Add resolve diagnostics #3569
Conversation
b481995
to
ec7e795
Compare
"rust-analyzer.diagnosticsOptions.checkPathsResolution": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Highlight unresolved paths" | ||
}, | ||
"rust-analyzer.diagnosticsOptions.checkMethodsResolution": { |
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.
"rust-analyzer.diagnosticsOptions.checkPathsResolution": { | |
"type": "boolean", | |
"default": true, | |
"description": "Highlight unresolved paths" | |
}, | |
"rust-analyzer.diagnosticsOptions.checkMethodsResolution": { | |
"rust-analyzer.diagnostics.checkPathsResolution": { | |
"type": "boolean", | |
"default": true, | |
"description": "Highlight unresolved paths" | |
}, | |
"rust-analyzer.diagnostics.checkMethodsResolution": { |
checkPathsResolution: this.cfg.get("diagnosticsOptions.checkPathsResolution") as boolean, | ||
checkMethodsResolution: this.cfg.get("diagnosticsOptions.checkMethodsResolution") as boolean, |
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.
checkPathsResolution: this.cfg.get("diagnosticsOptions.checkPathsResolution") as boolean, | |
checkMethodsResolution: this.cfg.get("diagnosticsOptions.checkMethodsResolution") as boolean, | |
checkPathsResolution: this.cfg.get("diagnostics.checkPathsResolution") as boolean, | |
checkMethodsResolution: this.cfg.get("diagnostics.checkMethodsResolution") as boolean, |
@@ -38,6 +38,7 @@ pub struct Options { | |||
pub inlay_hints: InlayHintsOptions, | |||
pub rustfmt_args: Vec<String>, | |||
pub cargo_watch: CheckOptions, | |||
pub diagnostics_config: DiagnosticsOptions, |
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.
pub diagnostics_config: DiagnosticsOptions, | |
pub diagnostics: DiagnosticsOptions, |
I suggest to follow the pattern we have (i.e. not adding config
suffix to the properties of this struct)
If there is an |
To implement that, we need some kind of infra built up for "project settings" that remember the crates excluded per project, save those somewhere and restore them on reload. |
What I propose is that when you write |
I think this should be possible, especially if there's an explicit OTOH, @bjorn3 can you not use the workaround mentioned in #3517? Relatedly: This isn't really how we want to be doing these diagnostics. They should be created by the HIR crates during analysis, not as a separate pass in |
No, that would cause the respective crates to be recompiled for cg_clif. As cg_clif is loaded into a pre-compiled rustc instance, that would result in a mismatch between the |
Ok, good to know 🤔 |
@bjorn3 there's also a nuclear option of using |
Maybe add a way to generate a |
So, did I get it right, we need to move this into the depths of the I will close this PR then, since it's a totally different way. In that case, any ideas on how should we be able to disable the diagnostics? |
I imagine, by filtering them according to the settings on the ra_ide level. |
Yeah, the question is how to filter them uniformly across the crates before the diagnostics are computed. But never mind, I'll fiddle with it more and come up with something. |
I don't think it's necessary to filter them before they are computed 🙂 (It occurs to me I might have been misunderstood: I meant that the filtering should happen in ra_ide.) |
Adds a set of diagnostics to highlight unresolved methods and paths.
The implementation idea is to use the part of the
auto_import
assist that goes before the actual import, since this part is responsible for resolution checks.This reuse may also come in handy if we decide to generate import assists for this diagnostics.
I've turned off method resolution by default, since it gives a lot of false-positives.
The path resolution is way better (yet still has some glitches), so I've left it enabled.