mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Provide signature help when editing generic args
This commit is contained in:
parent
e3217c5015
commit
0642724e94
4 changed files with 305 additions and 8 deletions
|
@ -2075,7 +2075,7 @@ impl GenericDef {
|
|||
id: LifetimeParamId { parent: self.into(), local_id },
|
||||
})
|
||||
.map(GenericParam::LifetimeParam);
|
||||
ty_params.chain(lt_params).collect()
|
||||
lt_params.chain(ty_params).collect()
|
||||
}
|
||||
|
||||
pub fn type_params(self, db: &dyn HirDatabase) -> Vec<TypeOrConstParam> {
|
||||
|
@ -2336,6 +2336,18 @@ impl TypeParam {
|
|||
self.id.parent().module(db.upcast()).into()
|
||||
}
|
||||
|
||||
/// Is this type parameter implicitly introduced (eg. `Self` in a trait or an `impl Trait`
|
||||
/// argument)?
|
||||
pub fn is_implicit(self, db: &dyn HirDatabase) -> bool {
|
||||
let params = db.generic_params(self.id.parent());
|
||||
let data = ¶ms.type_or_consts[self.id.local_id()];
|
||||
match data.type_param().unwrap().provenance {
|
||||
hir_def::generics::TypeParamProvenance::TypeParamList => false,
|
||||
hir_def::generics::TypeParamProvenance::TraitSelf
|
||||
| hir_def::generics::TypeParamProvenance::ArgumentImplTrait => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ty(self, db: &dyn HirDatabase) -> Type {
|
||||
let resolver = self.id.parent().resolver(db.upcast());
|
||||
let krate = self.id.parent().module(db.upcast()).krate();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue