Skip to content

Commit a4931cb

Browse files
committed
Merge branch 'master' into razor_inside_html_attribute
2 parents 6f1910e + 74548ff commit a4931cb

File tree

5 files changed

+75
-38
lines changed

5 files changed

+75
-38
lines changed

.github/workflows/syntax.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ jobs:
2121
runs-on: ubuntu-latest
2222
timeout-minutes: 15
2323
strategy:
24+
fail-fast: false
2425
matrix:
2526
include:
2627
- build: latest
2728
packages: master
2829
- build: stable
2930
packages: master
30-
- build: 4134 # Need HTML with `html` context for inclusion
31+
- build: 4149
3132
packages: binary
3233
steps:
3334
- uses: actions/checkout@v4

Razor/C# (Razor).sublime-syntax

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,8 @@ contexts:
2828
- include: Packages/HTML (C#)/Razor/Razor.sublime-syntax#comments
2929
- include: Packages/HTML (C#)/Razor/Razor.sublime-syntax#html
3030

31-
stray-braces:
32-
- match: (\})(\s*\n)?
33-
scope: meta.embedded.cs
34-
captures:
35-
1: punctuation.section.embedded.end.cs-razor
36-
2: meta.html-newline-after-csharp.cs-razor # used by indentation rules
37-
# - match: \}
38-
# scope: invalid.illegal.stray.cs
39-
40-
stray-brackets:
41-
- match: \]
42-
scope: invalid.illegal.stray.cs
43-
44-
stray-parens:
45-
- match: \)
31+
stray_close_bracket:
32+
- match: \]|\)
4633
scope: invalid.illegal.stray.cs
34+
- match: (?=})
35+
pop: 1

Razor/tests/syntax_test_cshtml.cshtml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,36 @@ else
120120
} *@
121121
<!-- ^^ comment.block punctuation.definition.comment -->
122122

123+
@{ }
124+
<!--^^^^^^ meta.embedded.cs -->
125+
<!--^^ punctuation.section.embedded.begin.cs-razor - source -->
126+
<!-- ^ source.cs.embedded.html -->
127+
<!-- ^ punctuation.section.embedded.end.cs-razor - source -->
128+
<!-- ^^ meta.html-newline-after-csharp.cs-razor - source -->
129+
123130
@{
124131
var quote = "The future depends on what you do today. - Mahatma Gandhi";
125-
<!-- ^^ source.cs.embedded -->
132+
<!--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.cs source.cs.embedded.html -->
133+
<!-- ^^^^^ variable.other.cs -->
134+
<!-- ^ keyword.operator.assignment.variable.cs -->
135+
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.cs string.quoted.double.cs -->
136+
<!-- ^ punctuation.definition.string.begin.cs -->
137+
<!-- ^ punctuation.definition.string.end.cs -->
138+
<!-- ^ punctuation.terminator.statement.cs -->
126139
}
127140
<!-- ^ text.html - source -->
128141

129-
<p>@quote</p>
142+
<p>@quote</p>
143+
<!--^^^ meta.tag.block.any.html -->
144+
<!--^ punctuation.definition.tag.begin.html -->
145+
<!-- ^ entity.name.tag.block.any.html -->
146+
<!-- ^ punctuation.definition.tag.end.html -->
147+
<!-- ^ punctuation.section.embedded.line.cs-razor -->
148+
<!-- ^^^^^ source.cs.embedded.html variable.other.cs -->
149+
<!-- ^^^^ meta.tag.block.any.html -->
150+
<!-- ^^ punctuation.definition.tag.begin.html -->
151+
<!-- ^ entity.name.tag.block.any.html -->
152+
<!-- ^ punctuation.definition.tag.end.html -->
130153

