diff --git a/.github/workflows/syntax.yml b/.github/workflows/syntax.yml index 95003c5..adc2738 100644 --- a/.github/workflows/syntax.yml +++ b/.github/workflows/syntax.yml @@ -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 }} diff --git a/Razor/C# (Razor).sublime-syntax b/Razor/C# (Razor).sublime-syntax index 4f855d8..91d2189 100644 --- a/Razor/C# (Razor).sublime-syntax +++ b/Razor/C# (Razor).sublime-syntax @@ -1,6 +1,6 @@ %YAML 1.2 --- -scope: source.cs.embedded.html +scope: source.cs.embedded.html.cs.razor hidden: true # version: 2 @@ -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 diff --git a/Razor/JavaScript (Razor).sublime-syntax b/Razor/JavaScript (Razor).sublime-syntax index 1481341..5646e8a 100644 --- a/Razor/JavaScript (Razor).sublime-syntax +++ b/Razor/JavaScript (Razor).sublime-syntax @@ -12,7 +12,6 @@ contexts: prototype: - meta_prepend: true - include: Razor.sublime-syntax#comments - # - include: csharp-embedded string-content: - meta_prepend: true @@ -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 diff --git a/Razor/Razor.sublime-syntax b/Razor/Razor.sublime-syntax index cafbf19..5129b1e 100644 --- a/Razor/Razor.sublime-syntax +++ b/Razor/Razor.sublime-syntax @@ -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 @@ -111,7 +111,7 @@ 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: @@ -119,7 +119,7 @@ contexts: - 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+\()' @@ -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: @@ -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 diff --git a/Razor/embeddings/C# (for C# Razor HTML attribute).sublime-syntax b/Razor/embeddings/C# (for C# Razor HTML attribute).sublime-syntax index d158b77..c7a98ad 100644 --- a/Razor/embeddings/C# (for C# Razor HTML attribute).sublime-syntax +++ b/Razor/embeddings/C# (for C# Razor HTML attribute).sublime-syntax @@ -4,7 +4,7 @@ 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: @@ -12,15 +12,3 @@ contexts: - 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 diff --git a/Razor/tests/syntax_test_cshtml.cshtml b/Razor/tests/syntax_test_cshtml.cshtml index 47654d4..ec1f5a6 100644 --- a/Razor/tests/syntax_test_cshtml.cshtml +++ b/Razor/tests/syntax_test_cshtml.cshtml @@ -165,35 +165,35 @@ else + - - + + - - + + - - + @@ -211,13 +211,13 @@ else + - - + @@ -248,14 +248,13 @@ else - - + - + @@ -263,6 +262,7 @@ else + @@ -278,8 +278,7 @@ else - - + @@ -291,6 +290,7 @@ else + diff --git a/WebForms/C# (WebForms).sublime-syntax b/WebForms/C# (WebForms).sublime-syntax index fba86c0..5abdbb8 100644 --- a/WebForms/C# (WebForms).sublime-syntax +++ b/WebForms/C# (WebForms).sublime-syntax @@ -1,6 +1,6 @@ %YAML 1.2 --- -scope: source.cs.embedded.html +scope: source.cs.embedded.html.cs.webforms hidden: true # version: 2