ruby-syntax-tree / syntax_tree

Interact with the Ruby syntax tree

Home Page:https://ruby-syntax-tree.github.io/syntax_tree/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Method chain ending with block always breaks on multiple lines due to argument

rafbm opened this issue · comments

This remains as-is:

foo.bar.each do |item|
  line_one(item)
  line_two(item)
end

But this…

foo.bar(1).each do |item|
  line_one(item)
  line_two(item)
end

…gets turned into:

foo
  .bar(1)
  .each do |item|
    line_one(item)
    line_two(item)
  end

If there’s no chaining, it remains as-is:

foo(1).each do |item|
  line_one(item)
  line_two(item)
end

More or less reminiscent of prettier/plugin-ruby#729.