diff options
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_dot.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap | 12 |
2 files changed, 14 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index 060a46c5e..bad51cc51 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use hir::{Ty, AdtDef}; | 1 | use hir::{Ty, AdtDef, Docs}; |
2 | 2 | ||
3 | use crate::completion::{CompletionContext, Completions, CompletionItem, CompletionItemKind}; | 3 | use crate::completion::{CompletionContext, Completions, CompletionItem, CompletionItemKind}; |
4 | use crate::completion::completion_item::CompletionKind; | 4 | use crate::completion::completion_item::CompletionKind; |
@@ -38,6 +38,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) | |||
38 | ) | 38 | ) |
39 | .kind(CompletionItemKind::Field) | 39 | .kind(CompletionItemKind::Field) |
40 | .detail(field.ty(ctx.db).subst(substs).to_string()) | 40 | .detail(field.ty(ctx.db).subst(substs).to_string()) |
41 | .set_documentation(field.docs(ctx.db)) | ||
41 | .add_to(acc); | 42 | .add_to(acc); |
42 | } | 43 | } |
43 | } | 44 | } |
@@ -107,7 +108,10 @@ mod tests { | |||
107 | check_ref_completion( | 108 | check_ref_completion( |
108 | "struct_field_completion_self", | 109 | "struct_field_completion_self", |
109 | r" | 110 | r" |
110 | struct A { the_field: (u32,) } | 111 | struct A { |
112 | /// This is the_field | ||
113 | the_field: (u32,) | ||
114 | } | ||
111 | impl A { | 115 | impl A { |
112 | fn foo(self) { | 116 | fn foo(self) { |
113 | self.<|> | 117 | self.<|> |
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap index 80e8f3df5..580e92a90 100644 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap +++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap | |||
@@ -1,5 +1,5 @@ | |||
1 | --- | 1 | --- |
2 | created: "2019-01-23T13:19:23.501297515+00:00" | 2 | created: "2019-01-25T19:27:09.519688600+00:00" |
3 | creator: [email protected] | 3 | creator: [email protected] |
4 | expression: kind_completions | 4 | expression: kind_completions |
5 | source: crates/ra_ide_api/src/completion/completion_item.rs | 5 | source: crates/ra_ide_api/src/completion/completion_item.rs |
@@ -14,11 +14,15 @@ source: crates/ra_ide_api/src/completion/completion_item.rs | |||
14 | detail: Some( | 14 | detail: Some( |
15 | "(u32,)" | 15 | "(u32,)" |
16 | ), | 16 | ), |
17 | documentation: None, | 17 | documentation: Some( |
18 | Documentation( | ||
19 | "This is the_field" | ||
20 | ) | ||
21 | ), | ||
18 | lookup: None, | 22 | lookup: None, |
19 | insert_text: None, | 23 | insert_text: None, |
20 | insert_text_format: PlainText, | 24 | insert_text_format: PlainText, |
21 | source_range: [121; 121), | 25 | source_range: [187; 187), |
22 | text_edit: None | 26 | text_edit: None |
23 | }, | 27 | }, |
24 | CompletionItem { | 28 | CompletionItem { |
@@ -36,7 +40,7 @@ source: crates/ra_ide_api/src/completion/completion_item.rs | |||
36 | "foo()$0" | 40 | "foo()$0" |
37 | ), | 41 | ), |
38 | insert_text_format: Snippet, | 42 | insert_text_format: Snippet, |
39 | source_range: [121; 121), | 43 | source_range: [187; 187), |
40 | text_edit: None | 44 | text_edit: None |
41 | } | 45 | } |
42 | ] | 46 | ] |