Skip to content

Commit d614c68

Browse files
committed
Highlight body of C# 6 expression bodied members properly.
Fixes #638 and #403
1 parent fe328c0 commit d614c68

File tree

1 file changed

+66
-1
lines changed

1 file changed

+66
-1
lines changed

syntaxes/csharp.json

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,21 @@
405405
}
406406
]
407407
},
408+
{
409+
"begin": "=>",
410+
"beginCaptures": {
411+
"0": {
412+
"name": "punctuation.section.method.begin.cs"
413+
}
414+
},
415+
"end": "(?=;)",
416+
"name": "meta.method.body.cs",
417+
"patterns": [
418+
{
419+
"include": "#code"
420+
}
421+
]
422+
},
408423
{
409424
"begin": "{",
410425
"beginCaptures": {
@@ -423,7 +438,57 @@
423438
]
424439
},
425440
{
426-
"begin": "(?!new)(?=[\\w<].*\\s+)(?=[^=]+\\{)",
441+
"begin": "(?!new)(?=[\\w<].*\\s+)(?=[^\\(]+=>)",
442+
"end": ";",
443+
"endCaptures": {
444+
"0": {
445+
"name": "punctuation.section.property.end.cs"
446+
}
447+
},
448+
"name": "meta.property.cs",
449+
"patterns": [
450+
{
451+
"include": "#storage-modifiers"
452+
},
453+
{
454+
"begin": "(?=([\\w.]+)\\s*=>)",
455+
"captures": {
456+
"1": {
457+
"name": "entity.name.function.cs"
458+
}
459+
},
460+
"end": "(?==>)",
461+
"name": "meta.method.identifier.cs"
462+
},
463+
{
464+
"begin": "(?=\\w.*\\s+[\\w.]+\\s*=>)",
465+
"end": "(?=[\\w.]+\\s*=>)",
466+
"name": "meta.method.return-type.cs",
467+
"patterns": [
468+
{
469+
"include": "#builtinTypes"
470+
}
471+
]
472+
},
473+
{
474+
"begin": "=>",
475+
"beginCaptures": {
476+
"0": {
477+
"name": "punctuation.section.property.begin.cs"
478+
}
479+
},
480+
"end": "(?=;)",
481+
"name": "meta.method.body.cs",
482+
"patterns": [
483+
{
484+
"include": "#code"
485+
}
486+
]
487+
}
488+
]
489+
},
490+
{
491+
"begin": "(?!new)(?=[\\w<].*\\s+)(?=[^=\\(]+\\{)",
427492
"end": "}",
428493
"endCaptures": {
429494
"0": {

0 commit comments

Comments
 (0)