Hi,
Could you help me to make a custom language colorization! I have followed the short tutorial on the website http://manual.macromates.com/en/language_grammars but it didn't work for me, so I simplified it as much as possible but still no success. I guess there is something simple which I am missing. How can I make the following definition working:
{ scopeName = 'source.serpent';
fileTypes = ( 'serpent' );
patterns = (
{ begin = '<?';
end = '?>';
patterns = ( { include = 'source.php'; } );
},
); }
it does not highlight php insertions in my file, but the standard language definition for php (supplied with the editor) does it.
What do I need to do?
Thanks, nuke
On 4 Jun 2010, at 15:49, nuke wrote:
Could you help me to make a custom language colorization! [...] What do I need to do?
In addition to creating a new language grammar you also need to select to use it for your file (in your case it should be automatically chosen for files with ‘serpent’ extension). This is done by using the status bar language selector.
Your grammar doesn’t do anything though (other than include PHP), so selecting it wouldn’t be different to selecting PHP directly, except the root scope will be different (which you can check with ⌃⇧P).
Perhaps though your issue is more with embedding of things in HTML. You should probably have a look at this page http://wiki.macromates.com/Troubleshooting/PHPSyntaxHighlight
I do select Serpent language explicitly (or it is detected by the file extension). The PHP insertions are not highlighted. However, if I select PHP language, they are. So I am very confused. My guess is I need to do something extra in addition to the simplest language definition I am using now:
{ scopeName = 'source.serpent'; fileTypes = ( 'serpent' ); patterns = ( { begin = '<?'; end = '?>'; patterns = ( { include = 'source.php'; } ); }, ); }
On Mon, Jun 7, 2010 at 11:04, Allan Odgaard mailinglist@textmate.orgwrote:
On 4 Jun 2010, at 15:49, nuke wrote:
Could you help me to make a custom language colorization!
[...] What do I need to do?
In addition to creating a new language grammar you also need to select to use it for your file (in your case it should be automatically chosen for files with ‘serpent’ extension). This is done by using the status bar language selector.
Your grammar doesn’t do anything though (other than include PHP), so selecting it wouldn’t be different to selecting PHP directly, except the root scope will be different (which you can check with ⌃⇧P).
Perhaps though your issue is more with embedding of things in HTML. You should probably have a look at this page http://wiki.macromates.com/Troubleshooting/PHPSyntaxHighlight
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Could you try it yourself please? Does it work for you?
On Mon, Jun 7, 2010 at 11:59, nuke sila.razuma@gmail.com wrote:
I do select Serpent language explicitly (or it is detected by the file extension). The PHP insertions are not highlighted. However, if I select PHP language, they are. So I am very confused. My guess is I need to do something extra in addition to the simplest language definition I am using now:
{ scopeName = 'source.serpent'; fileTypes = ( 'serpent' ); patterns = ( { begin = '<?'; end = '?>'; patterns = ( { include = 'source.php'; } ); }, ); }
On Mon, Jun 7, 2010 at 11:04, Allan Odgaard mailinglist@textmate.orgwrote:
On 4 Jun 2010, at 15:49, nuke wrote:
Could you help me to make a custom language colorization!
[...] What do I need to do?
In addition to creating a new language grammar you also need to select to use it for your file (in your case it should be automatically chosen for files with ‘serpent’ extension). This is done by using the status bar language selector.
Your grammar doesn’t do anything though (other than include PHP), so selecting it wouldn’t be different to selecting PHP directly, except the root scope will be different (which you can check with ⌃⇧P).
Perhaps though your issue is more with embedding of things in HTML. You should probably have a look at this page http://wiki.macromates.com/Troubleshooting/PHPSyntaxHighlight
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 7 Jun 2010, at 16:56, nuke wrote:
Could you try it yourself please? Does it work for you?
As I mentioned, your grammar doesn’t do anything other than match PHP tags and include the PHP grammar, but it doesn’t assign any name/ scope to the matched tags, so they shouldn’t be highlighted.
I wouldn’t exactly call your grammar the simplest example since you match stuff w/o assigning a name and then include another grammar. Try the example from the manual.
And press ⌃⇧P at various places in your document, this shows how TM parsed the current construct, *assuming* you actually assigned names to the parts matched.
I am able to get highlighting by simply copying part of PHP lang definition for <? ?> delimiters and whole PHP repository.
Is there a way how to refer to PHP definitions? I hope it is possible, because having PHP + ruby + one more language will make it very messy.
By the way, is there any human-friendly way to edit language definitions? The way how I see it now in BundleEditor makes me dizzy - small font, no highlighting,... it feels like a prehistorical Notepad, not TextMate
On Mon, Jun 7, 2010 at 18:48, Allan Odgaard mailinglist@textmate.orgwrote:
On 7 Jun 2010, at 16:56, nuke wrote:
Could you try it yourself please? Does it work for you?
As I mentioned, your grammar doesn’t do anything other than match PHP tags and include the PHP grammar, but it doesn’t assign any name/scope to the matched tags, so they shouldn’t be highlighted.
I wouldn’t exactly call your grammar the simplest example since you match stuff w/o assigning a name and then include another grammar. Try the example from the manual.
And press ⌃⇧P at various places in your document, this shows how TM parsed the current construct, *assuming* you actually assigned names to the parts matched.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
nuke sila.razuma@gmail.com wrote (Mon, 7 Jun 2010 19:54:09 +0200):
By the way, is there any human-friendly way to edit language definitions? The way how I see it now in BundleEditor makes me dizzy - small font, no highlighting,... it feels like a prehistorical Notepad, not TextMate
Try "Edit - Edit in TextMate" when you're in the bundle edtior... :-)
Kind regards, Tobias Jung
Hm, I cannot find it. Can you find this command from BundleEditor?
On Mon, Jun 7, 2010 at 20:01, Tobias Jung newsgr@tobiasjung.net wrote:
nuke sila.razuma@gmail.com wrote (Mon, 7 Jun 2010 19:54:09 +0200):
By the way, is there any human-friendly way to edit language definitions? The way how I see it now in BundleEditor makes me dizzy - small font, no highlighting,... it feels like a prehistorical Notepad, not TextMate
Try "Edit - Edit in TextMate" when you're in the bundle edtior... :-)
On 2010-06-07 14:07, nuke wrote:
On Mon, Jun 7, 2010 at 20:01, Tobias Jung <newsgr@tobiasjung.net mailto:newsgr@tobiasjung.net> wrote:
Try "Edit - Edit in TextMate" when you're in the bundle edtior... :-)
Hm, I cannot find it. Can you find this command from BundleEditor?
It requires you to install the "Edit in TextMate" input manager, which is not done by default. You may have trouble with it in more recent versions of the OS. See http://wiki.macromates.com/Troubleshooting/EditInTextMate for details.
It may be easier to do it the old-fashioned way: Select all in the bundle editor, copy, and paste into a new TextMate document. Set the document type to "Language Grammar" and you're good to go. Copy & paste back into the bundle editor when you're ready to try it.
Ok, thanks a lot! I am VERY surprised that TextMate does not highlight its own settings by default. Especially the language definitions...
On Mon, Jun 7, 2010 at 20:30, Steve King sking@arbor.net wrote:
On 2010-06-07 14:07, nuke wrote:
On Mon, Jun 7, 2010 at 20:01, Tobias Jung <newsgr@tobiasjung.net mailto: newsgr@tobiasjung.net> wrote:
Try "Edit - Edit in TextMate" when you're in the bundle edtior... :-)
Hm, I cannot find it. Can you find this command from BundleEditor?
It requires you to install the "Edit in TextMate" input manager, which is not done by default. You may have trouble with it in more recent versions of the OS. See http://wiki.macromates.com/Troubleshooting/EditInTextMate for details.
It may be easier to do it the old-fashioned way: Select all in the bundle editor, copy, and paste into a new TextMate document. Set the document type to "Language Grammar" and you're good to go. Copy & paste back into the bundle editor when you're ready to try it.
-- Steve King Sr. Software Engineer Arbor Networks +1 734 821 1461 www.arbornetworks.com http://www.arbornetworks.com/
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 2010-06-07 14:40, nuke wrote:
Ok, thanks a lot! I am VERY surprised that TextMate does not highlight its own settings by default. Especially the language definitions...
Don't worry. I'm sure it will be fixed in TM2.
Repeating my question: Thanks to your answers, I can now highlight PHP insertions in my custom language by copying the repository and delimiters pattern from PHP language definition. However, I would like to avoid this unnecessary duplication. Is it possible to simply refer the PHP definitions without copying them to my language?
On Mon, Jun 7, 2010 at 19:54, nuke sila.razuma@gmail.com wrote:
I am able to get highlighting by simply copying part of PHP lang definition for <? ?> delimiters and whole PHP repository.
Is there a way how to refer to PHP definitions? I hope it is possible, because having PHP + ruby + one more language will make it very messy.
By the way, is there any human-friendly way to edit language definitions? The way how I see it now in BundleEditor makes me dizzy - small font, no highlighting,... it feels like a prehistorical Notepad, not TextMate
On Mon, Jun 7, 2010 at 18:48, Allan Odgaard mailinglist@textmate.orgwrote:
On 7 Jun 2010, at 16:56, nuke wrote:
Could you try it yourself please? Does it work for you?
As I mentioned, your grammar doesn’t do anything other than match PHP tags and include the PHP grammar, but it doesn’t assign any name/scope to the matched tags, so they shouldn’t be highlighted.
I wouldn’t exactly call your grammar the simplest example since you match stuff w/o assigning a name and then include another grammar. Try the example from the manual.
And press ⌃⇧P at various places in your document, this shows how TM parsed the current construct, *assuming* you actually assigned names to the parts matched.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
nuke sila.razuma@gmail.com wrote (Mon, 7 Jun 2010 22:57:01 +0200):
Repeating my question: Thanks to your answers, I can now highlight PHP insertions in my custom language by copying the repository and delimiters pattern from PHP language definition. However, I would like to avoid this unnecessary duplication. Is it possible to simply refer the PHP definitions without copying them to my language?
Well, install the "Edit in TextMate" input manager...
Kind regards, Tobias Jung