Skip to content

Commit c6a9fbf

Browse files
committed
Auto merge of rust-lang#12939 - jean-santos:errors-ide-hover-wrong-place, r=Veykril
Error Diagnostics appear in the wrong place Fix rust-lang#12436
2 parents 4904b2b + 5698e51 commit c6a9fbf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

crates/ide/src/hover.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,12 @@ fn hover_type_fallback(
232232
token: &SyntaxToken,
233233
original_token: &SyntaxToken,
234234
) -> Option<RangeInfo<HoverResult>> {
235-
let node = token
236-
.parent_ancestors()
237-
.take_while(|it| !ast::Item::can_cast(it.kind()))
238-
.find(|n| ast::Expr::can_cast(n.kind()) || ast::Pat::can_cast(n.kind()))?;
235+
let node =
236+
token.parent_ancestors().take_while(|it| !ast::Item::can_cast(it.kind())).find(|n| {
237+
ast::Expr::can_cast(n.kind())
238+
|| ast::Pat::can_cast(n.kind())
239+
|| ast::Type::can_cast(n.kind())
240+
})?;
239241

240242
let expr_or_pat = match_ast! {
241243
match node {

0 commit comments

Comments
 (0)