diff options
| author | Luke Chu <lukewchu@outlook.com> | 2022-06-07 23:29:25 +0000 |
|---|---|---|
| committer | Luke Chu <37006668+lukechu10@users.noreply.github.com> | 2022-06-08 14:37:57 +0000 |
| commit | 6079eeb1bfab07c467da2adb9a06db12454f9d57 (patch) | |
| tree | a5a20b469c0d2956133d1dfdcce44c8d38165f43 | |
| parent | 66a842124b52cb005e9dee4605df161badb295e0 (diff) | |
| download | rust-6079eeb1bfab07c467da2adb9a06db12454f9d57.tar.gz rust-6079eeb1bfab07c467da2adb9a06db12454f9d57.zip | |
Hide param inlay hint when argument is fn-like macro with similar name
| -rw-r--r-- | crates/ide/src/inlay_hints.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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<String> { 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; |
