Skip to content

Commit 2d4b7ae

Browse files
Merge pull request #717 from ivanz/ivan-highlight-field-variable-types
Highlight variable and field types.
2 parents 6a93987 + ac079ff commit 2d4b7ae

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

syntaxes/csharp.json

+24-5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,26 @@
7171
}
7272
]
7373
},
74+
"variable": {
75+
"patterns": [
76+
{
77+
"match": "\\b(var)\\s+(.*?)(?=(=|;))",
78+
"captures": {
79+
"1": {
80+
"name": "keyword.other.var.cs"
81+
}
82+
}
83+
},
84+
{
85+
"match": "\\b(?!var|return|yield|throw)([\\w<>*?\\[\\]]+)\\s+([\\w]+)\\s*(?=(=(?!=)|;))",
86+
"captures": {
87+
"1": {
88+
"name": "storage.type.variable.cs"
89+
}
90+
}
91+
}
92+
]
93+
},
7494
"block": {
7595
"patterns": [
7696
{
@@ -176,6 +196,9 @@
176196
{
177197
"include": "#class"
178198
},
199+
{
200+
"include": "#variable"
201+
},
179202
{
180203
"include": "#constants"
181204
},
@@ -316,13 +339,9 @@
316339
"name": "keyword.operator.cs"
317340
},
318341
{
319-
"match": "\\b(event|delegate|fixed|add|remove|set|get|value)\\b",
342+
"match": "\\b(event|delegate|fixed|add|remove|set|get|value|var)\\b",
320343
"name": "keyword.other.cs"
321344
},
322-
{
323-
"match": "\\b(var)\\b",
324-
"name": "storage.type.var.cs"
325-
},
326345
{
327346
"match": "[@]\\b(namespace|class|var|event|delegate|add|remove|set|get|value|new|is|as|using|checked|unchecked|typeof|sizeof|nameof|when|override|readonly|stackalloc|from|where|select|group|into|orderby|join|let|on|equals|by|ascending|descending|if|else|while|for|foreach|in|do|return|continue|break|switch|case|default|goto|throw|try|catch|finally|lock|yield|await|internal|public|protected|private|static|const|sealed|abstract|virtual|extern|unsafe|volatile|implicit|explicit|operator|async|partial|bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|object|short|ushort|string|void|struct|enum|interface)\\b",
328347
"name": "meta.class.body.cs"

0 commit comments

Comments
 (0)