Update TextMate grammars from upstream sources (#286560)

* Update TextMate grammars from upstream sources
* Fix integration test on Windows to run TypeScript file directly
* Baseline update
This commit is contained in:
Dmitriy Vasyura
2026-01-08 17:24:04 +01:00
committed by GitHub
parent 16ccd1afc5
commit c8fdd1650c
20 changed files with 565 additions and 86 deletions

View File

@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/dotnet/csharp-tmLanguage/commit/965478e687f08d3b2ee4fe17104d3f41638bdca2",
"version": "https://github.com/dotnet/csharp-tmLanguage/commit/2e6860d87d4019b0b793b1e21e9e5c82185a01aa",
"name": "C#",
"scopeName": "source.cs",
"patterns": [
@@ -118,9 +118,15 @@
{
"include": "#type-declarations"
},
{
"include": "#constructor-declaration"
},
{
"include": "#property-declaration"
},
{
"include": "#fixed-size-buffer-declaration"
},
{
"include": "#field-declaration"
},
@@ -133,9 +139,6 @@
{
"include": "#variable-initializer"
},
{
"include": "#constructor-declaration"
},
{
"include": "#destructor-declaration"
},
@@ -334,6 +337,12 @@
{
"include": "#is-expression"
},
{
"include": "#boolean-literal"
},
{
"include": "#null-literal"
},
{
"include": "#anonymous-method-expression"
},
@@ -477,7 +486,7 @@
]
},
"attribute-section": {
"begin": "(\\[)(assembly|module|field|event|method|param|property|return|type)?(\\:)?",
"begin": "(\\[)(assembly|module|field|event|method|param|property|return|typevar|type)?(\\:)?",
"beginCaptures": {
"1": {
"name": "punctuation.squarebracket.open.cs"
@@ -1025,6 +1034,9 @@
},
"end": "(?=\\{|where|;)",
"patterns": [
{
"include": "#base-class-constructor-call"
},
{
"include": "#type"
},
@@ -1036,6 +1048,33 @@
}
]
},
"base-class-constructor-call": {
"begin": "(?x)\n(?:\n (@?[_[:alpha:]][_[:alnum:]]*)\\s*(\\.) # qualified name part\n)*\n(@?[_[:alpha:]][_[:alnum:]]*)\\s* # type name\n(\n <\n (?<type_args>\n [^<>()]|\n \\((?:[^<>()]|<[^<>()]*>|\\([^<>()]*\\))*\\)|\n <\\g<type_args>*>\n )*\n >\\s*\n)? # optional type arguments\n(?=\\() # followed by argument list",
"beginCaptures": {
"1": {
"name": "entity.name.type.cs"
},
"2": {
"name": "punctuation.accessor.cs"
},
"3": {
"name": "entity.name.type.cs"
},
"4": {
"patterns": [
{
"include": "#type-arguments"
}
]
}
},
"end": "(?<=\\))",
"patterns": [
{
"include": "#argument-list"
}
]
},
"generic-constraints": {
"begin": "(where)\\s+(@?[_[:alpha:]][_[:alnum:]]*)\\s*(:)",
"beginCaptures": {
@@ -1096,6 +1135,33 @@
}
]
},
"fixed-size-buffer-declaration": {
"begin": "(?x)\n\\b(fixed)\\b\\s+\n(?<type_name>\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name_and_type_args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type_args>\\s*<(?:[^<>]|\\g<type_args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name_and_type_args>)* # Are there any more names being dotted into?\n )\n)\\s+\n(\\g<identifier>)\\s* # buffer name\n(?=\\[)",
"beginCaptures": {
"1": {
"name": "storage.modifier.fixed.cs"
},
"2": {
"patterns": [
{
"include": "#type"
}
]
},
"6": {
"name": "entity.name.variable.field.cs"
}
},
"end": "(?=;)",
"patterns": [
{
"include": "#bracketed-argument-list"
},
{
"include": "#comment"
}
]
},
"field-declaration": {
"begin": "(?x)\n(?<type_name>\n (?:\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name_and_type_args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type_args>\\s*<(?:[^<>]|\\g<type_args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name_and_type_args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)\\s+\n(\\g<identifier>)\\s* # first field name\n(?!=>|==)(?=,|;|=|$)",
"beginCaptures": {
@@ -1302,10 +1368,13 @@
"match": "\\b(private|protected|internal)\\b"
},
{
"begin": "\\b(get)\\b\\s*(?=\\{|;|=>|//|/\\*|$)",
"begin": "(?:\\b(readonly)\\s+)?\\b(get)\\b\\s*(?=\\{|;|=>|//|/\\*|$)",
"beginCaptures": {
"1": {
"name": "storage.type.accessor.$1.cs"
"name": "storage.modifier.readonly.cs"
},
"2": {
"name": "storage.type.accessor.get.cs"
}
},
"end": "(?<=\\}|;)|(?=\\})",
@@ -1511,17 +1580,14 @@
]
},
"constructor-declaration": {
"begin": "(?=@?[_[:alpha:]][_[:alnum:]]*\\s*\\()",
"begin": "(@?[_[:alpha:]][_[:alnum:]]*)\\s*(?=\\(|$)",
"beginCaptures": {
"1": {
"name": "entity.name.function.cs"
}
},
"end": "(?<=\\})|(?=;)",
"patterns": [
{
"match": "(@?[_[:alpha:]][_[:alnum:]]*)\\b",
"captures": {
"1": {
"name": "entity.name.function.cs"
}
}
},
{
"begin": "(:)",
"beginCaptures": {
@@ -2661,6 +2727,15 @@
},
{
"include": "#local-variable-declaration"
},
{
"include": "#local-tuple-var-deconstruction"
},
{
"include": "#tuple-deconstruction-assignment"
},
{
"include": "#expression"
}
]
},
@@ -3045,11 +3120,14 @@
},
{
"include": "#local-tuple-var-deconstruction"
},
{
"include": "#local-tuple-declaration-deconstruction"
}
]
},
"local-variable-declaration": {
"begin": "(?x)\n(?:\n (?:(\\bref)\\s+(?:(\\breadonly)\\s+)?)?(\\bvar\\b)| # ref local\n (?<type_name>\n (?:\n (?:ref\\s+(?:readonly\\s+)?)? # ref local\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name_and_type_args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type_args>\\s*<(?:[^<>]|\\g<type_args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name_and_type_args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*[?*]\\s*)? # nullable or pointer suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\n)\\s+\n(\\g<identifier>)\\s*\n(?!=>)\n(?=,|;|=|\\))",
"begin": "(?x)\n(?:\n (?:(\\bref)\\s+(?:(\\breadonly)\\s+)?)?(\\bvar\\b)| # ref local\n (?<type_name>\n (?:\n (?:ref\\s+(?:readonly\\s+)?)? # ref local\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name_and_type_args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type_args>\\s*<(?:[^<>]|\\g<type_args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name_and_type_args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n )\n)\\s+\n(\\g<identifier>)\\s*\n(?!=>)\n(?=,|;|=|\\))",
"beginCaptures": {
"1": {
"name": "storage.modifier.ref.cs"
@@ -3193,6 +3271,18 @@
}
]
},
"local-tuple-declaration-deconstruction": {
"match": "(?x) # e.g. (int x, var y) = GetPoint();\n(?<tuple>\\((?:[^\\(\\)]|\\g<tuple>)+\\))\\s*\n(?!=>|==)(?==)",
"captures": {
"1": {
"patterns": [
{
"include": "#tuple-declaration-deconstruction-element-list"
}
]
}
}
},
"tuple-deconstruction-assignment": {
"match": "(?x)\n(?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\\s*\n(?!=>|==)(?==)",
"captures": {
@@ -4355,7 +4445,7 @@
}
},
"array-creation-expression": {
"begin": "(?x)\n\\b(new|stackalloc)\\b\\s*\n(?<type_name>\n (?:\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name_and_type_args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type_args>\\s*<(?:[^<>]|\\g<type_args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name_and_type_args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)?\\s*\n(?=\\[)",
"begin": "(?x)\n\\b(new|stackalloc)\\b\\s*\n(?<type_name>\n (?:\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name_and_type_args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type_args>\\s*<(?:[^<>]|\\g<type_args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name_and_type_args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s* # array suffix?\n \\[\n (?:\\s*,\\s*)* # commata for multi-dimensional arrays\n \\]\n \\s*\n (?:\\?)? # arrays can be nullable reference types\n \\s*\n )*\n )\n)?\\s*\n(?=\\[)",
"beginCaptures": {
"1": {
"name": "keyword.operator.expression.$1.cs"
@@ -5204,7 +5294,7 @@
"end": "(?<=$)",
"patterns": [
{
"include": "#comment"
"include": "#preprocessor-comment"
},
{
"include": "#preprocessor-define-or-undef"
@@ -5244,6 +5334,29 @@
}
]
},
"preprocessor-comment": {
"patterns": [
{
"name": "comment.line.double-slash.cs",
"match": "(//).*(?=$)",
"captures": {
"1": {
"name": "punctuation.definition.comment.cs"
}
}
},
{
"name": "comment.block.cs",
"begin": "/\\*",
"end": "\\*/",
"captures": {
"0": {
"name": "punctuation.definition.comment.cs"
}
}
}
]
},
"preprocessor-define-or-undef": {
"match": "\\b(?:(define)|(undef))\\b\\s*\\b([_[:alpha:]][_[:alnum:]]*)\\b",
"captures": {
@@ -5271,7 +5384,7 @@
"end": "(?=$)",
"patterns": [
{
"include": "#comment"
"include": "#preprocessor-comment"
},
{
"include": "#preprocessor-expression"