mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
fix: Fix multiple derives in one attribute not expanding all in expand_macro
This commit is contained in:
parent
3f9f63c1bd
commit
0f3617f76f
6 changed files with 59 additions and 19 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
use either::Either;
|
||||
use hir_expand::HirFileId;
|
||||
use itertools::Itertools;
|
||||
use syntax::ast::AttrsOwner;
|
||||
|
||||
use crate::{
|
||||
|
@ -109,10 +110,13 @@ impl ChildBySource for ItemScope {
|
|||
let item = ast_id.with_value(ast_id.to_node(db.upcast()));
|
||||
res[keys::ATTR_MACRO].insert(item, call_id);
|
||||
});
|
||||
self.derive_macro_invocs().for_each(|(ast_id, (attr_id, call_id))| {
|
||||
self.derive_macro_invocs().for_each(|(ast_id, calls)| {
|
||||
let item = ast_id.to_node(db.upcast());
|
||||
if let Some(attr) = item.attrs().nth(attr_id.ast_index as usize) {
|
||||
res[keys::DERIVE_MACRO].insert(ast_id.with_value(attr), call_id);
|
||||
let grouped = calls.iter().copied().into_group_map();
|
||||
for (attr_id, calls) in grouped {
|
||||
if let Some(attr) = item.attrs().nth(attr_id.ast_index as usize) {
|
||||
res[keys::DERIVE_MACRO].insert(ast_id.with_value(attr), calls.into());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue