Skip to content

Commit 697ff0d

Browse files
committed
C# syntax highlighting: support string interpolation syntax
1 parent 4279433 commit 697ff0d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

ICSharpCode.AvalonEdit/Highlighting/Resources/CSharp-Mode.xshd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<!-- The named colors 'Comment' and 'String' are used in SharpDevelop to detect if a line is inside a multiline string/comment -->
44
<Color name="Comment" foreground="Green" exampleText="// comment" />
55
<Color name="String" foreground="Blue" exampleText="string text = &quot;Hello, World!&quot;"/>
6+
<Color name="StringInterpolation" foreground="Black" exampleText="string text = $&quot;Hello, {name}!&quot;"/>
67
<Color name="Char" foreground="Magenta" exampleText="char linefeed = '\n';"/>
78
<Color name="Preprocessor" foreground="Green" exampleText="#region Title" />
89
<Color name="Punctuation" exampleText="a(b.c);" />
@@ -107,6 +108,18 @@
107108
</RuleSet>
108109
</Span>
109110

111+
<Span color="String">
112+
<Begin>\$"</Begin>
113+
<End>"</End>
114+
<RuleSet>
115+
<!-- span for escape sequences -->
116+
<Span begin="\\" end="."/>
117+
<Span begin="\{\{" end=""/>
118+
<!-- string interpolation -->
119+
<Span begin="{" end="}" color="StringInterpolation" ruleSet=""/>
120+
</RuleSet>
121+
</Span>
122+
110123
<!-- don't highlight "@int" as keyword -->
111124
<Rule>
112125
@[\w\d_]+

0 commit comments

Comments
 (0)