bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16182: 24.3.50; ruby-mode: Indentation style of multiline literals w


From: Dmitry Gutov
Subject: bug#16182: 24.3.50; ruby-mode: Indentation style of multiline literals with hanging open paren inside other parens
Date: Wed, 18 Dec 2013 05:55:19 +0200

Judging by the open source code, it's not overly popular, but there's a
definite tendency to align literals in these kind of examples to the
beginning of the statement, not to the opening paren that contains them
(which is what ruby-mode does now, as long as there is any text after
the opening round paren):

https://github.com/intridea/grape/blob/master/README.md#basic-usage

  Status.create!({
    user: current_user,
    text: params[:status]
  })

https://github.com/intridea/grape/blob/master/lib/grape/endpoint.rb#L79

  methods.each do |method|
    route_set.add_route(self, {
      path_info: route.route_compiled,
      request_method: method,
    }, route_info: route)
  end

The code is the trunk indents the second example like this:

  methods.each do |method|
    route_set.add_route(self, {
                          path_info: route.route_compiled,
                          request_method: method,
                        }, route_info: route)
  end

Which is the preferred style? Should ruby-mode support both?

The former style looks more compact, but it can also make the arguments
following the "de-indented" literal look a bit out of place.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]