Changing JavaScript grammar rules


I’ve almost completed my switch from sublime, but one thing is really bugging me. I use JavaScript and jQuery a lot, and I can’t figure out how to change the grammar rules to highlight $ signs like it does in sublime. Anyone know how to fix this?


Can you include an image of what it looks like currently and what you would like it to look like? I don’t know how Sublime highlights $


Yep, here’s the link. I’m using the Monokai theme.
I also don’t really care what color the $ is highlighted, it’s just annoying having it plain.


Ah ok, in looking deeper at it, this is essentially the complaint here:

The gist of it is that anything that the grammar can’t be certain is something more specific than “Yup, that’s JavaScript code!” it just punts on. This includes any non-built-in identifiers like variable names. I suppose a rule could be added to the JavaScript language package to always highlight $. The hardest part would be to decide what scope to give it.


So there isn’t any file that I can just go in and add $ to a list of things highlighted in maroon?


I don’t believe so, but I’m Not a CSS Guy™, so I can’t be sure. Perhaps @braver or @olmokramer want to weigh in on that one?

Typically though syntax highlighting is controlled by a combination of the language package and the theme. If the language package categorizes something, you can always override the theme in the styles.less. But if the language package doesn’t categorize something … there isn’t much you can do other than to enhance the language package.


JavaScript is by nature pretty hard to highlight. If something isn’t highlighted already, I doubt the grammar picks up on it. It doesn’t make much sense to add jQuery keywords to the js grammar, but you could fork the js language package and add whatever makes sense in that context. IIRC there is a jQuery syntax package for Sublime that you could auto-convert (if someone else hasn’t already done so).