I am currently trying to make a syntax highlighter extension in Visual Studio Code for a programming language that I am creating.
The syntax highlighter should highlight all of the keywords, but currently, I can't get it to highlight more than one per line, as in the image below (where all words should be highlighted).
The same happens with numbers:
This is my <language name>.tmLanguage.json:
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Language Name",
"patterns": [
{
"include": "#control_keywords"
},
{
"include": "#declaration_keywords"
},
{
"include": "#double_quoted_strings"
},
{
"include": "#single_quoted_strings"
},
{
"include": "#hexadecimal_numbers"
},
{
"include": "#octal_numbers"
},
{
"include": "#binary_numbers"
},
{
"include": "#decimal_numbers"
},
{
"include": "#line_comments"
},
{
"include": "#block_comments"
}
],
"repository": {
"control_keywords": {
"name": "keyword.control.language_name",
"match": "\\b(if|while|for|return|continue|break|else)\\b"
},
"declaration_keywords": {
"name": "keyword.declaration.language_name",
"match": "\\b(fn|let|const)\\b"
},
"double_quoted_strings": {
"name": "string.quoted.double.language_name",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.language_name",
"match": "\\\\(\\\\|'|\"|n)"
}
]
},
"single_quoted_strings": {
"name": "string.quoted.single.language_name",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.language_name",
"match": "\\\\(\\\\|'|\"|n)"
}
]
},
"hexadecimal_numbers": {
"name": "constant.numeric.hexadecimal",
"match": "\\b0x[0123456789ABCDEFabcdef]*(\\.[0123456789ABCDEFabcdef]*)?\\b"
},
"octal_numbers": {
"name": "constant.numeric.octal",
"match": "\\b0o[01234567]*(\\.[01234567]*)?\\b"
},
"binary_numbers": {
"name": "constant.numeric.octal",
"match": "\\b0b[01]*(\\.[01]*)?\\b"
},
"decimal_numbers": {
"name": "constant.numeric.decimal",
"match": "\\b[0123456789]*(\\.[0123456789]*)?\\b"
},
"line_comments": {
"name": "comment.line.double-slash",
"match": "//[^\\n]*\n"
},
"block_comments": {
"name": "comment.block",
"begin": "/\\*",
"end": "\\*/",
"patterns": [
{
"include": "#block_comments"
}
]
}
},
"scopeName": "source.language_name"
}

