language-ruby icon indicating copy to clipboard operation
language-ruby copied to clipboard

auto indent not working as expected

Open senny opened this issue 11 years ago • 10 comments

I ran into a situation where Auto Indent results in a wrong indent. I could reduce the example code to the following:

class Example
  private

  def attribute_and_value(attribute, value)
    "%s: %s" % [human_attribute_name(attribute),
      value]
  end
end

After calling Auto Indent it will look like this:

class Example
  private

  def attribute_and_value(attribute, value)
    "%s: %s" % [human_attribute_name(attribute),
      value]
    end
  end

senny avatar Feb 28 '14 14:02 senny

Started running into this issue since Atom started auto-indenting on paste.

chibicode avatar Dec 03 '14 08:12 chibicode

There's also this:

module Architect
  module Replicatable
    private def clone
      @clone
    end

    private def origin
      @origin
    end
  end
end

First + c then + v:

module Architect
  module Replicatable
    private def clone
    @clone
  end

  private def origin
  @origin
end
end
end

krainboltgreene avatar Dec 18 '14 23:12 krainboltgreene

This bug honestly has cost me 10% of my development time today.

krainboltgreene avatar Dec 18 '14 23:12 krainboltgreene

@senny's issue seems to be broken on tmbundle as well - reported an issue there: https://github.com/textmate/ruby.tmbundle/issues/79

for @krainboltgreene's issue, I made a pull request: https://github.com/atom/language-ruby/pull/76

chibicode avatar Dec 19 '14 20:12 chibicode

+1 to @senny's issue

andrewpcone avatar Feb 05 '15 01:02 andrewpcone

This still seems to be an issue :+1:

paulcsmith avatar May 04 '15 14:05 paulcsmith

It's atom-wide (v0.192, 0.198, 0.199): here.

muppetjones avatar May 19 '15 19:05 muppetjones

And it's still an issue...

CJYate avatar Sep 21 '16 09:09 CJYate

+1

nicnilov avatar May 19 '17 22:05 nicnilov

Spent the better part of a day trying to track down why this was happening, glad at least to see it's not just me.

danaesignal avatar Nov 01 '17 04:11 danaesignal