isRuslan/vim-es6

multi-line if statements indent incorrectly

createthis opened this issue · 0 comments

Example:

  if ((1) ||
      (2) ||
        (3)
     ) {
       echo 'foo';
     }

The above is bad because visually it looks like we're still inside the if statement as the indent has changed.

It's also a little messed up in the case of the ) { inline on the third line:

if ((1) ||
    (2) ||
      (3)) {
  echo 'foo';
}

but it gets worse with two lines inside the if:

if (1 ||
    2 ||
      3) {
  echo 'foo';
echo 'bar';
}

and finally, with the bracket on a new line:

if ((1) ||
    (2) ||
      (3))
  {
    echo 'foo';
  }

I would expect these to indent as so:

if ((1) ||
    (2) ||
    (3)
) {
  echo 'foo';
}

if ((1) ||
    (2) ||
    (3)) {
  echo 'foo';
}

if (1 ||
    2 ||
    3) {
  echo 'foo';
  echo 'bar';
}

if ((1) ||
    (2) ||
      (3))
{
  echo 'foo';
}

or like this (possibly configurable):

if ((1) ||
  (2) ||
  (3)
) {
  echo 'foo';
}

if ((1) ||
  (2) ||
  (3)) {
  echo 'foo';
}

if (1 ||
  2 ||
  3) {
  echo 'foo';
  echo 'bar';
}

if ((1) ||
  (2) ||
  (3))
{
  echo 'foo';
}