mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 13:13:18 +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
					
				@ -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
 | 
					    // prefer descending the same token kind in attribute expansions, in normal macros text
 | 
				
			||||||
    // equivalency is more important
 | 
					    // equivalency is more important
 | 
				
			||||||
    let descended = if in_attr {
 | 
					    let descended = if in_attr {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user