I am currently using all the absolute bleeding edge releases of all the TextMate bundles (courtesy of the example "mateup" script in the wiki), and the other day I hit Command + / to comment a selection in PHP, and got HTML comments instead (that <!-- --> business). I haven't edited the relevant bundles at all. Has anyone else noticed this bug?
Simply make a new document, switch the bundle to HTML, and type some PHP to reproduce the bug:
<?php
function my_function() { echo "aw man the auto comments are broken"; }
?>
After selecting the function, and pressing command + /, this is the result:
<?php
<!-- function my_function() { echo "aw man the auto comments are broken"; } -->
?>
If I press Command + Slash once more, things get a little weirder:
<?php
// <!-- function my_function() { // echo "aw man the auto comments are broken"; // } -->
?>
I realize I could just revert to the release version, but I thought someone might like to know about this.
In addition, the problems are not necessarily isolated to the handling of PHP within HTML. If I switch to the "PHP" bundle instead of HTML, the commenting works (using slashes for each line - I would kind of prefer /* */ to be honest because occasionally it is useful to place comments between expressions on the same line), but destroys the indentation of my function:
<?php
// function my_function() { // echo "aw man the auto comments are broken"; // }
?>
When I undo the comments, the indentation is still messed up.
Thanks, William
On 28 Jan 2009, at 21:32, William Makley wrote:
I am currently using all the absolute bleeding edge releases of all the TextMate bundles (courtesy of the example "mateup" script in the wiki), and the other day I hit Command + / to comment a selection in PHP, and got HTML comments instead (that <!-- --> business). I haven't edited the relevant bundles at all. Has anyone else noticed this bug?
Yes, we (Michael) is working on addressing this problem. Recently scopes were introduced for if/while blocks in PHP which gives some advantages, but it breaks leaving PHP mode inside such blocks, for which we are testing a solution, but that breaks the scope intersection computation calculations TM does for selections when the begin/end of selection touch different units, which is why comments fallback to the root (HTML) scope rather thna PHP.
It should be solved before next TM build goes out.
[...] In addition, the problems are not necessarily isolated to the handling of PHP within HTML. If I switch to the "PHP" bundle instead of HTML, the commenting works (using slashes for each line - I would kind of prefer /* */ to be honest because occasionally it is useful to place comments between expressions on the same line)
You can alter the comment preferences, see Bundles → Bundle Editor and find the Comments item in the PHP bundle.
but destroys the indentation of my function: [...]
For this, please give a step-by-step of what you do, what you expect, and quote the text literally, and be careful that you are not mixing spaces and tabs.
Thanks for the response!
On Jan 30, 2009, at 6:39 AM, Allan Odgaard wrote:
but destroys the indentation of my function: [...]
For this, please give a step-by-step of what you do, what you expect, and quote the text literally, and be careful that you are not mixing spaces and tabs.
I can't get this to happen again, so somehow, in my quick test case, I managed to mix up spaces and tabs. x_X
Thanks, William