From b454f11f381ab1122772a0c48c8265baa91c33d1 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 5 Mar 2022 23:47:44 +0100 Subject: [PATCH] Fix hover for `Self` keyword --- crates/hir_def/src/macro_expansion_tests.rs | 1 + crates/ide/src/hover/render.rs | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/hir_def/src/macro_expansion_tests.rs b/crates/hir_def/src/macro_expansion_tests.rs index 1a7d9aa8411..f86d87d5cc8 100644 --- a/crates/hir_def/src/macro_expansion_tests.rs +++ b/crates/hir_def/src/macro_expansion_tests.rs @@ -302,6 +302,7 @@ fn pretty_print_macro_expansion(expn: SyntaxNode, map: Option<&TokenMap>) -> Str (T![fn], T!['(']) => "", (T![']'], _) if curr_kind.is_keyword() => " ", (T![']'], T![#]) => "\n", + (T![Self], T![::]) => "", _ if prev_kind.is_keyword() => " ", _ => "", }; diff --git a/crates/ide/src/hover/render.rs b/crates/ide/src/hover/render.rs index 40a647c90b2..f8ac43bbddb 100644 --- a/crates/ide/src/hover/render.rs +++ b/crates/ide/src/hover/render.rs @@ -545,7 +545,6 @@ fn keyword_hints( }, } } - T![fn] => { let module = match ast::FnPtrType::cast(parent) { // treat fn keyword inside function pointer type as primitive @@ -554,7 +553,7 @@ fn keyword_hints( }; KeywordHint::new(token.text().to_string(), module) } - + T![Self] => KeywordHint::new(token.text().to_string(), "self_upper_keyword".into()), _ => KeywordHint::new(token.text().to_string(), format!("{}_keyword", token.text())), } }