diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/presentation.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/presentation.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index 71003104b..28c8f83ab 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! This modules takes care of rendering various defenitions as completion items. | 1 | //! This modules takes care of rendering various defenitions as completion items. |
2 | use join_to_string::join; | 2 | use join_to_string::join; |
3 | use test_utils::tested_by; | 3 | use test_utils::tested_by; |
4 | use hir::{Docs, PerNs, Resolution}; | 4 | use hir::{Docs, PerNs, Resolution, HirDisplay}; |
5 | use ra_syntax::ast::NameOwner; | 5 | use ra_syntax::ast::NameOwner; |
6 | 6 | ||
7 | use crate::completion::{ | 7 | use crate::completion::{ |
@@ -22,7 +22,7 @@ impl Completions { | |||
22 | field.name(ctx.db).to_string(), | 22 | field.name(ctx.db).to_string(), |
23 | ) | 23 | ) |
24 | .kind(CompletionItemKind::Field) | 24 | .kind(CompletionItemKind::Field) |
25 | .detail(field.ty(ctx.db).subst(substs).to_string()) | 25 | .detail(field.ty(ctx.db).subst(substs).display(ctx.db).to_string()) |
26 | .set_documentation(field.docs(ctx.db)) | 26 | .set_documentation(field.docs(ctx.db)) |
27 | .add_to(self); | 27 | .add_to(self); |
28 | } | 28 | } |
@@ -30,7 +30,7 @@ impl Completions { | |||
30 | pub(crate) fn add_pos_field(&mut self, ctx: &CompletionContext, field: usize, ty: &hir::Ty) { | 30 | pub(crate) fn add_pos_field(&mut self, ctx: &CompletionContext, field: usize, ty: &hir::Ty) { |
31 | CompletionItem::new(CompletionKind::Reference, ctx.source_range(), field.to_string()) | 31 | CompletionItem::new(CompletionKind::Reference, ctx.source_range(), field.to_string()) |
32 | .kind(CompletionItemKind::Field) | 32 | .kind(CompletionItemKind::Field) |
33 | .detail(ty.to_string()) | 33 | .detail(ty.display(ctx.db).to_string()) |
34 | .add_to(self); | 34 | .add_to(self); |
35 | } | 35 | } |
36 | 36 | ||
@@ -154,7 +154,10 @@ impl Completions { | |||
154 | None => return, | 154 | None => return, |
155 | }; | 155 | }; |
156 | let detail_types = variant.fields(ctx.db).into_iter().map(|field| field.ty(ctx.db)); | 156 | let detail_types = variant.fields(ctx.db).into_iter().map(|field| field.ty(ctx.db)); |
157 | let detail = join(detail_types).separator(", ").surround_with("(", ")").to_string(); | 157 | let detail = join(detail_types.map(|t| t.display(ctx.db).to_string())) |
158 | .separator(", ") | ||
159 | .surround_with("(", ")") | ||
160 | .to_string(); | ||
158 | 161 | ||
159 | CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name.to_string()) | 162 | CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name.to_string()) |
160 | .kind(CompletionItemKind::EnumVariant) | 163 | .kind(CompletionItemKind::EnumVariant) |