Syntax highlighting for user defined objects in language package


#1

I’m writing a language package to support syntax highlighting for a particular language (name of language purposefully omitted to generalize the question as much as possible). In my .cson file, I have match rules with regular expressions in them, one of which is for type names. The problem is that I can’t figure out how to highlight the name of a user defined type. For example:

MyType = Information_about_my_type

I want to be able to highlight the type name MyType as I would, for example, int, so that x = int would look the same as x = MyType, where both int and MyType would be highlighted the same way. Same goes for if I were to import MyType from another module.


#2

In your syntax, how do you know MyType is a type?

Whatever the answer to that is, it needs to be encoded in your regex in order for it to match types, in general.