[TxMt] Intelligent boolean highlights
Michael Sheets
mummer at whitefalls.org
Thu Oct 26 11:21:51 UTC 2006
> { name = 'constant.language.js';
> match = '\b(null|super|this)\b';
> },
> { name = 'constant.language.js.true';
> match = '\b(true)\b';
> },
> { name = 'constant.language.js.false';
> match = '\b(false)\b';
> },
>
> Then I just added rules to my current theme for
> "constant.language.js.true" and "constant.language.js.false"
>
> I would have done it Textmate wide but I don't know enough about the
> system for that, is there any implications for what I have done here?
There is actually a quasi-standard here, in the languages that scope
booleans they are "constant.language.boolean.* The language part
always goes last. So if you want to do this I'd use
"constant.language.boolean.true.js" etc.
There isn't any real reason not to do this, the only real issue is
that in customizing your language like this you fork it off, ie:
you'll no longer get updates to the grammar when it'd changed in the
future.
Looking at Javascript it is a 'flat' language currently so you could
create a new language grammar with your two custom rules then just
inherit javascript and you'd keep getting updates.
No downside to putting this in the main grammar though if no one
objects. I'm always one for more scope info. ;)
More information about the textmate
mailing list