mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Expand derive macros under cursor in Expand Macro Recursively
This commit is contained in:
parent
6287d388c0
commit
d99b81f839
7 changed files with 90 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
use either::Either;
|
||||
use hir_expand::HirFileId;
|
||||
use syntax::ast::AttrsOwner;
|
||||
|
||||
use crate::{
|
||||
db::DefDatabase,
|
||||
|
@ -108,6 +109,12 @@ 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))| {
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
fn add_module_def(
|
||||
db: &dyn DefDatabase,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue