X Tutup
The Wayback Machine - https://web.archive.org/web/20201212180526/https://github.com/vim-ruby/vim-ruby/issues/322
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misaligned method arguments with (line-wrapped) arrays #322

Open
owst opened this issue Oct 31, 2016 · 0 comments
Open

Misaligned method arguments with (line-wrapped) arrays #322

owst opened this issue Oct 31, 2016 · 0 comments
Labels

Comments

@owst
Copy link

@owst owst commented Oct 31, 2016

The follow code is misaligned by vim-ruby e865f7c:

some_method(
  [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
   21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
  [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
   21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
)

to

some_method(
  [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
   21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
   [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
    21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
)

Note how the second array's [ is aligned with 21 from the line above, not the first array's [.

This is more noticeable with keyword args where

some_method(
  first: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
  second: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
           21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
)

is re-indented as:

some_method(
  first: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
          second: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
                   21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
)

I would expect these to be indented, respectively, as:

some_method(
  [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
   21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
  [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
   21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
)

some_method(
  first: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
  second: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
           21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
)

N.B. this is only a problem if the arrays are broken across multiple lines like this, and then re-indented

@owst owst changed the title Misaligned method arguments with long (line-wrapped) arrays Misaligned method arguments with (line-wrapped) arrays Oct 31, 2016
@dkearns dkearns added the indent label Jan 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.
X Tutup