mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Don't highlight parent nodes of comments on hover
This commit is contained in:
parent
f304ce329f
commit
37c5b82938
1 changed files with 16 additions and 0 deletions
|
@ -139,6 +139,11 @@ pub(crate) fn hover(
|
|||
}
|
||||
}
|
||||
|
||||
if token.kind() == syntax::SyntaxKind::COMMENT {
|
||||
// don't highlight the entire parent node on comment hover
|
||||
return None;
|
||||
}
|
||||
|
||||
let node = token.ancestors().find(|n| {
|
||||
ast::Expr::can_cast(n.kind())
|
||||
|| ast::Pat::can_cast(n.kind())
|
||||
|
@ -3419,4 +3424,15 @@ mod Foo<|> {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hover_comments_dont_highlight_parent() {
|
||||
check_hover_no_result(
|
||||
r#"
|
||||
fn no_hover() {
|
||||
// no<|>hover
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue