Skip to content

Commit 6079eeb

Browse files
committed
Hide param inlay hint when argument is fn-like macro with similar name
1 parent 66a8421 commit 6079eeb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/ide/src/inlay_hints.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,9 @@ fn get_string_representation(expr: &ast::Expr) -> Option<String> {
10951095
name_ref => Some(name_ref.to_owned()),
10961096
}
10971097
}
1098+
ast::Expr::MacroExpr(macro_expr) => {
1099+
Some(macro_expr.macro_call()?.path()?.segment()?.to_string())
1100+
}
10981101
ast::Expr::FieldExpr(field_expr) => Some(field_expr.name_ref()?.to_string()),
10991102
ast::Expr::PathExpr(path_expr) => Some(path_expr.path()?.segment()?.to_string()),
11001103
ast::Expr::PrefixExpr(prefix_expr) => get_string_representation(&prefix_expr.expr()?),
@@ -1497,6 +1500,11 @@ fn main() {
14971500
foo(param2);
14981501
//^^^^^^ param
14991502
1503+
macro_rules! param {
1504+
() => {};
1505+
};
1506+
foo(param!());
1507+
15001508
let param_eter = 0;
15011509
bar(param_eter);
15021510
let param_eter_end = 0;

0 commit comments

Comments
 (0)