A bit late for the party, but I'll add this here to save the next guy a few hours of searching.
Two concepts apply here:
- language grammars that turn a text file into tokens with different scopes , and
- themes that color these areas (hopefully) in an eye-pleasing way.
If you write your own grammar or convert from TextMate, etc., chances are that you are using areas other than those defined in the topic. In this case, there will be no clear difference between the tokens that you define, even if they are really defined.
There are two ways out of this. First, expand the theme with custom areas and color them as you wish. Not a good way, unless everyone who uses your language also doesn't like your color scheme. Another is to use (a limited set of) areas already defined and colored by VSCode and topic authors. Most likely, your language will look good in your chosen topic and good enough in others.
To give you an example, here is the comment area as defined by the dark default VSCode theme.
"name": "Dark Visual Studio", "settings": [ { "scope": "comment", "settings": { "foreground": "#608b4e" } },
and here is the equivalent language fragment from C ++ grammar:
"comments": { "patterns": [ { "captures": { "0": { "name": "punctuation.definition.comment.java" } }, "match": "/\\*\\*/", "name": "comment.block.empty.java" },
In fact, the language defines several tokens as needed, and since the topic says that comment.* Will be green, they will all be colored the same.
source share