mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 23:25:03 +00:00
Improve macro descension API
This commit is contained in:
parent
986577faaa
commit
5b8e386bae
21 changed files with 179 additions and 139 deletions
|
@ -1,4 +1,4 @@
|
|||
use hir::{HirFileIdExt, InFile, Semantics};
|
||||
use hir::{DescendPreference, HirFileIdExt, InFile, Semantics};
|
||||
use ide_db::{
|
||||
base_db::FileId, helpers::pick_best_token,
|
||||
syntax_helpers::insert_whitespace_into_node::insert_ws_into, RootDatabase,
|
||||
|
@ -40,8 +40,10 @@ pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<
|
|||
// struct Bar;
|
||||
// ```
|
||||
|
||||
let derive =
|
||||
sema.descend_into_macros(tok.clone(), 0.into()).into_iter().find_map(|descended| {
|
||||
let derive = sema
|
||||
.descend_into_macros(DescendPreference::None, tok.clone(), 0.into())
|
||||
.into_iter()
|
||||
.find_map(|descended| {
|
||||
let hir_file = sema.hir_file_for(&descended.parent()?);
|
||||
if !hir_file.is_derive_attr_pseudo_expansion(db) {
|
||||
return None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue