-
Notifications
You must be signed in to change notification settings - Fork 25
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
Improve multiline formatting #7
base: main
Are you sure you want to change the base?
Conversation
@i-tsvetkov sorry for the delay, this fell completely off the radar 📡 First of all thanks for taking the time to dig into the code, that was brave! 😄 I'm a bit conflicted about the change, my initial drive for ruby code was for having it indented relatively to the beginning of the ERB tags (like it is currently) and for parentheses-less method calls the workaround was to add parens. In my view the ideal situation would align to the method call for parens-less calls and as explained above when parens are present. Thoughts? |
Hi @elia, I'm glad you found the time to look into this PR. I saw that you have extracted the upgrade of [1, 2, 3].each do |i|
puts i
end into single-line form [1, 2, 3].each { |i| puts i } That issue was resolved by this commit. Regarding the question about the indentation - I think that multi-line code should be indented relative to the start of the ERB tag content (right after the Here is an example with an # relative to the start of the ERB tag content
# the if-else-end is vertically aligned
<%= if rand < 0.5
puts 1
else
puts 2
end %>
# relative to the start of the ERB tag itself
# the if-else-end is not vertically aligned
<%= if rand < 0.5
puts 1
else
puts 2
end %> What do you think? |
@elia Any update on this PR? |
Hello, Thanks for I was wondering where you'd like to take this PR? I find the proposed style to be nicer than current. In fact, when trying out Thank you! |
Hey @elia We've manually updated the gem locally with this PR changes, and has been working great so far. Any chance you could revisit this? |
@mtomov on it, thanks for the ping, I'm pondering options 🙏 |
…blocks with curly braces by syntax_tree
314f847
to
72d613e
Compare
syntax_tree
to the latest version.