Skip to content

Commit eeef9b6

Browse files
committed
Update Razor for C# version: 2
1 parent d5ea50e commit eeef9b6

2 files changed

Lines changed: 54 additions & 36 deletions

File tree

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

Lines changed: 6 additions & 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/C#/C#.sublime-syntax
@@ -13,6 +13,11 @@ contexts:
1313
- match: (?=")
1414
pop: 1
1515

16+
keywords:
17+
- meta_prepend: true
18+
- match: \bModel\b
19+
scope: variable.language.this.razor
20+
1621
inside_triple_quoted_raw_string_syntax:
1722
- meta_include_prototype: false
1823
- include: immediately_pop

Razor/tests/syntax_test_cshtml.cshtml

Lines changed: 48 additions & 35 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>
@@ -36,18 +37,28 @@
3637
<!-- ^^^^ meta.tag.inline -->
3738

3839
<p>@DateTime.Now</p>
39-
<!-- ^^^^^^^ source.cs.embedded variable.other -->
40-
<!-- ^ source.cs.embedded punctuation.accessor.dot -->
41-
<!-- ^^^ source.cs.embedded variable.other -->
42-
<!-- ^^^ meta.tag.block.any -->
40+
<!--^^^^^^^^^^^^ source.cs.embedded.html -->
41+
<!--^^^^^^^^ variable.other.cs -->
42+
<!-- ^ punctuation.accessor.dot.cs -->
43+
<!-- ^^^ variable.other.cs -->
44+
<!-- ^^^^ meta.tag.block.any.html -->
45+
<!-- ^^ punctuation.definition.tag.begin.html -->
46+
<!-- ^ entity.name.tag.block.any.html -->
47+
<!-- ^ punctuation.definition.tag.end.html -->
4348
<p>@DateTime.IsLeapYear(2016)</p>
44-
<!-- ^^^^^^^ source.cs.embedded variable.other -->
45-
<!-- ^ source.cs.embedded punctuation.accessor.dot -->
46-
<!-- ^^^^^^^^^^ source.cs.embedded meta.function-call variable.function -->
47-
<!-- ^ punctuation.section.group.begin -->
48-
<!-- ^^^^ constant.numeric -->
49-
<!-- ^ punctuation.section.group.end -->
50-
<!-- ^^^ meta.tag.block.any -->
49+
<!--^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html -->
50+
<!--^^^^^^^^ variable.other.cs -->
51+
<!-- ^ punctuation.accessor.dot.cs -->
52+
<!-- ^^^^^^^^^^^^^^^^ meta.function-call.cs -->
53+
<!-- ^^^^^^^^^^ variable.function.cs -->
54+
<!-- ^^^^^^ meta.group.cs -->
55+
<!-- ^ punctuation.section.group.begin.cs -->
56+
<!-- ^^^^ meta.number.integer.decimal.cs constant.numeric.value.cs -->
57+
<!-- ^ punctuation.section.group.end.cs -->
58+
<!-- ^^^^ meta.tag.block.any.html -->
59+
<!-- ^^ punctuation.definition.tag.begin.html -->
60+
<!-- ^ entity.name.tag.block.any.html -->
61+
<!-- ^ punctuation.definition.tag.end.html -->
5162

5263
<p>@(GenericMethod<int>())</p>
5364
<!-- ^^ punctuation.section.embedded.begin -->
@@ -129,9 +140,10 @@ else
129140

130141
@{
131142
var quote = "The future depends on what you do today. - Mahatma Gandhi";
132-
<!--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.cs source.cs.embedded.html -->
143+
<!--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.cs source.cs.embedded.html -->
144+
<!--^^^ storage.type.variable.cs -->
133145
<!-- ^^^^^ variable.other.cs -->
134-
<!-- ^ keyword.operator.assignment.variable.cs -->
146+
<!-- ^ keyword.operator.assignment.cs -->
135147
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.cs string.quoted.double.cs -->
136148
<!-- ^ punctuation.definition.string.begin.cs -->
137149
<!-- ^ punctuation.definition.string.end.cs -->
@@ -165,35 +177,35 @@ else
165177
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.begin.html -->
166178
<!-- ^^^^^^^^ meta.class-name.html meta.string.html string.quoted.double.html -->
167179
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.end.html -->
180+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
168181
<!-- ^^^^^^^^^ entity.other.attribute-name.html -->
169182
<!-- ^ punctuation.separator.key-value.html -->
170183
<!-- ^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
171184
<!-- ^ punctuation.definition.string.begin.html -->
172185
<!-- ^ punctuation.section.interpolation.begin.razor -->
173-
<!-- ^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
174-
<!-- ^^^^^ variable.other.cs -->
186+
<!-- ^^^^^ variable.language.this.razor -->
175187
<!-- ^ punctuation.accessor.dot.cs -->
176188
<!-- ^^^^^^^^ variable.other.cs -->
177189
<!-- ^ punctuation.definition.string.end.html -->
190+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
178191
<!-- ^^^^^^^^^^^^^ entity.other.attribute-name.html -->
179192
<!-- ^ punctuation.separator.key-value.html -->
180193
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
181194
<!-- ^ punctuation.definition.string.begin.html -->
182195
<!-- ^ punctuation.section.interpolation.begin.razor -->
183-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
184-
<!-- ^^^^^ variable.other.cs -->
196+
<!-- ^^^^^ variable.language.this.razor -->
185197
<!-- ^ punctuation.accessor.dot.cs -->
186198
<!-- ^^^^^^^^^^^^^ variable.other.cs -->
187199
<!-- ^ punctuation.accessor.dot.cs -->
188200
<!-- ^^^^^^^^ variable.other.cs -->
189201
<!-- ^ punctuation.definition.string.end.html -->
202+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
190203
<!-- ^^^^^^^^^^^^^^^ entity.other.attribute-name.html -->
191204
<!-- ^ punctuation.separator.key-value.html -->
192205
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
193206
<!-- ^ punctuation.definition.string.begin.html -->
194207
<!-- ^ punctuation.section.interpolation.begin.razor -->
195-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
196-
<!-- ^^^^^ variable.other.cs -->
208+
<!-- ^^^^^ variable.language.this.razor -->
197209
<!-- ^ punctuation.accessor.dot.cs -->
198210
<!-- ^^^^^^^^^^^^^ variable.other.cs -->
199211
<!-- ^ punctuation.accessor.dot.cs -->
@@ -211,13 +223,13 @@ else
211223
<!-- ^ punctuation.section.group.begin.cs -->
212224
<!-- ^ punctuation.section.group.end.cs -->
213225
<!-- ^ punctuation.definition.string.end.html -->
226+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
214227
<!-- ^^^^^^^^^^^^^^^^^^^^ entity.other.attribute-name.html -->
215228
<!-- ^ punctuation.separator.key-value.html -->
216229
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
217230
<!-- ^ punctuation.definition.string.begin.html -->
218231
<!-- ^ punctuation.section.interpolation.begin.razor -->
219-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
220-
<!-- ^^^^^ variable.other.cs -->
232+
<!-- ^^^^^ variable.language.this.razor -->
221233
<!-- ^ punctuation.accessor.dot.cs -->
222234
<!-- ^^^^^^^^^^^^^ variable.other.cs -->
223235
<!-- ^ punctuation.accessor.dot.cs -->
@@ -248,24 +260,25 @@ else
248260
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.begin.html -->
249261
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.url.html meta.string.html string.quoted.double.html -->
250262
<!-- ^ punctuation.section.interpolation.begin.razor -->
251-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
252-
<!-- ^^^^^ variable.other.cs -->
263+
<!-- ^^^^^ variable.language.this.razor -->
253264
<!-- ^ punctuation.accessor.dot.cs -->
254265
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.cs -->
255266
<!-- ^^^^^^^^^^^^^^ variable.function.cs -->
256267
<!-- ^^^^^^^^^^^^^^^^^^^^^^^ meta.group.cs -->
257268
<!-- ^ punctuation.section.group.begin.cs -->
258-
<!-- ^^^^^ variable.other.cs -->
269+
<!-- ^^^^^ variable.language.this.razor -->
259270
<!-- ^ punctuation.accessor.dot.cs -->
260271
<!-- ^^^^^^^^^^^ variable.other.cs -->
261-
<!-- ^ keyword.operator.cs -->
272+
<!-- ^ keyword.operator.arithmetic.cs -->
262273
<!-- ^ meta.number.integer.decimal.cs constant.numeric.value.cs -->
263274
<!-- ^ punctuation.section.group.end.cs -->
264275
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.end.html -->
265276
<!-- ^ punctuation.definition.tag.end.html -->
277+
<!-- ^^^^ meta.tag.inline.any.html -->
266278
<!-- ^^ punctuation.definition.tag.begin.html -->
267279
<!-- ^ entity.name.tag.inline.any.html -->
268280
<!-- ^ punctuation.definition.tag.end.html -->
281+
269282
</li>
270283
<li>
271284
<a href="@Model.FunctionCall("embedded string")">"quotes" everywhere</a>
@@ -278,8 +291,7 @@ else
278291
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.begin.html -->
279292
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.url.html meta.string.html string.quoted.double.html -->
280293
<!-- ^ punctuation.section.interpolation.begin.razor -->
281-
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
282-
<!-- ^^^^^ variable.other.cs -->
294+
<!-- ^^^^^ variable.language.this.razor -->
283295
<!-- ^ punctuation.accessor.dot.cs -->
284296
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.cs -->
285297
<!-- ^^^^^^^^^^^^ variable.function.cs -->
@@ -291,6 +303,7 @@ else
291303
<!-- ^ punctuation.section.group.end.cs -->
292304
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.end.html -->
293305
<!-- ^ punctuation.definition.tag.end.html -->
306+
<!-- ^^^^ meta.tag.inline.any.html -->
294307
<!-- ^^ punctuation.definition.tag.begin.html -->
295308
<!-- ^ entity.name.tag.inline.any.html -->
296309
<!-- ^ punctuation.definition.tag.end.html -->

0 commit comments

Comments
 (0)