@@ -43,7 +43,7 @@ pub(crate) fn render_struct_pat(
43
43
}
44
44
45
45
pub ( crate ) fn render_variant_pat (
46
- ctx : RenderContext < ' _ > ,
46
+ mut ctx : RenderContext < ' _ > ,
47
47
pattern_ctx : & PatternContext ,
48
48
path_ctx : Option < & PathCompletionCtx > ,
49
49
variant : hir:: Variant ,
@@ -56,6 +56,11 @@ pub(crate) fn render_variant_pat(
56
56
let ( visible_fields, fields_omitted) = visible_fields ( ctx. completion , & fields, variant) ?;
57
57
let enum_ty = variant. parent_enum ( ctx. db ( ) ) . ty ( ctx. db ( ) ) ;
58
58
59
+ // Missing in context of match statement completions
60
+ if pattern_ctx. missing_variants . contains ( & variant) {
61
+ ctx. is_variant_missing = Some ( true ) ;
62
+ }
63
+
59
64
let ( name, escaped_name) = match path {
60
65
Some ( path) => ( path. unescaped ( ) . to_string ( ) . into ( ) , path. to_string ( ) . into ( ) ) ,
61
66
None => {
@@ -97,7 +102,9 @@ fn build_completion(
97
102
) -> CompletionItem {
98
103
let mut relevance = ctx. completion_relevance ( ) ;
99
104
100
- relevance. type_match = super :: compute_type_match ( ctx. completion , & adt_ty) ;
105
+ if let Some ( true ) = ctx. is_variant_missing {
106
+ relevance. type_match = super :: compute_type_match ( ctx. completion , & adt_ty) ;
107
+ }
101
108
102
109
let mut item = CompletionItem :: new ( CompletionItemKind :: Binding , ctx. source_range ( ) , label) ;
103
110
item. set_documentation ( ctx. docs ( def) )
0 commit comments