From 04aff742b15ebab39f493ba480d20c61e1f3bdd5 Mon Sep 17 00:00:00 2001 From: adamrk Date: Sat, 15 Feb 2020 21:48:20 +0100 Subject: show names for record fields in enum completion --- crates/ra_hir_def/src/adt.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir_def') diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index aac5f3e15..4582c7314 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs @@ -140,6 +140,13 @@ impl VariantData { self.fields().iter().find_map(|(id, data)| if &data.name == name { Some(id) } else { None }) } + pub fn kind(&self) -> StructKind { + match self { + VariantData::Record(_) => StructKind::Record, + VariantData::Tuple(_) => StructKind::Tuple, + VariantData::Unit => StructKind::Unit, + } + } pub fn is_unit(&self) -> bool { match self { VariantData::Unit => true, @@ -173,7 +180,7 @@ impl HasChildSource for VariantId { } } -enum StructKind { +pub enum StructKind { Tuple, Record, Unit, -- cgit v1.2.3