diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/completion_item.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_item.rs | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index 8e0be4c4b..18c151932 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs | |||
@@ -210,35 +210,35 @@ impl Builder { | |||
210 | resolution: &hir::Resolution, | 210 | resolution: &hir::Resolution, |
211 | ) -> Builder { | 211 | ) -> Builder { |
212 | let resolved = resolution.def_id.map(|d| d.resolve(ctx.db)); | 212 | let resolved = resolution.def_id.map(|d| d.resolve(ctx.db)); |
213 | let kind = match resolved { | 213 | let (kind, docs) = match resolved { |
214 | PerNs { | 214 | PerNs { |
215 | types: Some(hir::Def::Module(..)), | 215 | types: Some(hir::Def::Module(..)), |
216 | .. | 216 | .. |
217 | } => CompletionItemKind::Module, | 217 | } => (CompletionItemKind::Module, None), |
218 | PerNs { | 218 | PerNs { |
219 | types: Some(hir::Def::Struct(..)), | 219 | types: Some(hir::Def::Struct(s)), |
220 | .. | 220 | .. |
221 | } => CompletionItemKind::Struct, | 221 | } => (CompletionItemKind::Struct, s.docs(ctx.db)), |
222 | PerNs { | 222 | PerNs { |
223 | types: Some(hir::Def::Enum(..)), | 223 | types: Some(hir::Def::Enum(e)), |
224 | .. | 224 | .. |
225 | } => CompletionItemKind::Enum, | 225 | } => (CompletionItemKind::Enum, e.docs(ctx.db)), |
226 | PerNs { | 226 | PerNs { |
227 | types: Some(hir::Def::Trait(..)), | 227 | types: Some(hir::Def::Trait(t)), |
228 | .. | 228 | .. |
229 | } => CompletionItemKind::Trait, | 229 | } => (CompletionItemKind::Trait, t.docs(ctx.db)), |
230 | PerNs { | 230 | PerNs { |
231 | types: Some(hir::Def::Type(..)), | 231 | types: Some(hir::Def::Type(t)), |
232 | .. | 232 | .. |
233 | } => CompletionItemKind::TypeAlias, | 233 | } => (CompletionItemKind::TypeAlias, t.docs(ctx.db)), |
234 | PerNs { | 234 | PerNs { |
235 | values: Some(hir::Def::Const(..)), | 235 | values: Some(hir::Def::Const(c)), |
236 | .. | 236 | .. |
237 | } => CompletionItemKind::Const, | 237 | } => (CompletionItemKind::Const, c.docs(ctx.db)), |
238 | PerNs { | 238 | PerNs { |
239 | values: Some(hir::Def::Static(..)), | 239 | values: Some(hir::Def::Static(s)), |
240 | .. | 240 | .. |
241 | } => CompletionItemKind::Static, | 241 | } => (CompletionItemKind::Static, s.docs(ctx.db)), |
242 | PerNs { | 242 | PerNs { |
243 | values: Some(hir::Def::Function(function)), | 243 | values: Some(hir::Def::Function(function)), |
244 | .. | 244 | .. |
@@ -246,6 +246,8 @@ impl Builder { | |||
246 | _ => return self, | 246 | _ => return self, |
247 | }; | 247 | }; |
248 | self.kind = Some(kind); | 248 | self.kind = Some(kind); |
249 | self.documentation = docs; | ||
250 | |||
249 | self | 251 | self |
250 | } | 252 | } |
251 | 253 | ||