Skip to content

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

Closed
PatchMixolydic opened this issue May 16, 2021 · 1 comment · Fixed by #9138
Closed

Lints and feature gates should have hover hints #8857

PatchMixolydic opened this issue May 16, 2021 · 1 comment · Fixed by #9138
Labels
S-actionable Someone could pick this issue up and work on it right now

Comments

@PatchMixolydic
Copy link

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.

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.

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.

@Veykril
Copy link
Member

Veykril commented May 17, 2021

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.

@Veykril Veykril added the S-actionable Someone could pick this issue up and work on it right now label May 17, 2021
bors bot added a commit that referenced this issue Jun 4, 2021
9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes #8857, fixes #3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

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]>
bors bot added a commit that referenced this issue Jun 4, 2021
9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes #8857, fixes #3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

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]>
bors bot added a commit that referenced this issue Jun 4, 2021
9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes #8857, fixes #3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

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]>
bors bot added a commit that referenced this issue Jun 4, 2021
9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes #8857, fixes #3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

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]>
@bors bors bot closed this as completed in 98395f2 Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants