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

Include `const`-ness of function in parameter popup

Open SludgePhD opened this issue 2 years ago • 2 comments

screenshot_2024-02-28_01:40:27

When calling a function like Mutex::new, it would be helpful to know whether the call is valid in a const context. rust-analyzer could help with that if it included the const modifier in the function parameter popup.

SludgePhD avatar Feb 28 '24 00:02 SludgePhD

Same for async. I think the problem is that https://github.com/rust-lang/rust-analyzer/blob/5fead606bc88d9ed3cb1109bea9c1cb1c42b4ac0/crates/ide/src/signature_help.rs#L182 rolls its own formatting, but we can't use HirDisplay on a Callable.

lnicola avatar Feb 28 '24 07:02 lnicola

but we can't use HirDisplay on a Callable

Should be easy enough to implement, though I think care must be taken since the display code makes some extra assumptions for hover output that we might not want here.

Veykril avatar Feb 28 '24 08:02 Veykril

Should we use HirDisplay here? In signature_help, we want to highlight the parameter corresponding to the currents position, but HirDisplay seems unable to achieving this.

roife avatar Mar 24 '24 13:03 roife