aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/render
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-02-09 20:32:05 +0000
committerLukas Wirth <[email protected]>2021-02-09 20:35:02 +0000
commit5454559c0a45d208db963df105f22f5e17f0340a (patch)
tree6038de6fd6a16ad6edef22a4bef9bd323071dc99 /crates/completion/src/render
parent5d4ae1c8e3b76798fcb5eb656d886fe65a2c7277 (diff)
Show qualified variant pattern completions
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))