diff options
Diffstat (limited to 'crates/ide_completion/src/completions.rs')
-rw-r--r-- | crates/ide_completion/src/completions.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/crates/ide_completion/src/completions.rs b/crates/ide_completion/src/completions.rs index 151bf3783..ffdcdc930 100644 --- a/crates/ide_completion/src/completions.rs +++ b/crates/ide_completion/src/completions.rs | |||
@@ -69,18 +69,25 @@ impl Completions { | |||
69 | items.into_iter().for_each(|item| self.add(item.into())) | 69 | items.into_iter().for_each(|item| self.add(item.into())) |
70 | } | 70 | } |
71 | 71 | ||
72 | pub(crate) fn add_field(&mut self, ctx: &CompletionContext, field: hir::Field, ty: &hir::Type) { | 72 | pub(crate) fn add_field( |
73 | let item = render_field(RenderContext::new(ctx), field, ty); | 73 | &mut self, |
74 | ctx: &CompletionContext, | ||
75 | receiver: Option<hir::Name>, | ||
76 | field: hir::Field, | ||
77 | ty: &hir::Type, | ||
78 | ) { | ||
79 | let item = render_field(RenderContext::new(ctx), receiver, field, ty); | ||
74 | self.add(item); | 80 | self.add(item); |
75 | } | 81 | } |
76 | 82 | ||
77 | pub(crate) fn add_tuple_field( | 83 | pub(crate) fn add_tuple_field( |
78 | &mut self, | 84 | &mut self, |
79 | ctx: &CompletionContext, | 85 | ctx: &CompletionContext, |
86 | receiver: Option<hir::Name>, | ||
80 | field: usize, | 87 | field: usize, |
81 | ty: &hir::Type, | 88 | ty: &hir::Type, |
82 | ) { | 89 | ) { |
83 | let item = render_tuple_field(RenderContext::new(ctx), field, ty); | 90 | let item = render_tuple_field(RenderContext::new(ctx), receiver, field, ty); |
84 | self.add(item); | 91 | self.add(item); |
85 | } | 92 | } |
86 | 93 | ||
@@ -132,9 +139,11 @@ impl Completions { | |||
132 | &mut self, | 139 | &mut self, |
133 | ctx: &CompletionContext, | 140 | ctx: &CompletionContext, |
134 | func: hir::Function, | 141 | func: hir::Function, |
142 | receiver: Option<hir::Name>, | ||
135 | local_name: Option<hir::Name>, | 143 | local_name: Option<hir::Name>, |
136 | ) { | 144 | ) { |
137 | if let Some(item) = render_method(RenderContext::new(ctx), None, local_name, func) { | 145 | if let Some(item) = render_method(RenderContext::new(ctx), None, receiver, local_name, func) |
146 | { | ||
138 | self.add(item) | 147 | self.add(item) |
139 | } | 148 | } |
140 | } | 149 | } |