rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

In `#[allow()]` completion lints that are firing

Open kpreid opened this issue 1 year ago • 0 comments

A common action (especially when using clippy) is to observe reported lint and #[allow()] it. Therefore, it would be useful if, when completing with the cursor is inside an #[allow()], the ranking preferred the names of lints for which at least one diagnostic has been emitted within the syntax tree to which the #[allow()] attribute applies.

It probably makes sense to generalize this to any combination of attribute and diagnostic severity.

  • allow and expect would prefer current warnings and errors
  • deny and forbid would prefer current warnings
  • warn would prefer current errors

I took a look at implementing this, but I didn't find a way to fetch info about current diagnostics from inside ide_completion::completions::attribute::complete_known_attribute_input.

kpreid avatar Jun 13 '24 21:06 kpreid