aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src')
-rw-r--r--crates/ide_completion/src/item.rs15
-rw-r--r--crates/ide_completion/src/render.rs8
2 files changed, 11 insertions, 12 deletions
diff --git a/crates/ide_completion/src/item.rs b/crates/ide_completion/src/item.rs
index 9b039e3e5..b16f0775a 100644
--- a/crates/ide_completion/src/item.rs
+++ b/crates/ide_completion/src/item.rs
@@ -208,7 +208,7 @@ impl CompletionItem {
208 lookup: None, 208 lookup: None,
209 kind: None, 209 kind: None,
210 text_edit: None, 210 text_edit: None,
211 deprecated: None, 211 deprecated: false,
212 trigger_call_info: None, 212 trigger_call_info: None,
213 score: None, 213 score: None,
214 ref_match: None, 214 ref_match: None,
@@ -308,7 +308,7 @@ pub(crate) struct Builder {
308 lookup: Option<String>, 308 lookup: Option<String>,
309 kind: Option<CompletionItemKind>, 309 kind: Option<CompletionItemKind>,
310 text_edit: Option<TextEdit>, 310 text_edit: Option<TextEdit>,
311 deprecated: Option<bool>, 311 deprecated: bool,
312 trigger_call_info: Option<bool>, 312 trigger_call_info: Option<bool>,
313 score: Option<CompletionScore>, 313 score: Option<CompletionScore>,
314 ref_match: Option<(Mutability, CompletionScore)>, 314 ref_match: Option<(Mutability, CompletionScore)>,
@@ -355,7 +355,7 @@ impl Builder {
355 lookup, 355 lookup,
356 kind: self.kind, 356 kind: self.kind,
357 completion_kind: self.completion_kind, 357 completion_kind: self.completion_kind,
358 deprecated: self.deprecated.unwrap_or(false), 358 deprecated: self.deprecated,
359 trigger_call_info: self.trigger_call_info.unwrap_or(false), 359 trigger_call_info: self.trigger_call_info.unwrap_or(false),
360 score: self.score, 360 score: self.score,
361 ref_match: self.ref_match, 361 ref_match: self.ref_match,
@@ -415,7 +415,7 @@ impl Builder {
415 self 415 self
416 } 416 }
417 pub(crate) fn set_deprecated(mut self, deprecated: bool) -> Builder { 417 pub(crate) fn set_deprecated(mut self, deprecated: bool) -> Builder {
418 self.deprecated = Some(deprecated); 418 self.deprecated = deprecated;
419 self 419 self
420 } 420 }
421 pub(crate) fn set_score(mut self, score: CompletionScore) -> Builder { 421 pub(crate) fn set_score(mut self, score: CompletionScore) -> Builder {
@@ -430,11 +430,8 @@ impl Builder {
430 self.import_to_add = import_to_add; 430 self.import_to_add = import_to_add;
431 self 431 self
432 } 432 }
433 pub(crate) fn set_ref_match( 433 pub(crate) fn ref_match(mut self, ref_match: (Mutability, CompletionScore)) -> Builder {
434 mut self, 434 self.ref_match = Some(ref_match);
435 ref_match: Option<(Mutability, CompletionScore)>,
436 ) -> Builder {
437 self.ref_match = ref_match;
438 self 435 self
439 } 436 }
440} 437}
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index fae5685e2..0a6ac8804 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -246,7 +246,6 @@ impl<'a> Render<'a> {
246 } 246 }
247 }; 247 };
248 248
249 let mut ref_match = None;
250 if let ScopeDef::Local(local) = resolution { 249 if let ScopeDef::Local(local) = resolution {
251 if let Some((active_name, active_type)) = self.ctx.active_name_and_type() { 250 if let Some((active_name, active_type)) = self.ctx.active_name_and_type() {
252 let ty = local.ty(self.ctx.db()); 251 let ty = local.ty(self.ctx.db());
@@ -255,7 +254,11 @@ impl<'a> Render<'a> {
255 { 254 {
256 item = item.set_score(score); 255 item = item.set_score(score);
257 } 256 }
258 ref_match = refed_type_matches(&active_type, &active_name, &ty, &local_name); 257 if let Some(ref_match) =
258 refed_type_matches(&active_type, &active_name, &ty, &local_name)
259 {
260 item = item.ref_match(ref_match);
261 }
259 } 262 }
260 } 263 }
261 264
@@ -285,7 +288,6 @@ impl<'a> Render<'a> {
285 Some( 288 Some(
286 item.kind(kind) 289 item.kind(kind)
287 .add_import(import_to_add) 290 .add_import(import_to_add)
288 .set_ref_match(ref_match)
289 .set_documentation(self.docs(resolution)) 291 .set_documentation(self.docs(resolution))
290 .set_deprecated(self.is_deprecated(resolution)) 292 .set_deprecated(self.is_deprecated(resolution))
291 .build(), 293 .build(),