Skip to content

Handle significant whitespace before a blocks body#15692

Merged
straight-shoota merged 2 commits intocrystal-lang:masterfrom
Blacksmoke16:sig-whitespace-before-block-body
Apr 25, 2025
Merged

Handle significant whitespace before a blocks body#15692
straight-shoota merged 2 commits intocrystal-lang:masterfrom
Blacksmoke16:sig-whitespace-before-block-body

Conversation

@Blacksmoke16
Copy link
Member

Follow up to #15568 to handle the case of significant whitespace before a block's body.

Previously code like:

{%
  ({"a" => "b"} of Nil => Nil).each do |k, v|
    # stuff and things
    k + v

    # foo bar

    k + v
  end
%}

Would always be stringified as:

{%
  ({"a" => "b"} of Nil => Nil).each do |k, v|
    k + v



    k + v
  end
%}

But now results in:

{%
  ({"a" => "b"} of Nil => Nil).each do |k, v|
  
    k + v
  
  
  
    k + v
  end
%}

@straight-shoota straight-shoota added this to the 1.17.0 milestone Apr 22, 2025
@straight-shoota straight-shoota merged commit ebc1cae into crystal-lang:master Apr 25, 2025
34 checks passed
@Blacksmoke16 Blacksmoke16 deleted the sig-whitespace-before-block-body branch April 25, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants