diff --git a/crates/ide-db/src/syntax_helpers/insert_whitespace_into_node.rs b/crates/ide-db/src/syntax_helpers/insert_whitespace_into_node.rs index 16e609b1a7e..b5db8c1967b 100644 --- a/crates/ide-db/src/syntax_helpers/insert_whitespace_into_node.rs +++ b/crates/ide-db/src/syntax_helpers/insert_whitespace_into_node.rs @@ -57,7 +57,7 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode { |f: fn(SyntaxKind) -> bool, default| -> bool { last.map(f).unwrap_or(default) }; match tok.kind() { - k if is_text(k) && is_next(|it| !it.is_punct(), true) => { + k if is_text(k) && is_next(|it| !it.is_punct() || it == UNDERSCORE, false) => { mods.push(do_ws(after, tok)); } L_CURLY if is_next(|it| it != R_CURLY, true) => { @@ -118,5 +118,5 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode { } fn is_text(k: SyntaxKind) -> bool { - k.is_keyword() || k.is_literal() || k == IDENT + k.is_keyword() || k.is_literal() || k == IDENT || k == UNDERSCORE } diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs index e4061016e60..290f797c5e8 100644 --- a/crates/ide/src/expand_macro.rs +++ b/crates/ide/src/expand_macro.rs @@ -385,7 +385,7 @@ fn main() { "#, expect![[r#" foo - 0 "#]], + 0"#]], ); }