chore: update VSCode syntax definition

the TextMate language definition was completely rewritten by Claude from my Sublime Syntax definition
some tests against Midas files show that it seems on par with the other definition

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-08 13:41:47 +02:00
parent 5c66c4b645
commit 4f9099a4c4
3 changed files with 524 additions and 140 deletions

View File

@@ -1,19 +1,16 @@
{ {
"brackets": [ "brackets": [
["{", "}"], ["{", "}"],
["[", "]"], ["[", "]"]
["<", ">"]
], ],
"autoClosingPairs": [ "autoClosingPairs": [
{ "open": "{", "close": "}" }, { "open": "{", "close": "}" },
{ "open": "[", "close": "]" }, { "open": "[", "close": "]" },
{ "open": "(", "close": ")" }, { "open": "(", "close": ")" }
{ "open": "<", "close": ">" }
], ],
"surroundingPairs": [ "surroundingPairs": [
["{", "}"], ["{", "}"],
["[", "]"], ["[", "]"],
["(", ")"], ["(", ")"]
["<", ">"]
] ]
} }

View File

@@ -10,7 +10,6 @@
{ {
"id": "midas", "id": "midas",
"extensions": [ "extensions": [
".mpy",
".midas" ".midas"
], ],
"aliases": [ "aliases": [
@@ -23,10 +22,7 @@
{ {
"language": "midas", "language": "midas",
"scopeName": "source.midas", "scopeName": "source.midas",
"path": "./syntaxes/midas.tmLanguage.json", "path": "./syntaxes/midas.tmLanguage.json"
"embeddedLanguages": {
"meta.embedded.block.python": "python"
}
} }
] ]
} }

View File

