Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle properly stringifying single line blocks #15568

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Blacksmoke16
Copy link
Member

Depends on, and is similar to, #15305 but for Block nodes.

Previously code like:

{%
  [1, 2, 3].each { |v| pp v }
  [1, 2, 3].each do |v|
    pp v
  end
%}

Would always stringify single-line blocks as a do/end block:

{% [1, 2, 3].each do |v|
  pp(v)
end
[1, 2, 3].each do |v|
  pp(v)
end
 %}

But now, in-conjunction with the other PR, results in:

{%
  [1, 2, 3].each { |v| pp(v) }
  [1, 2, 3].each do |v|
    pp(v)
  end
%}

I threw a bunch of test cases at it with the assumption the code may not have had the formatter ran on it and all seems 👍.

Marking as draft and skipping CI. Will rebase/trigger CI once the other dependent PR is merged. But wanted to get this opened for feedback.

@Blacksmoke16 Blacksmoke16 changed the title Block string representation Handle properly stringifying single line blocks Mar 18, 2025
@Blacksmoke16 Blacksmoke16 force-pushed the block-string-representation branch from 61b983e to d7c1550 Compare March 19, 2025 12:51
@Blacksmoke16 Blacksmoke16 marked this pull request as ready for review March 19, 2025 12:51
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.

2 participants