hi there,
while fixing indentation of a php-file using 'indent selection' i found that textmate is wrong in the following case:
if( condition ){ code; }elseif( condition ){ code; }
is indented like this:
if( condition ){ code; }elseif( condition ){ code; }
how to reproduce? - enter the code above in an empty php-document - select all - indent selection
workaround: put elseif on a new line
cheers Till Backhaus
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/RevertToDefaultBundl es )
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@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@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Off topic, but I've seen some strange decisions (or bugs) with the PHP bundle. (e.g. Type php and hit tab - braces are reversed for some reason, maybe intentional?)
I guess not many TM users work with PHP? (Yes, RoR is the way to go - but there are situations that PHP has a faster Time-to-Market so you have no choice.)
Best, Sangwhan
Till Backhaus wrote:
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@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@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Apr 14, 2008, at 10:38 AM, S. Moon wrote:
Off topic, but I've seen some strange decisions (or bugs) with the PHP bundle. (e.g. Type php and hit tab - braces are reversed for some reason, maybe intentional?)
I guess not many TM users work with PHP? (Yes, RoR is the way to go
- but there are situations that PHP has a faster Time-to-Market so
you have no choice.)
You need to select HTML as the language for php. The reason your seeing that behavior is because once inside a <?php tag it will close and open a new tag. However since you have PHP selected it thinks your always inside a tag.
Hi,
On 14.04.2008, at 17:38:23, S. Moon wrote:
Off topic, but I've seen some strange decisions (or bugs) with the PHP bundle. (e.g. Type php and hit tab - braces are reversed for some reason, maybe intentional?)
I believe it's intentional. Since the document is PHP, you're _inside_ a PHP block. So typing php[tab] there would give you reverse tags to get into the HTML mode. Whereas when you have the document type set to HTML (which arguably makes sense since any PHP document is HTML/text before you go into PHP mode with <?), typing php[tab] will give you <? php | ?>.
I guess not many TM users work with PHP? (Yes, RoR is the way to go
- but there are situations that PHP has a faster Time-to-Market so
you have no choice.)
I do, and I know I'm not the only one :) Though I'll admit I probably use very little of the TM toolset. For instance I've never used function autocomplete for PHP.
Greetings,
_Lasar
On 14.04.2008, at 22:51:33, Ciarán Walsh wrote:
On 14 Apr 2008, at 11:19, Lasar Liepiņš wrote:
I've never used function autocomplete for PHP.
I guess you must know it’s there, so is there some reason you are not using it? You just press ⌥⎋…
I found out about it only a few days ago, actually (lurking on the IRC channel helps bunches). So I haven't really gotten into it yet.
On 14 Apr 2008, at 07:01, Till Backhaus wrote:
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(); } ?>
OK, I see the problem too, and I know why it’s happening. Not sure how best to fix it right now, but I’ll think on it – thanks for the report.