diff options
-rw-r--r-- | crates/hir/src/code_model.rs | 14 | ||||
-rw-r--r-- | crates/ide/src/completion/presentation.rs | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index f182ab228..afbf78b3b 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
@@ -708,7 +708,7 @@ impl Function { | |||
708 | Some(SelfParam { func: self.id }) | 708 | Some(SelfParam { func: self.id }) |
709 | } | 709 | } |
710 | 710 | ||
711 | pub fn params(self, db: &dyn HirDatabase) -> Vec<Type> { | 711 | pub fn params(self, db: &dyn HirDatabase) -> Vec<Param> { |
712 | let resolver = self.id.resolver(db.upcast()); | 712 | let resolver = self.id.resolver(db.upcast()); |
713 | let ctx = hir_ty::TyLoweringContext::new(db, &resolver); | 713 | let ctx = hir_ty::TyLoweringContext::new(db, &resolver); |
714 | let environment = TraitEnvironment::lower(db, &resolver); | 714 | let environment = TraitEnvironment::lower(db, &resolver); |
@@ -724,7 +724,7 @@ impl Function { | |||
724 | environment: environment.clone(), | 724 | environment: environment.clone(), |
725 | }, | 725 | }, |
726 | }; | 726 | }; |
727 | ty | 727 | Param { ty } |
728 | }) | 728 | }) |
729 | .collect() | 729 | .collect() |
730 | } | 730 | } |
@@ -754,6 +754,16 @@ impl From<Mutability> for Access { | |||
754 | } | 754 | } |
755 | } | 755 | } |
756 | 756 | ||
757 | pub struct Param { | ||
758 | ty: Type, | ||
759 | } | ||
760 | |||
761 | impl Param { | ||
762 | pub fn ty(&self) -> &Type { | ||
763 | &self.ty | ||
764 | } | ||
765 | } | ||
766 | |||
757 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 767 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
758 | pub struct SelfParam { | 768 | pub struct SelfParam { |
759 | func: FunctionId, | 769 | func: FunctionId, |
diff --git a/crates/ide/src/completion/presentation.rs b/crates/ide/src/completion/presentation.rs index cfcb6dfa1..0c29d0be2 100644 --- a/crates/ide/src/completion/presentation.rs +++ b/crates/ide/src/completion/presentation.rs | |||
@@ -231,7 +231,7 @@ impl Completions { | |||
231 | if let Some(pat) = it.pat() { | 231 | if let Some(pat) = it.pat() { |
232 | let name = pat.to_string(); | 232 | let name = pat.to_string(); |
233 | let arg = name.trim_start_matches('_'); | 233 | let arg = name.trim_start_matches('_'); |
234 | return Some(add_arg(arg, ¶m_ty, ctx)); | 234 | return Some(add_arg(arg, param_ty.ty(), ctx)); |
235 | } | 235 | } |
236 | None | 236 | None |
237 | }) | 237 | }) |