Skip to content

Commit 37c5b82

Browse files
committed
Don't highlight parent nodes of comments on hover
1 parent f304ce3 commit 37c5b82

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

crates/ide/src/hover.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ pub(crate) fn hover(
139139
}
140140
}
141141

142+
if token.kind() == syntax::SyntaxKind::COMMENT {
143+
// don't highlight the entire parent node on comment hover
144+
return None;
145+
}
146+
142147
let node = token.ancestors().find(|n| {
143148
ast::Expr::can_cast(n.kind())
144149
|| ast::Pat::can_cast(n.kind())
@@ -3419,4 +3424,15 @@ mod Foo<|> {
34193424
"#]],
34203425
);
34213426
}
3427+
3428+
#[test]
3429+
fn hover_comments_dont_highlight_parent() {
3430+
check_hover_no_result(
3431+
r#"
3432+
fn no_hover() {
3433+
// no<|>hover
3434+
}
3435+
"#,
3436+
);
3437+
}
34223438
}

0 commit comments

Comments
 (0)