Auto merge of - jean-santos:errors-ide-hover-wrong-place, r=Veykril

Error Diagnostics appear in the wrong place

Fix 
This commit is contained in:
bors 2022-08-04 12:42:51 +00:00
commit c6a9fbfd00

@ -232,10 +232,12 @@ fn hover_type_fallback(
token: &SyntaxToken, token: &SyntaxToken,
original_token: &SyntaxToken, original_token: &SyntaxToken,
) -> Option<RangeInfo<HoverResult>> { ) -> Option<RangeInfo<HoverResult>> {
let node = token let node =
.parent_ancestors() token.parent_ancestors().take_while(|it| !ast::Item::can_cast(it.kind())).find(|n| {
.take_while(|it| !ast::Item::can_cast(it.kind())) ast::Expr::can_cast(n.kind())
.find(|n| ast::Expr::can_cast(n.kind()) || ast::Pat::can_cast(n.kind()))?; || ast::Pat::can_cast(n.kind())
|| ast::Type::can_cast(n.kind())
})?;
let expr_or_pat = match_ast! { let expr_or_pat = match_ast! {
match node { match node {