Bug #5357

Indentation of nested operators should nest

Added by Nikolai Weibull over 2 years ago. Updated about 1 year ago.

[ruby-core:39684]
Status:Assigned
Priority:Normal
Assignee:Nobuyoshi Nakada
Category:misc
Target version:next minor
ruby -v:trunk Backport:

Description

Hi!

Currently,

return if
hash.
values_at(:a, :b, :c).
reject{ |e| e.nil? or e.empty? }.
empty?

is indented

as

return if
hash.
values_at(:a, :b, :c).
reject{ |e| e.nil? or e.empty? }.
empty?

I would prefer it to be indented as in the first example.


Related issues

Related to ruby-trunk - Feature #6823: Where/how should ruby-mode issues be reported? Assigned

History

#1 Updated by Koichi Sasada about 2 years ago

  • Category set to misc
  • Status changed from Open to Assigned
  • Assignee set to Nobuyoshi Nakada

#2 Updated by Nobuyoshi Nakada over 1 year ago

  • Status changed from Assigned to Feedback

=begin
Your first example seems inconsistent, why are the last 3 lines indented at the same column?
It would be:

return if
hash.
values_at(:a, :b, :c).
reject{ |e| e.nil? or e.empty? }.
empty?

But it doesn't look nice to me.

=end

#3 Updated by Alex Young over 1 year ago

On 03/12/12 02:35, nobu (Nobuyoshi Nakada) wrote:

Issue #5357 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Assigned to Feedback

=begin
Your first example seems inconsistent, why are the last 3 lines indented at the same column?
It would be:

return if
hash.
values_at(:a, :b, :c).
reject{ |e| e.nil? or e.empty? }.
empty?

But it doesn't look nice to me.

Indenting the last 3 lines highlights that the method chain is hanging
off hash. I do this myself.

--
Alex

#4 Updated by Eric Hodel about 1 year ago

  • Status changed from Feedback to Assigned
  • Target version set to next minor

Also available in: Atom PDF