-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Lints and feature gates should have hover hints #8857
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
Comments
Features not showing their description is certainly a bug, looks like the generated description strings of those is different than those of lints. https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_completion/src/generated_lint_completions.rs Hovering is something I'd like for attributes to definitely work for, the current problem is that attributes merely contain unstructured tokens. In this case we can easily parse the attribute for the given structure and make it work though, so that shouldn't be a problem. I'll give that a look. |
9138: feat: Implement hover for lints r=Veykril a=Veykril fixes #8857, fixes #3941  We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that. Co-authored-by: Lukas Wirth <[email protected]>
9138: feat: Implement hover for lints r=Veykril a=Veykril fixes #8857, fixes #3941  We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that. Co-authored-by: Lukas Wirth <[email protected]>
9138: feat: Implement hover for lints r=Veykril a=Veykril fixes #8857, fixes #3941  We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that. Co-authored-by: Lukas Wirth <[email protected]>
9138: feat: Implement hover for lints r=Veykril a=Veykril fixes #8857, fixes #3941  We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that. Co-authored-by: Lukas Wirth <[email protected]>
Currently, lints display information about what they lint against while typing them:
![Typing `#!forbid[(unsafe_o)]` suggests several lints. `unsafe_op_in_unsafe fn` is highlighted, which causes documentation for the lint to appear next to it.](https://user-images.githubusercontent.com/8634700/118406684-76133880-b642-11eb-85d7-e3eebf0365f1.png)
Features gates behave similarly, though their documentation just has the feature name written as a Markdown title (which seems like a bug). Additionally, hovering over a lint or a feature gate displays nothing:
![Screenshot showing a cursor hovering over `#![forbid(unsafe_op_in_unsafe_fn)]`. No hover hint is displayed.](https://user-images.githubusercontent.com/8634700/118406783-f9348e80-b642-11eb-9266-9e508080a5e9.png)
I believe that adding the lint/feature gate documentation as a hover hint would be useful, as it would allow people to quickly understand what the lint/feature gate does without having to pull up a reference.
The text was updated successfully, but these errors were encountered: