Skip to content

Commit 740b423

Browse files
committed
Update Razor for C# version: 2
1 parent d455e10 commit 740b423

3 files changed

Lines changed: 53 additions & 41 deletions

File tree

Razor/C# (Razor).sublime-syntax

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,3 @@ contexts:
3434
inside_verbatim_format_string_syntax:
3535
- meta_include_prototype: false
3636
- include: immediately_pop
37-
38-
immediately_pop:
39-
- match: ''
40-
pop: 1

Razor/embeddings/C# (for C# Razor HTML attribute).sublime-syntax

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%YAML 1.2
22
---
33
scope: source.cs.embedded.html-attribute-string.razor
4-
version: 1
4+
version: 2
55
hidden: true
66

77
extends: Packages/HTML (C#)/Razor/C# (Razor).sublime-syntax

Razor/tests/syntax_test_cshtml.cshtml

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
<!-- ^ - source.cs.embedded -->
88
@model IEnumerable<SomeNamespace.SomeType>
99
<!-- <- punctuation.section.embedded.line - source.cs.embedded -->
10-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded -->
11-
<!-- ^ keyword.other -->
12-
<!-- ^^^^^^^^^^^ support.type -->
13-
<!-- ^ punctuation.definition.generic.begin -->
14-
<!-- ^^^^^^^^^^^^^ support.type -->
15-
<!-- ^ punctuation.accessor.dot.namespace -->
16-
<!-- ^^^^^^^^ support.type -->
17-
<!-- ^ punctuation.definition.generic.end -->
10+
<!--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html -->
11+
<!--^^ keyword.other.cs-razor -->
12+
<!-- ^^^^^^^^^^^ support.type.cs -->
13+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.cs -->
14+
<!-- ^ punctuation.definition.generic.begin.cs -->
15+
<!-- ^^^^^^^^^^^^^ support.type.cs -->
16+
<!-- ^ punctuation.accessor.dot.cs -->
17+
<!-- ^^^^^^^^ support.type.cs -->
18+
<!-- ^ punctuation.definition.generic.end.cs -->
1819
<!-- ^ - source.cs.embedded -->
1920

2021
<p>@@Username</p>
@@ -41,18 +42,28 @@
4142
<!-- ^^ punctuation.definition.comment.block.end.cs-razor -->
4243

4344
<p>@DateTime.Now</p>
44-
<!-- ^^^^^^^ source.cs.embedded variable.other -->
45-
<!-- ^ source.cs.embedded punctuation.accessor.dot -->
46-
<!-- ^^^ source.cs.embedded variable.other -->
47-
<!-- ^^^ meta.tag.block.any -->
45+
<!--^^^^^^^^^^^^ source.cs.embedded.html -->
46+
<!--^^^^^^^^ variable.other.cs -->
47+
<!-- ^ punctuation.accessor.dot.cs -->
48+
<!-- ^^^ variable.other.cs -->
49+
<!-- ^^^^ meta.tag.block.any.html -->
50+
<!-- ^^ punctuation.definition.tag.begin.html -->
51+
<!-- ^ entity.name.tag.block.any.html -->
52+
<!-- ^ punctuation.definition.tag.end.html -->
4853
<p>@DateTime.IsLeapYear(2016)</p>
49-
<!-- ^^^^^^^ source.cs.embedded variable.other -->
50-
<!-- ^ source.cs.embedded punctuation.accessor.dot -->
51-
<!-- ^^^^^^^^^^ source.cs.embedded meta.function-call variable.function -->
52-
<!-- ^ punctuation.section.group.begin -->
53-
<!-- ^^^^ constant.numeric -->
54-
<!-- ^ punctuation.section.group.end -->
55-
<!-- ^^^ meta.tag.block.any -->
54+
<!--^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html -->
55+
<!--^^^^^^^^ variable.other.cs -->
56+
<!-- ^ punctuation.accessor.dot.cs -->
57+
<!-- ^^^^^^^^^^^^^^^^ meta.function-call.cs -->
58+
<!-- ^^^^^^^^^^ variable.function.cs -->
59+
<!-- ^^^^^^ meta.group.cs -->
60+
<!-- ^ punctuation.section.group.begin.cs -->
61+
<!-- ^^^^ meta.number.integer.decimal.cs constant.numeric.value.cs -->
62+
<!-- ^ punctuation.section.group.end.cs -->
63+
<!-- ^^^^ meta.tag.block.any.html -->
64+
<!-- ^^ punctuation.definition.tag.begin.html -->
65+
<!-- ^ entity.name.tag.block.any.html -->
66+
<!-- ^ punctuation.definition.tag.end.html -->
5667

5768
<p>@(GenericMethod<int>())</p>
5869
<!-- ^^ punctuation.section.embedded.begin -->
@@ -99,7 +110,10 @@ else
99110
@switch (value)
100111
{
101112
case 1:
102-
<!--^^^^ keyword.control.switch.case -->
113+
<!--^^^^^^^^ meta.block.cs -->
114+
<!--^^^^ keyword.control.conditional.case.cs -->
115+
<!-- ^ meta.number.integer.decimal.cs constant.numeric.value.cs -->
116+
<!-- ^ punctuation.separator.case-statement.cs -->
103117
<p>The value is 1!</p>
104118
break;
105119
case 1337:
@@ -134,9 +148,10 @@ else
134148

135149
@{
136150
var quote = "The future depends on what you do today. - Mahatma Gandhi";
137-
<!--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.cs source.cs.embedded.html -->
151+
<!--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.cs source.cs.embedded.html -->
152+
<!--^^^ storage.type.variable.cs -->
138153
<!-- ^^^^^ variable.other.cs -->
139-
<!-- ^ keyword.operator.assignment.variable.cs -->
154+
<!-- ^ keyword.operator.assignment.cs -->
140155
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.cs string.quoted.double.cs -->
141156
<!-- ^ punctuation.definition.string.begin.cs -->
142157
<!-- ^ punctuation.definition.string.end.cs -->
@@ -170,35 +185,35 @@ else
170185
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.begin.html -->
171186
<!-- ^^^^^^^^ meta.class-name.html meta.string.html string.quoted.double.html -->
172187
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.end.html -->
188+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
173189
<!-- ^^^^^^^^^ entity.other.attribute-name.html -->
174190
<!-- ^ punctuation.separator.key-value.html -->
175191
<!-- ^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
176192
<!-- ^ punctuation.definition.string.begin.html -->
177193
<!-- ^ punctuation.section.interpolation.begin.razor -->
178-
<!-- ^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
179-
<!-- ^^^^^ variable.other.cs -->
194+
<!-- ^^^^^ variable.language.this.razor -->
180195
<!-- ^ punctuation.accessor.dot.cs -->
181196
<!-- ^^^^^^^^ variable.other.cs -->
182197
<!-- ^ punctuation.definition.string.end.html -->
198+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
183199
<!-- ^^^^^^^^^^^^^ entity.other.attribute-name.html -->
184200
<!-- ^ punctuation.separator.key-value.html -->
185201
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
186202
<!-- ^ punctuation.definition.string.begin.html -->
187203
<!-- ^ punctuation.section.interpolation.begin.razor -->
188-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
189-
<!-- ^^^^^ variable.other.cs -->
204+
<!-- ^^^^^ variable.language.this.razor -->
190205
<!-- ^ punctuation.accessor.dot.cs -->
191206
<!-- ^^^^^^^^^^^^^ variable.other.cs -->
192207
<!-- ^ punctuation.accessor.dot.cs -->
193208
<!-- ^^^^^^^^ variable.other.cs -->
194209
<!-- ^ punctuation.definition.string.end.html -->
210+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
195211
<!-- ^^^^^^^^^^^^^^^ entity.other.attribute-name.html -->
196212
<!-- ^ punctuation.separator.key-value.html -->
197213
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
198214
<!-- ^ punctuation.definition.string.begin.html -->
199215
<!-- ^ punctuation.section.interpolation.begin.razor -->
200-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
201-
<!-- ^^^^^ variable.other.cs -->
216+
<!-- ^^^^^ variable.language.this.razor -->
202217
<!-- ^ punctuation.accessor.dot.cs -->
203218
<!-- ^^^^^^^^^^^^^ variable.other.cs -->
204219
<!-- ^ punctuation.accessor.dot.cs -->
@@ -216,13 +231,13 @@ else
216231
<!-- ^ punctuation.section.group.begin.cs -->
217232
<!-- ^ punctuation.section.group.end.cs -->
218233
<!-- ^ punctuation.definition.string.end.html -->
234+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
219235
<!-- ^^^^^^^^^^^^^^^^^^^^ entity.other.attribute-name.html -->
220236
<!-- ^ punctuation.separator.key-value.html -->
221237
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
222238
<!-- ^ punctuation.definition.string.begin.html -->
223239
<!-- ^ punctuation.section.interpolation.begin.razor -->
224-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
225-
<!-- ^^^^^ variable.other.cs -->
240+
<!-- ^^^^^ variable.language.this.razor -->
226241
<!-- ^ punctuation.accessor.dot.cs -->
227242
<!-- ^^^^^^^^^^^^^ variable.other.cs -->
228243
<!-- ^ punctuation.accessor.dot.cs -->
@@ -253,24 +268,25 @@ else
253268
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.begin.html -->
254269
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.url.html meta.string.html string.quoted.double.html -->
255270
<!-- ^ punctuation.section.interpolation.begin.razor -->
256-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
257-
<!-- ^^^^^ variable.other.cs -->
271+
<!-- ^^^^^ variable.language.this.razor -->
258272
<!-- ^ punctuation.accessor.dot.cs -->
259273
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.cs -->
260274
<!-- ^^^^^^^^^^^^^^ variable.function.cs -->
261275
<!-- ^^^^^^^^^^^^^^^^^^^^^^^ meta.group.cs -->
262276
<!-- ^ punctuation.section.group.begin.cs -->
263-
<!-- ^^^^^ variable.other.cs -->
277+
<!-- ^^^^^ variable.language.this.razor -->
264278
<!-- ^ punctuation.accessor.dot.cs -->
265279
<!-- ^^^^^^^^^^^ variable.other.cs -->
266-
<!-- ^ keyword.operator.cs -->
280+
<!-- ^ keyword.operator.arithmetic.cs -->
267281
<!-- ^ meta.number.integer.decimal.cs constant.numeric.value.cs -->
268282
<!-- ^ punctuation.section.group.end.cs -->
269283
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.end.html -->
270284
<!-- ^ punctuation.definition.tag.end.html -->
285+
<!-- ^^^^ meta.tag.inline.any.html -->
271286
<!-- ^^ punctuation.definition.tag.begin.html -->
272287
<!-- ^ entity.name.tag.inline.any.html -->
273288
<!-- ^ punctuation.definition.tag.end.html -->
289+
274290
</li>
275291
<li>
276292
<a href="@Model.FunctionCall("embedded string")">"quotes" everywhere</a>
@@ -283,8 +299,7 @@ else
283299
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.begin.html -->
284300
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.url.html meta.string.html string.quoted.double.html -->
285301
<!-- ^ punctuation.section.interpolation.begin.razor -->
286-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
287-
<!-- ^^^^^ variable.other.cs -->
302+
<!-- ^^^^^ variable.language.this.razor -->
288303
<!-- ^ punctuation.accessor.dot.cs -->
289304
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.cs -->
290305
<!-- ^^^^^^^^^^^^ variable.function.cs -->
@@ -296,6 +311,7 @@ else
296311
<!-- ^ punctuation.section.group.end.cs -->
297312
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.end.html -->
298313
<!-- ^ punctuation.definition.tag.end.html -->
314+
<!-- ^^^^ meta.tag.inline.any.html -->
299315
<!-- ^^ punctuation.definition.tag.begin.html -->
300316
<!-- ^ entity.name.tag.inline.any.html -->
301317
<!-- ^ punctuation.definition.tag.end.html -->

0 commit comments

Comments
 (0)