Updated impl and type/namespace syntax

This commit is contained in:
2026-06-16 17:16:11 +02:00
parent 5bd9e78f7e
commit d4c6c564c9
+63 -22
View File
@@ -33,9 +33,6 @@
{
"include": "#types"
},
{
"include": "#namespaces"
},
{
"include": "#imports"
},
@@ -45,6 +42,9 @@
{
"include": "#struct_literals"
},
{
"include": "#impl"
},
{
"include": "#method_calls"
},
@@ -234,7 +234,7 @@
"keywords": {
"patterns": [
{
"match": "\\b(if|else|while|for|return|break|continue|match|loop)\\b",
"match": "\\b(if|else|while|for|return|break|continue|match|loop|in)\\b",
"name": "keyword.control.mist"
},
{
@@ -323,34 +323,34 @@
"types": {
"patterns": [
{
"match": "(?<![A-Za-z])(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)\\b",
"name": "entity.name.type.numeric.mist"
"match": "(?<![A-Za-z])(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize|str|char|bool|void)\\b",
"name": "storage.type.built-in.primitive.mist"
},
{
"match": "(?<![A-Za-z])(str|char|bool|void)\\b",
"name": "entity.name.type.other.mist"
"match": "\\b((?:[a-z_][a-zA-Z0-9_]*::)*)([A-Z][A-Za-z0-9_]*)\\b",
"captures": {
"1": {
"name": "entity.name.namespace.mist"
},
"2": {
"name": "entity.name.type.mist"
}
},
"include": "#operators"
},
{
"match": "\\b_?[A-Z][A-Za-z0-9_]*\\b(?!!)",
"match": "\\b[A-Z][A-Za-z0-9_]*\\b",
"name": "entity.name.type.mist"
}
]
},
"namespaces": {
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(?=\\s*::)",
"captures": {
"1": {
"name": "entity.name.namespace.mist"
}
}
},
"imports": {
"match": "\\buse\\s+([a-zA-Z_][a-zA-Z0-9_]*(?:\\s*::\\s*[a-zA-Z_][a-zA-Z0-9_]*)*)\\s*;",
"captures": {
"1": {
"name": "entity.name.namespace.mist"
"patterns": [
{
"include": "#types"
}
},
],
"name": "meta.import.mist"
},
"modules": {
@@ -451,10 +451,51 @@
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()",
"name": "entity.name.function.mist"
},
"impl": {
"patterns": [
{
"match": "\\b(impl)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s+for\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
"captures": {
"1": {
"name": "storage.type.mist"
},
"2": {
"patterns": [
{
"include": "#types"
}
]
},
"3": {
"patterns": [
{
"include": "#types"
}
]
}
}
},
{
"match": "\\b(impl)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s+",
"captures": {
"1": {
"name": "storage.type.mist"
},
"2": {
"patterns": [
{
"include": "#types"
}
]
}
}
}
]
},
"operators": {
"patterns": [
{
"match": "(?:\\+=|-=|\\*=|\\/=|%=|&=|\\|=|\\^=|<<=|>>=|<<|>>|\\.\\.=|\\.\\.|<=|>=|==|!=|&&|\\|\\||[+\\-*/%<>&|^=!]|\\+\\+|--)",
"match": "(?:\\+=|-=|\\*=|\\/=|%=|&=|\\|=|\\^=|<<=|>>=|<<|>>|\\.\\.=|\\.\\.|<=|>=|==|!=|&&|\\|\\||[+\\-*/%<>&|^=!]|\\+\\+|--|:)",
"name": "keyword.operator.mist"
}
]