aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'crates/completion/src/render')
-rw-r--r--crates/completion/src/render/pattern.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/completion/src/render/pattern.rs b/crates/completion/src/render/pattern.rs
index 61d8a17e5..465dfe00c 100644
--- a/crates/completion/src/render/pattern.rs
+++ b/crates/completion/src/render/pattern.rs
@@ -49,13 +49,17 @@ pub(crate) fn render_variant_pat(
49 ctx: RenderContext<'_>, 49 ctx: RenderContext<'_>,
50 variant: hir::Variant, 50 variant: hir::Variant,
51 local_name: Option<Name>, 51 local_name: Option<Name>,
52 path: Option<hir::ModPath>,
52) -> Option<CompletionItem> { 53) -> Option<CompletionItem> {
53 let _p = profile::span("render_variant_pat"); 54 let _p = profile::span("render_variant_pat");
54 55
55 let fields = variant.fields(ctx.db()); 56 let fields = variant.fields(ctx.db());
56 let (visible_fields, fields_omitted) = visible_fields(&ctx, &fields, variant)?; 57 let (visible_fields, fields_omitted) = visible_fields(&ctx, &fields, variant)?;
57 58
58 let name = local_name.unwrap_or_else(|| variant.name(ctx.db())).to_string(); 59 let name = match &path {
60 Some(path) => path.to_string(),
61 None => local_name.unwrap_or_else(|| variant.name(ctx.db())).to_string(),
62 };
59 let pat = render_pat(&ctx, &name, variant.kind(ctx.db()), &visible_fields, fields_omitted)?; 63 let pat = render_pat(&ctx, &name, variant.kind(ctx.db()), &visible_fields, fields_omitted)?;
60 64
61 Some(build_completion(ctx, name, pat, variant)) 65 Some(build_completion(ctx, name, pat, variant))