diff options
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/hover.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index cf04c3de0..ab017d2ad 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -139,6 +139,11 @@ pub(crate) fn hover( | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | if token.kind() == syntax::SyntaxKind::COMMENT { | ||
143 | // don't highlight the entire parent node on comment hover | ||
144 | return None; | ||
145 | } | ||
146 | |||
142 | let node = token.ancestors().find(|n| { | 147 | let node = token.ancestors().find(|n| { |
143 | ast::Expr::can_cast(n.kind()) | 148 | ast::Expr::can_cast(n.kind()) |
144 | || ast::Pat::can_cast(n.kind()) | 149 | || ast::Pat::can_cast(n.kind()) |
@@ -3419,4 +3424,15 @@ mod Foo<|> { | |||
3419 | "#]], | 3424 | "#]], |
3420 | ); | 3425 | ); |
3421 | } | 3426 | } |
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 | } | ||
3422 | } | 3438 | } |