diff options
Diffstat (limited to 'crates/ide_completion/src/render/enum_variant.rs')
-rw-r--r-- | crates/ide_completion/src/render/enum_variant.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/ide_completion/src/render/enum_variant.rs b/crates/ide_completion/src/render/enum_variant.rs index e8cfcc0c7..374247b05 100644 --- a/crates/ide_completion/src/render/enum_variant.rs +++ b/crates/ide_completion/src/render/enum_variant.rs | |||
@@ -6,7 +6,8 @@ use itertools::Itertools; | |||
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | item::{CompletionItem, CompletionKind, ImportEdit}, | 8 | item::{CompletionItem, CompletionKind, ImportEdit}, |
9 | render::{builder_ext::Params, RenderContext}, | 9 | render::{builder_ext::Params, compute_exact_type_match, compute_ref_match, RenderContext}, |
10 | CompletionRelevance, | ||
10 | }; | 11 | }; |
11 | 12 | ||
12 | pub(crate) fn render_variant<'a>( | 13 | pub(crate) fn render_variant<'a>( |
@@ -74,6 +75,16 @@ impl<'a> EnumRender<'a> { | |||
74 | item.lookup_by(self.short_qualified_name); | 75 | item.lookup_by(self.short_qualified_name); |
75 | } | 76 | } |
76 | 77 | ||
78 | let ty = self.variant.parent_enum(self.ctx.completion.db).ty(self.ctx.completion.db); | ||
79 | item.set_relevance(CompletionRelevance { | ||
80 | exact_type_match: compute_exact_type_match(self.ctx.completion, &ty), | ||
81 | ..CompletionRelevance::default() | ||
82 | }); | ||
83 | |||
84 | if let Some(ref_match) = compute_ref_match(self.ctx.completion, &ty) { | ||
85 | item.ref_match(ref_match); | ||
86 | } | ||
87 | |||
77 | item.build() | 88 | item.build() |
78 | } | 89 | } |
79 | 90 | ||