File tree 1 file changed +24
-2
lines changed
src/tools/rust-analyzer/crates/ide/src/inlay_hints
1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ pub(super) fn hints(
54
54
} ;
55
55
let range = match terminator. span {
56
56
MirSpan :: ExprId ( e) => match source_map. expr_syntax ( e) {
57
- Ok ( s) => {
57
+ // don't show inlay hint for macro
58
+ Ok ( s) if !s. file_id . is_macro ( ) => {
58
59
let root = & s. file_syntax ( sema. db ) ;
59
60
let expr = s. value . to_node ( root) ;
60
61
let expr = expr. syntax ( ) ;
@@ -69,7 +70,7 @@ pub(super) fn hints(
69
70
}
70
71
}
71
72
}
72
- Err ( _ ) => continue ,
73
+ _ => continue ,
73
74
} ,
74
75
MirSpan :: PatId ( p) => match source_map. pat_syntax ( p) {
75
76
Ok ( s) => s. value . text_range ( ) ,
@@ -228,6 +229,27 @@ mod tests {
228
229
//^ drop(y)
229
230
}
230
231
//^ drop(x)
232
+ "# ,
233
+ ) ;
234
+ }
235
+
236
+ #[ test]
237
+ fn ignore_inlay_hint_for_macro_call ( ) {
238
+ check_with_config (
239
+ ONLY_DROP_CONFIG ,
240
+ r#"
241
+ struct X;
242
+
243
+ macro_rules! my_macro {
244
+ () => {{
245
+ let bbb = X;
246
+ bbb
247
+ }};
248
+ }
249
+
250
+ fn test() -> X {
251
+ my_macro!()
252
+ }
231
253
"# ,
232
254
) ;
233
255
}
You can’t perform that action at this time.
0 commit comments