[TxMt] Re: Highlighting of custom keywords

Dru Kepple dru at summitprojects.com
Wed Dec 8 17:41:33 UTC 2010


On Dec 8, 2010, at 12:42 AM, Benedikt Ries wrote:

Hi there!

I have a simple, surely often asked question. Please don´t "RTFM!" me, I really did search and google for that.
So here is my problem: We develop in Perl with textmate. We have two functions in our framework, called "breakpoint" and "debug". Those are marked with yellow background and black font. Unfortunately, the developers who know how to adjust textmate correctly, are all gone (they´re not dead, just quit!). I got a new machine and am trying desperately to set the highlighting of those two words eversince.

During my crusade I also discovered that we have a customized language declaration for Perl under "Bundles/Bundle Editor/Edit Languages/Perl". I put that one on my new machine, but it doesn´t do the trick.

Here are two screenshots which show how it looks on the old machine and the setting ("perl.control") that I suspect being responsible for that:
http://www.dreamway.com/screen1.png
http://www.dreamway.com/screen2.png


I surely don't blame you; the language grammars aren't for the faint of heart.  But you should be able to get into the Language grammar for Perl ( go to Bundles > Bundle Editor > Edit Languages and open up the Perl bundle in the Bundle Editor).  You should just need an extra entry that sets up those two words with your extra scope.

I'm not the best person to answer this question, but I haven't seen any other answers so far, so here goes.  Try adding this, under patterns = {...:

{ name="perl.control";
match = '(debug|breakpoint)';
},

This may be what's in your customized Perl language grammar.  If so, then it may just be a matter of setting up your fonts and colors.

Click on the "Test" button, then check a Perl file.  Place your cursor in the "debug" or "breakpoint" word, and press Control-Shift-P.  You should see a tool tip pop up, which should have "perl.control" as the first line.

If that's the case, then go into Preferences  > Fonts & Colors, and add an entry (click the "+" button).  Set the styling that you want, and in the "Scope Selector:" field, type in perl.control.

Hopefully, that will all work.  But for me, there's often a lot of trial and error with the grammar part of it.  I know location within the grammar can have an effect, I think you might want to place that entry earlier rather than later in the grammar.  Then again, it may override something later in the grammar...so be careful!

Hope that helps,
+dru



More information about the textmate mailing list