From 6079eeb1bfab07c467da2adb9a06db12454f9d57 Mon Sep 17 00:00:00 2001 From: Luke Chu Date: Tue, 7 Jun 2022 23:29:25 +0000 Subject: [PATCH] Hide param inlay hint when argument is fn-like macro with similar name --- crates/ide/src/inlay_hints.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index 116c1c480a1..2c3009abe90 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs @@ -1095,6 +1095,9 @@ fn get_string_representation(expr: &ast::Expr) -> Option { name_ref => Some(name_ref.to_owned()), } } + ast::Expr::MacroExpr(macro_expr) => { + Some(macro_expr.macro_call()?.path()?.segment()?.to_string()) + } ast::Expr::FieldExpr(field_expr) => Some(field_expr.name_ref()?.to_string()), ast::Expr::PathExpr(path_expr) => Some(path_expr.path()?.segment()?.to_string()), ast::Expr::PrefixExpr(prefix_expr) => get_string_representation(&prefix_expr.expr()?), @@ -1497,6 +1500,11 @@ fn main() { foo(param2); //^^^^^^ param + macro_rules! param { + () => {}; + }; + foo(param!()); + let param_eter = 0; bar(param_eter); let param_eter_end = 0;