Hi, is there any support in TextMate for PHP's Alternate Syntax?
e.g. Regular Syntax: <?php if (1 == 1) { //Output } else { //Output } ?>
e.g. Alternate Syntax: <?php if (1 == 1): //Output else: //Output endif; ?>
At the moment, I can't find a way to get code-folding working with the alternate syntax, and I would also like to be able to set TextMate's TAB auto-complete to use the alternate syntax.
Tim Mackey
I don't know if it's the "official" way, but when I do this, I set the "document type" from PHP to HTML.
The <?php ?> parts will be highlighted as php, javascript as javascript, html as html.
As I don't have TM with me right now, I can't tell if that actually answers your question or not.
Karel
Odesláno z iPhone
17.9.2010 v 19:50, Timothy Mackey timd.mackey@gmail.com:
Hi, is there any support in TextMate for PHP's Alternate Syntax?
e.g. Regular Syntax:
<?php if (1 == 1) { //Output } else { //Output } ?>
e.g. Alternate Syntax:
<?php if (1 == 1): //Output else: //Output endif; ?>
At the moment, I can't find a way to get code-folding working with the alternate syntax, and I would also like to be able to set TextMate's TAB auto-complete to use the alternate syntax.
Tim Mackey
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Sep 17, 2010, at 2:12 PM, Karel Bílek wrote:
I don't know if it's the "official" way, but when I do this, I set the "document type" from PHP to HTML.
The official way is to always use the HTML grammar when working in PHP and never the PHP grammar directly, so I think you're OK. :)
I am currently using the HTML grammar, so that's not the issue. The problem I am trying to solve is that code-folding does not work for the alternate syntax (Alternate syntax for control structures, such as if-else, switch, foreach, etc.). Right now, I can only get the code folding to work if I use the curly brace syntax.
On Sep 17, 2010, at 1:50 PM, Timothy Mackey wrote:
Hi, is there any support in TextMate for PHP's Alternate Syntax?
Your example seems to highlight correctly, but I see what you mean about the folding. You'd have to go into the bundle editor and change the PHP Language. That will not be an easy project, but if you want to try, you should probably look at that section of the manual.
http://manual.macromates.com/en/language_grammars
At the moment, I can't find a way to get code-folding working with the alternate syntax, and I would also like to be able to set TextMate's TAB auto-complete to use the alternate syntax.
The second part is pretty easy. Just go into the bundle editor and find the snippets you want to edit (if, if …else, etc.) and change them.
The only thing I would add is that you should always use hard tabs to indent your snippets even if you hate tabs with a passion. When you actually use the snippet, TextMate will replace a hard tab with whatever your preferences are for that language.
Thanks Rob, your answer is helpful. Yes, I should have mentioned that the syntax highlighting is working correctly. It's unfortunate that there isn't built-in support for code folding for this syntax, but maybe it will come in a later release :-). In the meantime, i guess I'll have to see if it's something that I would be capable of doing myself.
The more important thing for me, though, is the snippet autocomplete, so I'm glad that it will be easy for me to change. Thanks for the tips!
On Fri, Sep 17, 2010 at 11:34 AM, Rob McBroom mailinglist0@skurfer.comwrote:
On Sep 17, 2010, at 1:50 PM, Timothy Mackey wrote:
Hi, is there any support in TextMate for PHP's Alternate Syntax?
Your example seems to highlight correctly, but I see what you mean about the folding. You'd have to go into the bundle editor and change the PHP Language. That will not be an easy project, but if you want to try, you should probably look at that section of the manual.
http://manual.macromates.com/en/language_grammars
At the moment, I can't find a way to get code-folding working with the alternate syntax, and I would also like to be able to set TextMate's TAB auto-complete to use the alternate syntax.
The second part is pretty easy. Just go into the bundle editor and find the snippets you want to edit (if, if …else, etc.) and change them.
The only thing I would add is that you should always use hard tabs to indent your snippets even if you hate tabs with a passion. When you actually use the snippet, TextMate will replace a hard tab with whatever your preferences are for that language.
-- Rob McBroom http://www.skurfer.com/
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate