Don't ignore hover documentation setting for keyword hovers

This commit is contained in:
Lukas Wirth 2021-06-14 15:31:14 +02:00
parent a93d166f0f
commit 9043c5db86

View file

@ -181,7 +181,8 @@ pub(crate) fn hover(
} }
} }
if let res @ Some(_) = hover_for_keyword(&sema, links_in_hover, markdown, &token) { if let res @ Some(_) = hover_for_keyword(&sema, links_in_hover, markdown, documentation, &token)
{
return res; return res;
} }
@ -504,9 +505,10 @@ fn hover_for_keyword(
sema: &hir::Semantics<RootDatabase>, sema: &hir::Semantics<RootDatabase>,
links_in_hover: bool, links_in_hover: bool,
markdown: bool, markdown: bool,
documentation: bool,
token: &SyntaxToken, token: &SyntaxToken,
) -> Option<RangeInfo<HoverResult>> { ) -> Option<RangeInfo<HoverResult>> {
if !token.kind().is_keyword() { if !token.kind().is_keyword() || documentation {
return None; return None;
} }
let famous_defs = FamousDefs(sema, sema.scope(&token.parent()?).krate()); let famous_defs = FamousDefs(sema, sema.scope(&token.parent()?).krate());