class Rufo::Formatter

def visit_call_with_receiver(node)

def visit_call_with_receiver(node)
  # [:call, obj, :".", name]
  _, obj, text, name = node
  @dot_column = nil
  visit obj
  first_space = skip_space
  if newline? || comment?
    consume_end_of_line
    # If align_chained_calls if off, we still want to preserve alignment if it's already there
    if @align_chained_calls || (@original_dot_column && @original_dot_column == current_token_column)
      @name_dot_column = @dot_column || next_indent
      write_indent(@dot_column || next_indent)
    else
      # Make sure to reset dot_column so next lines don't align to the first dot
      @dot_column = next_indent
      @name_dot_column = next_indent
      write_indent(next_indent)
    end
  else
    write_space_using_setting(first_space, @spaces_around_dot)
  end
  # Remember dot column, but only if there isn't one already set
  unless @dot_column
    dot_column = @column
    original_dot_column = current_token_column
  end
  consume_call_dot
  first_space = skip_space
  if newline? || comment?
    consume_end_of_line
    write_indent(next_indent)
  else
    write_space_using_setting(first_space, @spaces_around_dot)
  end
  if name == :call
    # :call means it's .()
  else
    visit name
  end
  # Only set it after we visit the call after the dot,
  # so we remember the outmost dot position
  @dot_column = dot_column if dot_column
  @original_dot_column = original_dot_column if original_dot_column
end