Skip to content

Add type, external, let word coloring && unit as constant #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
79 changes: 62 additions & 17 deletions grammars/rescript.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,27 @@
},
{
"match": "\\,",
"name": "punctuation.separator"
"name": "constant.character punctuation.separator"
},
{
"match": "\\?|:",
"name": "punctuation.separator"
},
{
"match": "\\|(?!\\|)",
"name": "punctuation.separator"
"name": "constant.character punctuation.separator"
},
{
"match": "\\{",
"name": "punctuation.section.braces.begin"
"name": "constant.character punctuation.section.braces.begin"
},
{
"match": "\\}",
"name": "punctuation.section.braces.end"
"name": "constant.character punctuation.section.braces.end"
},
{
"match": "\\(",
"name": "punctuation.section.parens.begin"
"name": "constant.character punctuation.section.parens.begin"
},
{
"match": "\\)",
"name": "punctuation.section.parens.end"
"name": "constant.character punctuation.section.parens.end"
}
]
},
Expand Down Expand Up @@ -224,7 +220,7 @@
"name": "punctuation.definition.keyword"
},
"3": {
"name": "variable.function variable.other"
"name": "variable.function variable.other variable.other.enummember constant.other.symbol"
}
}
}
Expand All @@ -234,11 +230,11 @@
"patterns": [
{
"match": "\\[",
"name": "punctuation.section.brackets.begin"
"name": "constant.character punctuation.section.brackets.begin"
},
{
"match": "\\]",
"name": "punctuation.section.brackets.end"
"name": "constant.character punctuation.section.brackets.end"
}
]
},
Expand All @@ -251,13 +247,13 @@
"name": "keyword"
},
"2": {
"name": "punctuation.section.braces.begin"
"name": "constant.character punctuation.section.braces.begin"
}
}
},
{
"match": "\\}",
"name": "punctuation.section.braces.end"
"name": "constant.character punctuation.section.braces.end"
}
]
},
Expand All @@ -267,13 +263,13 @@
"match": "\\b[a-z_][0-9a-zA-Z_]*(\\[)",
"captures": {
"1": {
"name": "punctuation.section.brackets.begin"
"name": "constant.character punctuation.section.brackets.begin"
}
}
},
{
"match": "\\]",
"name": "punctuation.section.brackets.end"
"name": "constant.character punctuation.section.brackets.end"
}
]
},
Expand Down Expand Up @@ -430,6 +426,46 @@
]
}
]
},
"variableDeclaration": {
"patterns": [
{
"match": "(?<=external )[a-z_][0-9a-zA-Z_]*",
"name": "entity.name.function"
},
{
"match": "(?<=let )[a-z_][0-9a-zA-Z_]*",
"name": "entity.name.function"
},
{
"match": "(?<=let rec )[a-z_][0-9a-zA-Z_]*",
"name": "entity.name.function"
}
]
},
"typeDeclaration": {
"patterns": [
{
"match": "(?<=type )[a-z_][0-9a-zA-Z_]*",
"name": "entity.name.function"
},
{
"match": "(?<=and )[a-z_][0-9a-zA-Z_]*",
"name": "entity.name.function"
},
{
"match": "(?<=type rec )[a-z_][0-9a-zA-Z_]*",
"name": "entity.name.function"
}
]
},
"recordProperty": {
"patterns": [
{
"name": "variable.object.property",
"match": "([a-z_][0-9a-zA-Z_]*(?=:))"
}
]
}
},
"patterns": [
Expand Down Expand Up @@ -492,6 +528,15 @@
},
{
"include": "#punctuations"
},
{
"include": "#typeDeclaration"
},
{
"include": "#variableDeclaration"
},
{
"include": "#recordProperty"
}
]
}