131154
@{
132155
quote = "Hate cannot drive out hate, only love can do that. - Martin Luther King, Jr.";
@@ -304,9 +327,17 @@ finally
304327

305328
@{
306329
/* C# comment */
330+
<!--^^^^^^^^^^^^^^^^ meta.embedded.cs source.cs.embedded.html -->
331+
<!--^^^^^^^^^^^^^^^^ comment.block.cs -->
332+
<!--^^ punctuation.definition.comment.begin.cs -->
333+
<!-- ^^ punctuation.definition.comment.end.cs -->
307334
// Another C# comment
335+
<!--^^^^^^^^^^^^^^^^^^^^^ meta.embedded.cs source.cs.embedded.html -->
336+
<!--^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.cs -->
337+
<!--^^ punctuation.definition.comment.cs -->
308338
}
309339
<!-- HTML comment -->
340+
<!-- ^^^^^^^^^^^^^^^^ comment.block.html -->
310341

311342

312343
@functions {

WebForms/C# (WebForms).sublime-syntax

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ extends: Packages/C#/C#.sublime-syntax
99
##############################################################################
1010

1111
contexts:
12+
statements:
13+
- meta_prepend: true
14+
- match: (?=%>)
15+
pop: 1
16+
1217
code_block_in:
1318
- meta_prepend: true
1419
- match: (%>)(\s*\n)?
@@ -27,15 +32,3 @@ contexts:
2732
pop: 1
2833
- include: Packages/HTML (C#)/WebForms/WebForms.sublime-syntax#comments
2934
- include: Packages/HTML (C#)/WebForms/WebForms.sublime-syntax#html
30-
31-
stray-braces:
32-
- match: \}
33-
scope: invalid.illegal.stray.cs
34-
35-
stray-brackets:
36-
- match: \]
37-
scope: invalid.illegal.stray.cs
38-
39-
stray-parens:
40-
- match: \)
41-
scope: invalid.illegal.stray.cs

WebForms/tests/syntax_test_aspx.aspx

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,45 @@
102102
<body>
103103
<my:Bar runat="server" />
104104

105+
<% %>
106+
<%--^^^^^ meta.embedded.cs --%>
107+
<%--^^ punctuation.section.embedded.begin.cs-webforms --%>
108+
<%-- ^ source.cs.embedded.html --%>
109+
<%-- ^^ punctuation.section.embedded.end.cs-webforms - source --%>
110+
111+
<% } %>
112+
<%--^^^^^^^ meta.embedded.cs --%>
113+
<%--^^ punctuation.section.embedded.begin.cs-webforms --%>
114+
<%-- ^^^ source.cs.embedded.html --%>
115+
<%-- ^ invalid.illegal.stray.brace.cs --%>
116+
<%-- ^^ punctuation.section.embedded.end.cs-webforms - source --%>
117+
105118
<% if(3 > 10)
106119
<%--^^ punctuation.section.embedded.begin - source.cs --%>
107120
<%-- ^^^^^^^^^^ source.cs.embedded.html --%>
108121
{ %>
109-
<%-- ^ punctuation.section.block.begin --%>
110-
<%-- ^^ punctuation.section.embedded.end --%>
111-
<%-- ^^^^^ - source.cs.embedded.html --%>
122+
<%--^^^^^^ meta.embedded.cs source.cs.embedded.html --%>
123+
<%-- ^ punctuation.section.block.begin.cs --%>
124+
<%-- ^^ text.html.cs.webforms meta.embedded.cs punctuation.section.embedded.end.cs-webforms - source --%>
112125
<p>Baz</p>
113126
<% } else { %>
114-
<%-- ^^^^^^^^^^ source.cs.embedded.html --%>
115-
<%-- ^ punctuation.section.block.end --%>
116-
<%-- ^^^^ keyword.control.conditional.else --%>
117-
<%-- ^ punctuation.section.block.begin --%>
118-
<%-- ^^^ - source.cs.embedded.html --%>
127+
<%--^^ text.html.cs.webforms --%>
128+
<%--^^ meta.embedded.cs punctuation.section.embedded.begin.cs-webforms --%>
129+
<%-- ^^^^^^^^^^ meta.embedded.cs source.cs.embedded.html --%>
130+
<%-- ^ punctuation.section.block.end.cs --%>
131+
<%-- ^^^^^ keyword.control.conditional.else.cs --%>
132+
<%-- ^^ meta.block.cs --%>
133+
<%-- ^ punctuation.section.block.begin.cs --%>
134+
<%-- ^^ text.html.cs.webforms meta.embedded.cs punctuation.section.embedded.end.cs-webforms - source --%>
119135
<p>Biff</p>
120136
<% } %>
137+
<%--^^ text.html.cs.webforms --%>
138+
<%--^^ meta.embedded.cs punctuation.section.embedded.begin.cs-webforms --%>
139+
<%-- ^^^^^ meta.embedded.cs --%>
140+
<%-- ^^^ source.cs.embedded.html --%>
141+
<%-- ^^ meta.block.cs --%>
142+
<%-- ^ punctuation.section.block.end.cs --%>
143+
<%-- ^^ punctuation.section.embedded.end.cs-webforms - source --%>
121144

122145
<p><%: variable %></p>
123146
<%-- ^^^ punctuation.section.embedded.begin --%>

0 commit comments

Comments
 (0)