rust-analyzer: Unused/inactive highlighting when file is not linked

rust-analyzer version: 4af21ffb026c7ec3a97a484ca27b36f703eb5fb1

Before an unlinked file (or a #[cfg(FALSE)] module) just had a small diagnostic for the first line. Now the whole file gets the visually marked as “unused”, which was implemented here: https://github.com/rust-lang/rust-analyzer/pull/17350.

The PR mentions:

Whilst this is marginally more prominent, it’s less invasive than a pop-up, and users do want to know why they’re getting no rust-analyzer support in certain files.

I agree it is less “invasive” compared to pop-up but now it’s also more visually distracting (or for me straight up annoying). My workflow quite often consists of workflows where I’ve got unlinked files in the work-tree and having the whole file “grayed out” it not great visually speaking.

There must be a better to do this. It might be interesting to see what RustRover is doing here. But for now I’ve reverted this change locally, so it’s not bugging me anymore.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (23 by maintainers)

Commits related to this issue

Most upvoted comments

I remembered earlier that we actually used to have a notification (we still have a config that toggles it), but that is nowadays disabled fully in code as it is buggy and more importantly annoying even with the setting. (buggy in part because r-a will flag any file on startup)

If it wasn’t buggy, maybe it wouldn’t be so annoying?

How would you feel about having this being a diagnostic by default, and behind a off-by-default setting, the ability to upgrade it to a notification? For the users Wilfred and I are responsible for, we’ll make it a notification, but most rust-analyzer users won’t see, let alone complain about it.

Oh… I didn’t know that setting existed 😅 Thanks!

Disabling the diagnostic (rust-analyzer.diagnostics.disabled) probably works.