diff options
author | adamrk <[email protected]> | 2020-02-15 20:48:20 +0000 |
---|---|---|
committer | adamrk <[email protected]> | 2020-02-16 15:10:23 +0000 |
commit | 04aff742b15ebab39f493ba480d20c61e1f3bdd5 (patch) | |
tree | b2b11fc1bbf48128b4694cb4eed0b734a8500d81 /crates/ra_hir_def | |
parent | b2b94cbf71738e7bc372328f22c8dcc8c734b34c (diff) |
show names for record fields in enum completion
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/adt.rs | 9 |
1 files changed, 8 insertions, 1 deletions
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 { | |||
140 | self.fields().iter().find_map(|(id, data)| if &data.name == name { Some(id) } else { None }) | 140 | self.fields().iter().find_map(|(id, data)| if &data.name == name { Some(id) } else { None }) |
141 | } | 141 | } |
142 | 142 | ||
143 | pub fn kind(&self) -> StructKind { | ||
144 | match self { | ||
145 | VariantData::Record(_) => StructKind::Record, | ||
146 | VariantData::Tuple(_) => StructKind::Tuple, | ||
147 | VariantData::Unit => StructKind::Unit, | ||
148 | } | ||
149 | } | ||
143 | pub fn is_unit(&self) -> bool { | 150 | pub fn is_unit(&self) -> bool { |
144 | match self { | 151 | match self { |
145 | VariantData::Unit => true, | 152 | VariantData::Unit => true, |
@@ -173,7 +180,7 @@ impl HasChildSource for VariantId { | |||
173 | } | 180 | } |
174 | } | 181 | } |
175 | 182 | ||
176 | enum StructKind { | 183 | pub enum StructKind { |
177 | Tuple, | 184 | Tuple, |
178 | Record, | 185 | Record, |
179 | Unit, | 186 | Unit, |