aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-11 15:02:57 +0000
committerGitHub <[email protected]>2020-12-11 15:02:57 +0000
commitdf1f3907af965ee1a723fa529dbb2351fb9a008f (patch)
tree111689ca7aef1f9f4f13b7ec263dd45048e266d6 /crates/ide/src
parent57ea320ffc7668b58e7503a14ecc50cea19605ca (diff)
parent37c5b82938040c89a2b7a3756e8bd9b3ae3badd2 (diff)
Merge #6824
6824: Don't highlight parent nodes of comments on hover r=kjeremy a=Veykril Fixes #6815 Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/hover.rs16
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#"
3432fn no_hover() {
3433 // no<|>hover
3434}
3435"#,
3436 );
3437 }
3422} 3438}