2072 / PHP-Indenting-for-VIm

The official VIm indent script for PHP
http://www.2072productions.com/to/phpindent.txt
128 stars 29 forks source link

Multiple case statements indents weird #27

Closed bp1222 closed 10 years ago

bp1222 commented 10 years ago

One problem I seem to have with this syntaxing is the following usecase

switch ($somevar) {
    case 'first':
        case 'second':
            $some = 'thing';
            break;
            case 'third':
                case 'fourth':
                    $other = 'thing';
                    break;
                    default:
                        $last = 'thing';
}

This uses the let PHP_vintage_case_default_indent=1, so we get the indentation on case 'first'. But I'd rather that cases, on separate lines didn't further indent. Id expect the above block of code to be formatted as such:

switch ($somevar) {
    case 'first':
    case 'second':
        $some = 'thing';
        break;
    case 'third':
    case 'fourth':
        $other = 'thing';
        break;
    default:
        $last = 'thing';
}
2072 commented 10 years ago

this is a duplicate of #6, I'll see to it soon

bp1222 commented 10 years ago

Great, I sure hope so, it's the biggest annoyance of it. The only difference between this #6, and #25 is that this doesn't use multiple nested switch statements. Regardless, i assume they can be done together when you get to em..Thanks!

2072 commented 10 years ago

hmmm actually I misread your report, it's not a duplicate of #6 and I can't reproduce this, the indentation is correct for me...

2072 commented 10 years ago

What syntax script are you using alongside the indentation script? are you sure you're using the latest version of the indent script? I remember fixing a similar bug some time ago...

bp1222 commented 10 years ago

My apologies, whatever was wrapped up in the VIM 7.4 I got was outta date, and getting 1.40 in there does fix it. Sorry, I should have checked that before bothering.