Skip to content

Commit add8539

Browse files
committed
Auto merge of rust-lang#13604 - Veykril:hover-attr, r=Veykril
fix: Fix hover in attributed items not preferring similar kinded tokens
2 parents 57cc2a6 + e50712c commit add8539

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/ide/src/hover.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,14 @@ pub(crate) fn hover(
119119
});
120120
}
121121

122-
let in_attr = matches!(original_token.parent().and_then(ast::TokenTree::cast), Some(tt) if tt.syntax().ancestors().any(|it| ast::Meta::can_cast(it.kind())));
122+
let in_attr = original_token
123+
.parent_ancestors()
124+
.filter_map(ast::Item::cast)
125+
.any(|item| sema.is_attr_macro_call(&item))
126+
&& !matches!(
127+
original_token.parent().and_then(ast::TokenTree::cast),
128+
Some(tt) if tt.syntax().ancestors().any(|it| ast::Meta::can_cast(it.kind()))
129+
);
123130
// prefer descending the same token kind in attribute expansions, in normal macros text
124131
// equivalency is more important
125132
let descended = if in_attr {

0 commit comments

Comments
 (0)