Project

General

Profile

Actions

Bug #5357

closed

Indentation of nested operators should nest

Added by now (Nikolai Weibull) over 12 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
[ruby-core:39684]

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 1 (0 open1 closed)

Related to Ruby master - Feature #6823: Where/how should ruby-mode issues be reported?Closedmatz (Yukihiro Matsumoto)Actions

Updated by ko1 (Koichi Sasada) about 12 years ago

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

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

  • Status changed from Assigned to Feedback

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.

Updated by regularfry (Alex Young) over 11 years 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

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

Updated by drbrain (Eric Hodel) about 11 years ago

  • Status changed from Feedback to Assigned
  • Target version set to 2.6
Actions #5

Updated by naruse (Yui NARUSE) over 6 years ago

  • Target version deleted (2.6)

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Status changed from Assigned to Closed

ruby-mode.el was dropped in f03e68edb80dca962290d1fb3a6d49dabdbb911e.

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Description updated (diff)

The ruby-mode.el in Emacs 26 seems to indent as the first example.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0