diff options
| author | Lunaphied <lunaphied@lunaphied.me> | 2024-06-16 15:15:36 -0600 |
|---|---|---|
| committer | Lunaphied <lunaphied@lunaphied.me> | 2024-06-16 15:15:36 -0600 |
| commit | 5385429f7f398e29710a56ba4449e210a6ec35f1 (patch) | |
| tree | 271a4deb9fb10e608f6a6e309b5aa9211bb1a9fc /src/tools/rust-analyzer | |
| parent | e0c1b2bf75c742af8a6637e25e9b5148de8c444a (diff) | |
| download | rust-5385429f7f398e29710a56ba4449e210a6ec35f1.tar.gz rust-5385429f7f398e29710a56ba4449e210a6ec35f1.zip | |
docs: document omission heuristics for parameter inlay hints
These are not currently documented and could cause users to think that their rust-analyzer configuration is broken. Partially addresses #17433.
Diffstat (limited to 'src/tools/rust-analyzer')
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs b/src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs index e9c48ab1e76..3f10bed5110 100644 --- a/src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs +++ b/src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs @@ -455,6 +455,23 @@ fn ty_to_text_edit( // * elided lifetimes // * compiler inserted reborrows // +// Note: inlay hints for function argument names are heuristically omitted to reduce noise and will not appear if +// any of the +// link:https://github.com/rust-lang/rust-analyzer/blob/6b8b8ff4c56118ddee6c531cde06add1aad4a6af/crates/ide/src/inlay_hints/param_name.rs#L92-L99[following criteria] +// are met: +// +// * the parameter name is a suffix of the function's name +// * the argument is a qualified constructing or call expression where the qualifier is an ADT +// * exact argument<->parameter match(ignoring leading underscore) or parameter is a prefix/suffix +// of argument with _ splitting it off +// * the parameter name starts with `ra_fixture` +// * the parameter name is a +// link:https://github.com/rust-lang/rust-analyzer/blob/6b8b8ff4c56118ddee6c531cde06add1aad4a6af/crates/ide/src/inlay_hints/param_name.rs#L200[well known name] +// in a unary function +// * the parameter name is a +// link:https://github.com/rust-lang/rust-analyzer/blob/6b8b8ff4c56118ddee6c531cde06add1aad4a6af/crates/ide/src/inlay_hints/param_name.rs#L201[single character] +// in a unary function +// // image::https://user-images.githubusercontent.com/48062697/113020660-b5f98b80-917a-11eb-8d70-3be3fd558cdd.png[] pub(crate) fn inlay_hints( db: &RootDatabase, |
