File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
src/tools/rust-analyzer/crates/ide/src/inlay_hints Expand file tree Collapse file tree 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(
5454 } ;
5555 let range = match terminator. span {
5656 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 ( ) => {
5859 let root = & s. file_syntax ( sema. db ) ;
5960 let expr = s. value . to_node ( root) ;
6061 let expr = expr. syntax ( ) ;
@@ -69,7 +70,7 @@ pub(super) fn hints(
6970 }
7071 }
7172 }
72- Err ( _ ) => continue ,
73+ _ => continue ,
7374 } ,
7475 MirSpan :: PatId ( p) => match source_map. pat_syntax ( p) {
7576 Ok ( s) => s. value . text_range ( ) ,
@@ -228,6 +229,27 @@ mod tests {
228229 //^ drop(y)
229230 }
230231 //^ 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+ }
231253"# ,
232254 ) ;
233255 }
You can’t perform that action at this time.
0 commit comments