mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 02:29:44 +00:00
Merge pull request #20185 from ChayimFriedman2/variant-symbols
feat: Include enum variants in world symbols
This commit is contained in:
commit
5bae4f5c81
2 changed files with 75 additions and 0 deletions
|
|
@ -125,6 +125,13 @@ impl<'a> SymbolCollector<'a> {
|
|||
}
|
||||
ModuleDefId::AdtId(AdtId::EnumId(id)) => {
|
||||
this.push_decl(id, name, false, None);
|
||||
let enum_name = this.db.enum_signature(id).name.as_str().to_smolstr();
|
||||
this.with_container_name(Some(enum_name), |this| {
|
||||
let variants = id.enum_variants(this.db);
|
||||
for (variant_id, variant_name, _) in &variants.variants {
|
||||
this.push_decl(*variant_id, variant_name, true, None);
|
||||
}
|
||||
});
|
||||
}
|
||||
ModuleDefId::AdtId(AdtId::UnionId(id)) => {
|
||||
this.push_decl(id, name, false, None);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue