[TxMt] 'bug' in php bundle: indentation of elseif on same line as closing brace is wrong

Till Backhaus backhaus at 2myscreen.com
Mon Apr 14 12:01:43 UTC 2008


Hi again,

sorry for the non-working example. I have to admit that my example was  
oversimplified
and that the case in which the error occurs is slightly less common  
than previously
indicated.

Now a 'working' example:
<?php
if( $whatever ){
doesnt_matter();
} elseif ( $something
|| $breaking_before_the_second_condition_screws_it_up ) {
doesnt_matter_either();
}
?>

should ideally be indented like this:
<?php
if( $whatever ){
     doesnt_matter();
} elseif ( $something
            || $a_linebreak_in_this_condition_screws_it_up ) {
     doesnt_matter_either();
}
?>

also acceptable (i would indent the condition myself):
<?php
if( $whatever ){
     doesnt_matter();
} elseif ( $something
     || $a_linebreak_in_this_condition_screws_it_up ) {
     doesnt_matter_either();
}
?>

but textmate does this:
<?php
if( $whatever ){
     doesnt_matter();
     } elseif ( $something
     || $a_linebreak_in_this_condition_screws_it_up ) {
         doesnt_matter_either();
     }
     ?>

reproduce:
- enter the code above in an empty php-document
- select all
- indent selection

cheers,
Till Backhaus

---------------------------
Till Backhaus
mail: till at backha.us
_web: http://till.backha.us

On 12.04.2008, at 17:46, Ciarán Walsh wrote:
> Hi,
>
> On 11 Apr 2008, at 07:31, Till Backhaus wrote:
>
>> while fixing indentation of a php-file using 'indent selection' i  
>> found that textmate is wrong in the following case:
>
> Indenting this code sample worked as expected for me. Please make  
> sure you don’t have any local modifications to the PHP bundle (see http://wiki.macromates.com/Troubleshooting/RevertToDefaultBundles 
>  )
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list