mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
fcf15cc05a
3169: Show record field names in Enum completion r=flodiebold a=adamrk Adresses https://github.com/rust-analyzer/rust-analyzer/issues/2947. Previously the details shown when autocompleting an Enum variant would look like the variant was a tuple even if it was a record: ![2020-02-16-15:59:32_crop](https://user-images.githubusercontent.com/16367467/74607233-64f21980-50d7-11ea-99db-e973e29c71d7.png) This change will show the names of the fields for a record and use curly braces instead of parentheses: ![2020-02-16-15:33:00_crop](https://user-images.githubusercontent.com/16367467/74607251-8ce17d00-50d7-11ea-9d4d-38d198a4aec0.png) This required exposing the type `adt::StructKind` from `ra_hir` and adding a function ``` kind(self, db: &impl HirDatabase) -> StructKind ``` in the `impl` of `EnumVariant`. There was also a previously existing function `is_unit(self, db: &impl HirDatabase) -> bool` for `EnumVariant` which I removed because it seemed redundant after adding `kind`. Co-authored-by: adamrk <ark.email@gmail.com> |
||
---|---|---|
.. | ||
body | ||
nameres | ||
path | ||
adt.rs | ||
attr.rs | ||
body.rs | ||
builtin_type.rs | ||
child_by_source.rs | ||
data.rs | ||
db.rs | ||
diagnostics.rs | ||
docs.rs | ||
dyn_map.rs | ||
expr.rs | ||
find_path.rs | ||
generics.rs | ||
item_scope.rs | ||
keys.rs | ||
lang_item.rs | ||
lib.rs | ||
marks.rs | ||
nameres.rs | ||
path.rs | ||
per_ns.rs | ||
resolver.rs | ||
src.rs | ||
test_db.rs | ||
trace.rs | ||
type_ref.rs | ||
visibility.rs |