diff options
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/presentation.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index d861303b7..c343cece6 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -68,7 +68,7 @@ impl Completions { | |||
68 | ScopeDef::ModuleDef(TypeAlias(..)) => CompletionItemKind::TypeAlias, | 68 | ScopeDef::ModuleDef(TypeAlias(..)) => CompletionItemKind::TypeAlias, |
69 | ScopeDef::ModuleDef(BuiltinType(..)) => CompletionItemKind::BuiltinType, | 69 | ScopeDef::ModuleDef(BuiltinType(..)) => CompletionItemKind::BuiltinType, |
70 | ScopeDef::GenericParam(..) => CompletionItemKind::TypeParam, | 70 | ScopeDef::GenericParam(..) => CompletionItemKind::TypeParam, |
71 | ScopeDef::LocalBinding(..) => CompletionItemKind::Binding, | 71 | ScopeDef::Local(..) => CompletionItemKind::Binding, |
72 | // (does this need its own kind?) | 72 | // (does this need its own kind?) |
73 | ScopeDef::AdtSelfType(..) | ScopeDef::ImplSelfType(..) => CompletionItemKind::TypeParam, | 73 | ScopeDef::AdtSelfType(..) | ScopeDef::ImplSelfType(..) => CompletionItemKind::TypeParam, |
74 | ScopeDef::MacroDef(mac) => { | 74 | ScopeDef::MacroDef(mac) => { |
@@ -96,13 +96,11 @@ impl Completions { | |||
96 | 96 | ||
97 | let mut completion_item = | 97 | let mut completion_item = |
98 | CompletionItem::new(completion_kind, ctx.source_range(), local_name.clone()); | 98 | CompletionItem::new(completion_kind, ctx.source_range(), local_name.clone()); |
99 | if let ScopeDef::LocalBinding(pat_id) = resolution { | 99 | if let ScopeDef::Local(local) = resolution { |
100 | let ty = ctx | 100 | let ty = local.ty(ctx.db); |
101 | .analyzer | 101 | if ty != Ty::Unknown { |
102 | .type_of_pat_by_id(ctx.db, pat_id.clone()) | 102 | completion_item = completion_item.detail(ty.display(ctx.db).to_string()); |
103 | .filter(|t| t != &Ty::Unknown) | 103 | } |
104 | .map(|t| t.display(ctx.db).to_string()); | ||
105 | completion_item = completion_item.set_detail(ty); | ||
106 | }; | 104 | }; |
107 | 105 | ||
108 | // If not an import, add parenthesis automatically. | 106 | // If not an import, add parenthesis automatically. |