Sublime Forum

No compile-time constant highlighting

#1

I have tried multiple themes and, for whatever reason, compile-time constants are not highlighted in your code beyond their declaration and assignment. This tends to look really poor considering you have colored statements at the top of a source file, but any reference to that constant will remain white and unchanged. Here is an image of what I am talking about:

After doing a bit of research I have been informed that this addition might be as simple as a few edits into the “rule” file for each respective theme. I come here to ask exactly what edits are necessary, and where should these edits be observed?

Thank you.

0 Likes

#2

As far as I know, the syntax highlighting in ST is based on regexp. This means there is no way to know if an identifier is a variable, a function, or a macro.

You could highlight all tokens that contain only uppercase letters and underscores, but only convention suggests those will be macros. Finding out what an identifier really is would require parsing the language (and include files as well).

0 Likes

#3

The solution that simply highlights uppercase and underscores would be just fine. How would I go about adding that rule? Where would it be added?

0 Likes