mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 13:33:31 +00:00
Auto merge of #13604 - Veykril:hover-attr, r=Veykril
fix: Fix hover in attributed items not preferring similar kinded tokens
This commit is contained in:
commit
add85397ae
1 changed files with 8 additions and 1 deletions
|
@ -119,7 +119,14 @@ pub(crate) fn hover(
|
|||
});
|
||||
}
|
||||
|
||||
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())));
|
||||
let in_attr = original_token
|
||||
.parent_ancestors()
|
||||
.filter_map(ast::Item::cast)
|
||||
.any(|item| sema.is_attr_macro_call(&item))
|
||||
&& !matches!(
|
||||
original_token.parent().and_then(ast::TokenTree::cast),
|
||||
Some(tt) if tt.syntax().ancestors().any(|it| ast::Meta::can_cast(it.kind()))
|
||||
);
|
||||
// prefer descending the same token kind in attribute expansions, in normal macros text
|
||||
// equivalency is more important
|
||||
let descended = if in_attr {
|
||||
|
|
Loading…
Reference in a new issue