Show substitution where hovering over generic things

There are few things to note in the implementation:

First, this is a best-effort implementation. Mainly, type aliases may not be shown (due to their eager nature it's harder) and partial pathes (aka. hovering over `Struct` in `Struct::method`) are not supported at all.

Second, we only need to show substitutions in expression and pattern position, because in type position all generic arguments always have to be written explicitly.
This commit is contained in:
Chayim Refael Friedman 2024-12-18 00:57:38 +02:00
parent 27e824fad4
commit b5486ffc42
29 changed files with 1019 additions and 190 deletions

View file

@ -36,7 +36,7 @@ pub(crate) fn goto_declaration(
let def = match_ast! {
match parent {
ast::NameRef(name_ref) => match NameRefClass::classify(&sema, &name_ref)? {
NameRefClass::Definition(it) => Some(it),
NameRefClass::Definition(it, _) => Some(it),
NameRefClass::FieldShorthand { field_ref, .. } =>
return field_ref.try_to_nav(db),
NameRefClass::ExternCrateShorthand { decl, .. } =>