Skip to content

Commit fccc129

Browse files
author
Jonas Schievink
committed
Add closing brace hints for macros
1 parent 867a7dc commit fccc129

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

crates/ide/src/inlay_hints.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@ fn closing_brace_hints(
209209
_ => return None,
210210
}
211211
}
212+
} else if let Some(mac) = ast::MacroCall::cast(node.clone()) {
213+
let last_token = mac.syntax().last_token()?;
214+
if last_token.kind() != T![;] && last_token.kind() != SyntaxKind::R_CURLY {
215+
return None;
216+
}
217+
closing_token = last_token;
218+
219+
format!("{}!", mac.path()?)
212220
} else {
213221
return None;
214222
};
@@ -2433,6 +2441,22 @@ const _: () = {
24332441
mod m {
24342442
}
24352443
//^ mod m
2444+
2445+
m! {}
2446+
m!();
2447+
m!(
2448+
);
2449+
//^ m!
2450+
2451+
m! {
2452+
}
2453+
//^ m!
2454+
2455+
fn f() {
2456+
let v = vec![
2457+
];
2458+
}
2459+
//^ fn f
24362460
"#,
24372461
);
24382462
}

0 commit comments

Comments
 (0)