Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/syntax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- build: 4201
packages: binary
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: SublimeText/syntax-test-action@v2
with:
build: ${{ matrix.build }}
Expand Down
43 changes: 24 additions & 19 deletions Razor/C# (Razor).sublime-syntax
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.2
---
scope: source.cs.embedded.html
scope: source.cs.embedded.html.cs.razor
hidden: true
# version: 2

Expand All @@ -9,27 +9,32 @@ extends: Packages/C#/C#.sublime-syntax
##############################################################################

contexts:
# code_block_in:
# - meta_prepend: true
# - match: (%>)(\s*\n)?
# scope: meta.embedded.cs
# captures:
# 1: punctuation.section.embedded.end.cs-razor
# 2: meta.html-newline-after-csharp.cs-razor # used by indentation rules
# push: embedding-syntax

embedding-syntax:
- clear_scopes: true
- meta_scope: embedding.cs text.html.cs.razor
- meta_include_prototype: false
- match: <%(?![=#:$@-])
scope: meta.embedded.cs punctuation.section.embedded.begin.cs-razor
pop: 1
- include: Packages/HTML (C#)/Razor/Razor.sublime-syntax#comments
- include: Packages/HTML (C#)/Razor/Razor.sublime-syntax#html

stray_close_bracket:
- match: \]|\)
scope: invalid.illegal.stray.cs
- match: (?=})
pop: 1

keywords:
- meta_prepend: true
- match: \bModel\b
scope: variable.language.this.razor
- match: \bHtml\b
scope: variable.language.this.razor

inside_triple_quoted_raw_string_syntax:
- meta_include_prototype: false
- include: immediately_pop

inside_verbatim_string_syntax:
- meta_include_prototype: false
- include: immediately_pop

inside_verbatim_format_string_syntax:
- meta_include_prototype: false
- include: immediately_pop

immediately_pop:
- match: ''
pop: 1
10 changes: 0 additions & 10 deletions Razor/JavaScript (Razor).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ contexts:
prototype:
- meta_prepend: true
- include: Razor.sublime-syntax#comments
# - include: csharp-embedded

string-content:
- meta_prepend: true
Expand All @@ -32,12 +31,3 @@ contexts:
csharp-embedded:
- meta_include_prototype: false
- include: Razor.sublime-syntax#razor-constructs
# - match: <%[=#:$]
# scope: meta.embedded.cs punctuation.section.embedded.begin.cs-webforms
# embed: Packages/C#/C#.sublime-syntax
# embed_scope: meta.embedded.cs source.cs.embedded.css
# escape: (%>)(\s*\n)?
# escape_captures:
# 0: meta.embedded.cs
# 1: punctuation.section.embedded.end.cs-webforms
# 2: meta.html-newline-after-csharp.cs-webforms
10 changes: 5 additions & 5 deletions Razor/Razor.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ contexts:
- match: \}
scope: punctuation.section.block.end.cs-razor
pop: true
- include: scope:source.cs#code_block_in
- include: Packages/HTML (C#)/Razor/C# (Razor).sublime-syntax#code_block_in
- match: \s*(?!\{)(?=\S)
scope: invalid.illegal.expected-block.cs-razor
pop: true
Expand All @@ -111,15 +111,15 @@ contexts:
push:
- clear_scopes: 1
- meta_content_scope: source.cs.embedded.html
- include: scope:source.cs#line_of_code
- include: Packages/HTML (C#)/Razor/C# (Razor).sublime-syntax#line_of_code
- match: ''
pop: true
with_prototype:
- include: razor-block-prototype
- match: '[\w-+]+@\w+' # ignore email addresses
- match: '@(?=(?:\w+\.)*\w+(?:[<\s]|$))'
scope: punctuation.section.embedded.line.cs-razor
embed: scope:source.cs#line_of_code_in
embed: Packages/HTML (C#)/Razor/C# (Razor).sublime-syntax#line_of_code_in
embed_scope: source.cs.embedded.html
escape: $|(?=[<\s])
- match: '@(?=(?:\w+\.)*\w+\()'
Expand All @@ -128,7 +128,7 @@ contexts:
- meta_content_scope: source.cs.embedded.html
- match: (?=[<\s])
pop: true
- include: scope:source.cs#line_of_code_in
- include: Packages/HTML (C#)/Razor/C# (Razor).sublime-syntax#line_of_code_in
- match: '@\('
scope: punctuation.section.embedded.begin.cs-razor
push:
Expand All @@ -137,7 +137,7 @@ contexts:
- match: \)
scope: punctuation.section.embedded.end.cs-razor
pop: true
- include: scope:source.cs#line_of_code_in
- include: Packages/HTML (C#)/Razor/C# (Razor).sublime-syntax#line_of_code_in
#- match: '@(?=\w+(?:\.\w+)*)(?!\s*[+=|(])' # TODO: support a.b[2] etc.
# comment: property/variable access
# scope: punctuation.section.embedded.line.cs-razor
Expand Down
14 changes: 1 addition & 13 deletions Razor/embeddings/C# (for C# Razor HTML attribute).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,11 @@ scope: source.cs.embedded.html-attribute-string.razor
version: 1
hidden: true

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

contexts:

line_of_code_in:
- meta_prepend: true
- match: (?=")
pop: 1

inside_triple_quoted_raw_string_syntax:
- meta_include_prototype: false
- include: immediately_pop

inside_verbatim_string_syntax:
- meta_include_prototype: false
- include: immediately_pop

inside_verbatim_format_string_syntax:
- meta_include_prototype: false
- include: immediately_pop
26 changes: 13 additions & 13 deletions Razor/tests/syntax_test_cshtml.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -165,35 +165,35 @@ else
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.begin.html -->
<!-- ^^^^^^^^ meta.class-name.html meta.string.html string.quoted.double.html -->
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.end.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
<!-- ^^^^^^^^^ entity.other.attribute-name.html -->
<!-- ^ punctuation.separator.key-value.html -->
<!-- ^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
<!-- ^ punctuation.definition.string.begin.html -->
<!-- ^ punctuation.section.interpolation.begin.razor -->
<!-- ^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
<!-- ^^^^^ variable.other.cs -->
<!-- ^^^^^ variable.language.this.razor -->
<!-- ^ punctuation.accessor.dot.cs -->
<!-- ^^^^^^^^ variable.other.cs -->
<!-- ^ punctuation.definition.string.end.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
<!-- ^^^^^^^^^^^^^ entity.other.attribute-name.html -->
<!-- ^ punctuation.separator.key-value.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
<!-- ^ punctuation.definition.string.begin.html -->
<!-- ^ punctuation.section.interpolation.begin.razor -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
<!-- ^^^^^ variable.other.cs -->
<!-- ^^^^^ variable.language.this.razor -->
<!-- ^ punctuation.accessor.dot.cs -->
<!-- ^^^^^^^^^^^^^ variable.other.cs -->
<!-- ^ punctuation.accessor.dot.cs -->
<!-- ^^^^^^^^ variable.other.cs -->
<!-- ^ punctuation.definition.string.end.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
<!-- ^^^^^^^^^^^^^^^ entity.other.attribute-name.html -->
<!-- ^ punctuation.separator.key-value.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
<!-- ^ punctuation.definition.string.begin.html -->
<!-- ^ punctuation.section.interpolation.begin.razor -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
<!-- ^^^^^ variable.other.cs -->
<!-- ^^^^^ variable.language.this.razor -->
<!-- ^ punctuation.accessor.dot.cs -->
<!-- ^^^^^^^^^^^^^ variable.other.cs -->
<!-- ^ punctuation.accessor.dot.cs -->
Expand All @@ -211,13 +211,13 @@ else
<!-- ^ punctuation.section.group.begin.cs -->
<!-- ^ punctuation.section.group.end.cs -->
<!-- ^ punctuation.definition.string.end.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^ entity.other.attribute-name.html -->
<!-- ^ punctuation.separator.key-value.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.html string.quoted.double.html -->
<!-- ^ punctuation.definition.string.begin.html -->
<!-- ^ punctuation.section.interpolation.begin.razor -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
<!-- ^^^^^ variable.other.cs -->
<!-- ^^^^^ variable.language.this.razor -->
<!-- ^ punctuation.accessor.dot.cs -->
<!-- ^^^^^^^^^^^^^ variable.other.cs -->
<!-- ^ punctuation.accessor.dot.cs -->
Expand Down Expand Up @@ -248,21 +248,21 @@ else
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.begin.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.url.html meta.string.html string.quoted.double.html -->
<!-- ^ punctuation.section.interpolation.begin.razor -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
<!-- ^^^^^ variable.other.cs -->
<!-- ^^^^^ variable.language.this.razor -->
<!-- ^ punctuation.accessor.dot.cs -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.cs -->
<!-- ^^^^^^^^^^^^^^ variable.function.cs -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^ meta.group.cs -->
<!-- ^ punctuation.section.group.begin.cs -->
<!-- ^^^^^ variable.other.cs -->
<!-- ^^^^^ variable.language.this.razor -->
<!-- ^ punctuation.accessor.dot.cs -->
<!-- ^^^^^^^^^^^ variable.other.cs -->
<!-- ^ keyword.operator.cs -->
<!-- ^ meta.number.integer.decimal.cs constant.numeric.value.cs -->
<!-- ^ punctuation.section.group.end.cs -->
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.end.html -->
<!-- ^ punctuation.definition.tag.end.html -->
<!-- ^^^^ meta.tag.inline.any.html -->
<!-- ^^ punctuation.definition.tag.begin.html -->
<!-- ^ entity.name.tag.inline.any.html -->
<!-- ^ punctuation.definition.tag.end.html -->
Expand All @@ -278,8 +278,7 @@ else
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.begin.html -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.url.html meta.string.html string.quoted.double.html -->
<!-- ^ punctuation.section.interpolation.begin.razor -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.cs.embedded.html-attribute-string.razor -->
<!-- ^^^^^ variable.other.cs -->
<!-- ^^^^^ variable.language.this.razor -->
<!-- ^ punctuation.accessor.dot.cs -->
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.cs -->
<!-- ^^^^^^^^^^^^ variable.function.cs -->
Expand All @@ -291,6 +290,7 @@ else
<!-- ^ punctuation.section.group.end.cs -->
<!-- ^ meta.string.html string.quoted.double.html punctuation.definition.string.end.html -->
<!-- ^ punctuation.definition.tag.end.html -->
<!-- ^^^^ meta.tag.inline.any.html -->
<!-- ^^ punctuation.definition.tag.begin.html -->
<!-- ^ entity.name.tag.inline.any.html -->
<!-- ^ punctuation.definition.tag.end.html -->
Expand Down
2 changes: 1 addition & 1 deletion WebForms/C# (WebForms).sublime-syntax
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.2
---
scope: source.cs.embedded.html
scope: source.cs.embedded.html.cs.webforms
hidden: true
# version: 2

Expand Down
Loading