Adding Custom Enums in Visual Studio Code

Issue

In Visual Studio Code, is it possible to create custom ENUMS or Constants which will be highlighted in the editor?

For example, when the user types IN_JUMP when they are coding in lua, am I able to make this text highlighted or a different colour to indicate it is a valid ENUM?

Solution

What you describe sounds like semantic highlighting, which is not supported yet. There is an open feature request for it: #585

What you can do with tmLanguage grammar files (which is what VSCode uses) is highlight based on naming conventions – you could for instance give a different scope to UPPER_CASE identifiers. However, then you still need the used theme to color that scope differently.

Answered By – Gama11

Answer Checked By – Katrina (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.