From 2d34cabdf7958def6ef4c76391c9cb0d17e03d3f Mon Sep 17 00:00:00 2001 From: Reese Williams Date: Thu, 25 Dec 2025 15:10:11 -0600 Subject: [PATCH] [ripper] Don't indent multiline block vars for brace blocks --- fixtures/small/long_blockvar_actual.rb | 13 +++++++++++++ fixtures/small/long_blockvar_expected.rb | 14 ++++++++++++++ librubyfmt/src/format.rs | 4 +++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/fixtures/small/long_blockvar_actual.rb b/fixtures/small/long_blockvar_actual.rb index d85153def..ae6720a51 100644 --- a/fixtures/small/long_blockvar_actual.rb +++ b/fixtures/small/long_blockvar_actual.rb @@ -10,3 +10,16 @@ | do_things! end + +things.each { | + omg:, + really:, + dang:, + long:, + blockvar:, + that_is_so_long_if_you_write_this:, + you_should_refactor:, + like_really_this_is_so_long: + | + do_things! +} diff --git a/fixtures/small/long_blockvar_expected.rb b/fixtures/small/long_blockvar_expected.rb index 11f860309..7bc1006e4 100644 --- a/fixtures/small/long_blockvar_expected.rb +++ b/fixtures/small/long_blockvar_expected.rb @@ -11,3 +11,17 @@ | do_things! end + +things + .each { | + omg:, + really:, + dang:, + long:, + blockvar:, + that_is_so_long_if_you_write_this:, + you_should_refactor:, + like_really_this_is_so_long: + | + do_things! + } diff --git a/librubyfmt/src/format.rs b/librubyfmt/src/format.rs index 1ca6dc2b3..7b74a7ffb 100644 --- a/librubyfmt/src/format.rs +++ b/librubyfmt/src/format.rs @@ -2650,7 +2650,9 @@ pub fn format_brace_block(ps: &mut ParserState, brace_block: BraceBlock) { ps.inline_breakable_of(BreakableDelims::for_brace_block(), |ps| { if let Some(bv) = bv { - format_blockvar(ps, bv); + ps.dedent(|ps| { + format_blockvar(ps, bv); + }); } render_block_contents(ps, brace_block_render_method, body, end_line);