class Rufo::Formatter

def visit_call_at_paren(node, args)

def visit_call_at_paren(node, args)
  consume_token :on_lparen
  # If there's a trailing comma then comes [:arg_paren, args],
  # which is a bit unexpected, so we fix it
  if args[1].is_a?(Array) && args[1][0].is_a?(Array)
    args_node = [:args_add_block, args[1], false]
  else
    args_node = args[1]
  end
  if args_node
    skip_space
    needs_trailing_newline = newline? || comment?
    push_call(node) do
      visit args_node
    end
    found_comma = comma?
    if found_comma
      if needs_trailing_newline
        write ","
        next_token
        indent(next_indent) do
          consume_end_of_line
        end
        write_indent
      else
        next_token
        skip_space
      end
    end
    if newline? || comment?
      if needs_trailing_newline
        indent(next_indent) do
          consume_end_of_line
        end
        write_indent
      else
        skip_space_or_newline
      end
    else
      if needs_trailing_newline && !found_comma
        consume_end_of_line
        write_indent
      end
    end
  else
    skip_space_or_newline
  end
  consume_token :on_rparen
  check_heredocs_at_call_end(node)
end