@@ -2,167 +2,558 @@
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Midas", "name": "Midas",
"scopeName": "source.midas", "scopeName": "source.midas",
"patterns": [{ "include": "#statement" }], "fileTypes": [
"midas"
],
"patterns": [
{
"include": "#comments"
},
{
"include": "#alias-stmt"
},
{
"include": "#type-stmt"
},
{
"include": "#extend-stmt"
},
{
"include": "#extend-body"
},
{
"include": "#predicate-stmt"
}
],
"repository": { "repository": {
"comment": { "comments": {
"begin": "(//)",
"end": "($)",
"name": "comment.line",
"beginCaptures": {
"1": {
"name": "comment.line.double-dash"
}
}
},
"type-def": {
"begin": "\\b(type)\\s+([a-zA-Z_][a-zA-Z_\\d]*)",
"end": "$",
"beginCaptures": {
"1": {
"name": "keyword.control.type.midas"
},
"2": {
"name" : "variable.name"
}
},
"patterns": [ "patterns": [
{ "include": "#type-base" }, {
{ "include": "#type-body" } "begin": "//",
]
},
"type-base": {
"begin": "(\\()([a-zA-Z_][a-zA-Z_\\d]*)(\\))",
"end": "$",
"beginCaptures": {
"1": {
"name": "punctuation.definition.base.begin.midas"
},
"2": {
"name": "variable.name"
},
"3": {
"name": "punctuation.definition.base.end.midas"
}
},
"patterns": [
{ "include": "#type-cond" }
]
},
"type-cond": {
"begin": "where",
"end": "$",
"beginCaptures": { "beginCaptures": {
"0": { "0": {
"name": "keyword.control.where.midas" "name": "punctuation.definition.comment.midas"
}
} }
}, },
"type-body": { "end": "$",
"begin": "\\{", "name": "comment.line.double-slash.midas"
"end": "\\}", },
{
"begin": "/\\*",
"beginCaptures": { "beginCaptures": {
"0": { "0": {
"name": "punctuation.definition.type-body.begin.midas" "name": "punctuation.definition.comment.midas"
} }
}, },
"end": "\\*/",
"endCaptures": { "endCaptures": {
"0": { "0": {
"name": "punctuation.definition.type-body.end.midas" "name": "punctuation.definition.comment.midas"
}
},
"name": "comment.block.midas"
}
]
},
"string": {
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.midas"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.midas"
}
},
"name": "string.quoted.double.c"
},
"alias-stmt": {
"begin": "\\b(alias)\\b",
"beginCaptures": {
"1": {
"name": "keyword.declaration.midas"
}
},
"end": "$",
"name": "meta.declaration.alias.midas",
"patterns": [
{
"include": "#comments"
},
{
"match": "[A-Za-z_][A-Za-z0-9_]*",
"name": "entity.name.type.midas"
},
{
"begin": "=",
"beginCaptures": {
"0": {
"name": "keyword.operator.equal.midas"
}
},
"end": "$",
"patterns": [
{
"include": "#type-expr"
}
]
}
]
},
"type-stmt": {
"begin": "\\b(type)\\b",
"beginCaptures": {
"1": {
"name": "keyword.declaration.midas"
}
},
"end": "$",
"name": "meta.declaration.type.midas",
"patterns": [
{
"include": "#comments"
},
{
"match": "[A-Za-z_][A-Za-z0-9_]*",
"name": "entity.name.type.midas"
},
{
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "punctuation.section.brackets.begin.midas"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.section.brackets.end.midas"
} }
}, },
"patterns": [ "patterns": [
{"include": "#type-prop"}, {
{"include": "#comment"} "include": "#comments"
},
{
"include": "#type-params"
}
] ]
}, },
"type-prop": { {
"match": "([a-zA-Z_][a-zA-Z_\\d]*)(:)\\s*([a-zA-Z_][a-zA-Z_\\d]*)", "begin": "=",
"captures": { "beginCaptures": {
"0": {
"name": "keyword.operator.equal.midas"
}
},
"end": "$",
"patterns": [
{
"include": "#type-expr"
}
]
}
]
},
"type-params": {
"patterns": [
{
"include": "#comments"
},
{
"match": "<:",
"name": "keyword.operator.subtype.midas"
},
{
"match": "[A-Za-z][A-Za-z0-9_]*",
"name": "entity.name.type.midas"
}
]
},
"extend-stmt": {
"begin": "\\b(extend)\\b",
"beginCaptures": {
"1": { "1": {
"name": "variable.name" "name": "keyword.declaration.midas"
}
},
"end": "(?=\\{)|$",
"name": "meta.declaration.extend.midas",
"patterns": [
{
"include": "#comments"
},
{
"match": "[A-Za-z_][A-Za-z0-9_]*",
"name": "entity.name.type.midas"
},
{
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "punctuation.section.brackets.begin.midas"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.section.brackets.end.midas"
}
},
"patterns": [
{
"include": "#comments"
},
{
"include": "#type-params"
}
]
}
]
},
"extend-body": {
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.section.block.begin.midas"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.section.block.end.midas"
}
},
"patterns": [
{
"include": "#comments"
},
{
"include": "#member-stmt"
}
]
},
"member-stmt": {
"patterns": [
{
"include": "#comments"
},
{
"begin": "\\b(prop|def)\\b",
"beginCaptures": {
"1": {
"name": "keyword.other.midas"
}
},
"end": "$",
"patterns": [
{
"include": "#comments"
},
{
"match": "[A-Za-z_][A-Za-z0-9_]*",
"name": "variable.other.member.midas"
},
{
"begin": ":",
"beginCaptures": {
"0": {
"name": "punctuation.separator.annotation.midas"
}
},
"end": "$",
"patterns": [
{
"include": "#type-expr"
}
]
}
]
}
]
},
"predicate-stmt": {
"begin": "\\b(predicate)\\b",
"beginCaptures": {
"1": {
"name": "keyword.declaration.midas"
}
},
"end": "$",
"name": "meta.declaration.predicate.midas",
"patterns": [
{
"include": "#comments"
},
{
"match": "[A-Za-z_][A-Za-z0-9_]*",
"name": "entity.name.function.midas"
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.section.group.begin.midas"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.group.end.midas"
}
},
"patterns": [
{
"include": "#predicate-params"
}
]
},
{
"begin": "=",
"beginCaptures": {
"0": {
"name": "keyword.operator.equal.midas"
}
},
"end": "$",
"patterns": [
{
"include": "#constraint"
}
]
}
]
},
"predicate-params": {
"patterns": [
{
"include": "#comments"
},
{
"begin": "([A-Za-z_][A-Za-z0-9_]*)(:)",
"beginCaptures": {
"1": {
"name": "variable.parameter.midas"
}, },
"2": { "2": {
"name": "punctuation.separator.annotation.midas" "name": "punctuation.separator.annotation.midas"
},
"3": {
"name": "meta.type.name"
}
} }
}, },
"extend-def": { "end": "(?=,)|(?=\\))",
"begin": "\\b(extend)\\s*([a-zA-Z_][a-zA-Z_\\d]*)\\s+(\\{)", "patterns": [
"end": "\\}", {
"include": "#type-expr"
}
]
},
{
"match": ",",
"name": "punctuation.separator.midas"
}
]
},
"type-expr": {
"patterns": [
{
"include": "#comments"
},
{
"begin": "\\b(fn)\\s*(\\()",
"beginCaptures": { "beginCaptures": {
"1": { "1": {
"name": "keyword.control.extend.midas" "name": "keyword.other.midas"
}, },
"2": { "2": {
"name": "variable.name" "name": "punctuation.section.group.begin.midas"
},
"3": {
"name": "punctuation.definition.extend-body.begin.midas"
} }
}, },
"end": "\\)",
"endCaptures": { "endCaptures": {
"0": { "0": {
"name": "punctuation.definition.extend-body.end.midas" "name": "punctuation.section.group.end.midas"
} }
}, },
"patterns": [ "patterns": [
{"include": "#op-def"}, {
{"include": "#comment"} "include": "#fn-params"
}
] ]
}, },
"op-def": { {
"match": "\\b(op)\\s+(\\S+)\\s*\\(\\s*([a-zA-Z_][a-zA-Z_\\d]*)\\s*\\)\\s*(->)\\s*([a-zA-Z_][a-zA-Z_\\d]*)", "match": "->",
"captures": { "name": "keyword.operator.arrow.midas"
"1": {
"name": "keyword.control.op.midas"
}, },
"2": { {
"name" : "keyword.operator" "begin": "\\b(where)\\b",
},
"3": {
"name" : "variable.name"
},
"4": {
"name" : "keyword.operator.assignment"
},
"5": {
"name" : "variable.name"
}
}
},
"pred-def": {
"begin": "(predicate)\\s+([a-zA-Z_][a-zA-Z_\\d]*)\\(([a-zA-Z_][a-zA-Z_\\d]*):\\s*([a-zA-Z_][a-zA-Z_\\d]*)\\)\\s*(=)",
"end": "$",
"beginCaptures": { "beginCaptures": {
"1": { "1": {
"name": "keyword.control.pred.midas" "name": "keyword.other.midas"
}
}, },
"2": { "end": "$",
"name": "variable.name" "patterns": [
{
"include": "#constraint"
}
]
},
{
"begin": "(\\bFrame\\b)(\\s*)(\\[)",
"beginCaptures": {
"1": {
"name": "entity.name.type.midas"
}, },
"3": { "3": {
"name": "variable.name" "name": "punctuation.section.brackets.begin.midas"
}
}, },
"4": { "end": "\\]",
"name": "variable.name" "endCaptures": {
}, "0": {
"5": { "name": "punctuation.section.brackets.end.midas"
"name": "keyword.operator.assignment"
} }
}, },
"patterns": [ "patterns": [
{ "include": "source.python" } {
"include": "#frame-schema"
}
] ]
}, },
"statement": { {
"match": "\\bFrame\\b",
"name": "entity.name.type.midas"
},
{
"match": "[A-Za-z_][A-Za-z0-9_]*",
"name": "entity.name.type.midas"
},
{
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "punctuation.section.brackets.begin.midas"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.section.brackets.end.midas"
}
},
"patterns": [ "patterns": [
{ "include": "#comment" }, {
{ "include": "#type-def" }, "include": "#comments"
{ "include": "#extend-def" }, },
{ "include": "#pred-def" } {
"include": "#type-expr"
},
{
"match": ",",
"name": "punctuation.separator.midas"
}
]
}
]
},
"fn-params": {
"patterns": [
{
"include": "#comments"
},
{
"begin": "([A-Za-z_][A-Za-z0-9_]*)(:)",
"beginCaptures": {
"1": {
"name": "variable.parameter.midas"
},
"2": {
"name": "punctuation.separator.annotation.midas"
}
},
"end": "(?=,)|(?=\\))",
"patterns": [
{
"include": "#type-expr"
},
{
"match": "\\?",
"name": "keyword.operator.qmark.midas"
}
]
},
{
"match": ",",
"name": "punctuation.separator.midas"
},
{
"include": "#type-expr"
}
]
},
"constraint": {
"patterns": [
{
"include": "#comments"
},
{
"match": "\\d+(\\.\\d+)?",
"name": "constant.numeric.midas"
},
{
"match": "\\b(true|false|none)\\b",
"name": "constant.language.midas"
},
{
"include": "#string"
},
{
"match": "(<=|>=|<|>|==|!=|&)",
"name": "keyword.operator.midas"
},
{
"match": "_",
"name": "variable.language.midas"
},
{
"match": "[A-Za-z_][A-Za-z0-9_]*(?=\\s*\\()",
"name": "variable.function.midas"
},
{
"match": "[A-Za-z_][A-Za-z0-9_]*",
"name": "variable.other.readwrite.midas"
}
]
},
"frame-schema": {
"patterns": [
{
"include": "#comments"
},
{
"match": "[A-Za-z_][A-Za-z0-9_]*",
"name": "variable.other.member.midas"
},
{
"begin": ":",
"beginCaptures": {
"0": {
"name": "punctuation.separator.annotation.midas"
}
},
"end": "(?=,)|(?=\\])",
"patterns": [
{
"include": "#type-expr"
}
]
},
{
"match": ",",
"name": "punctuation.separator.midas"
}
] ]
} }
} }