Skip to content

Commit dea414b

Browse files
committed
Refactor WebHandler syntax
1 parent de71b41 commit dea414b

File tree

3 files changed

+54
-9
lines changed

3 files changed

+54
-9
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ only supports Visual Basic.
4848

4949
- Identify more attributes of directives
5050
- Snippets and/or completions for ASP.Net builtins
51-
- Refactor C# Handler syntax (*.ashx*)
5251

5352
### Known issues
5453

WebForms/ashx.sublime-syntax

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@
33
# http://www.sublimetext.com/docs/syntax.html
44
name: .Net Web Handler (ASHX)
55
scope: source.cs.webforms.ashx
6-
version: 2
76

8-
first_line_match: <%@\s*WebHandler
7+
extends: Packages/C#/C#.sublime-syntax
98

109
file_extensions:
1110
- ashx
1211

12+
first_line_match: <%@\s*WebHandler
13+
1314
contexts:
14-
main:
15-
- match: ''
16-
set: scope:source.cs
17-
with_prototype:
18-
- include: directive
15+
shebang:
16+
- include: directives
1917

2018
directive-generic-attribute:
2119
- match: '\b(\w+)\s*(=)\s*((")[^"]*("))\s*'
@@ -31,7 +29,7 @@ contexts:
3129
scope: punctuation.section.embedded.end.cshtml
3230
pop: true
3331

34-
directive:
32+
directives:
3533
# https://msdn.microsoft.com/en-us/library/xz702w3e(v=vs.100).aspx
3634
- match: '<%@'
3735
scope: punctuation.section.embedded.begin.cshtml

WebForms/tests/syntax_test_ashx.ashx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,64 @@
11
// SYNTAX TEST "Packages/HTML (C#)/WebForms/ashx.sublime-syntax"
22

33
<%@ WebHandler Language="C#" Class="Handler" %>
4+
//^^^^^^^^^^^^ meta.block.processing-directive.cshtml
5+
//^ punctuation.section.embedded.begin.cshtml
6+
// ^^^^^^^^^^ meta.block.processing-directive.contents.type.cshtml constant.language.processing-directive.type.cshtml entity.name.class.cs
7+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.processing-directive.contents.type.cshtml
8+
// ^^^^^^^^ entity.other.attribute-name.cshtml
9+
// ^ punctuation.separator.key-value.cshtml
10+
// ^^^^ string.quoted.double.cshtml
11+
// ^ punctuation.definition.string.begin.cshtml
12+
// ^ punctuation.definition.string.end.cshtml
13+
// ^^^^^ entity.other.attribute-name.cshtml
14+
// ^ punctuation.separator.key-value.cshtml
15+
// ^^^^^^^^^ string.quoted.double.cshtml
16+
// ^ punctuation.definition.string.begin.cshtml
17+
// ^ punctuation.definition.string.end.cshtml
18+
// ^^ punctuation.section.embedded.end.cshtml
419

520
using System;
621
using System.Web;
22+
//^^^ keyword.control.import.cs
23+
// ^^^^^^^^^^ meta.path.cs
24+
// ^ punctuation.separator.namespace.cs
25+
// ^ punctuation.terminator.statement.cs
726

827
public class Handler : IHttpHandler
28+
//^^^^ storage.modifier.access.cs
29+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.cs
30+
// ^^^^^ keyword.declaration.class.cs
31+
// ^^^^^^^ entity.name.class.cs
32+
// ^ punctuation.separator.type.cs
33+
// ^^^^^^^^^^^^ entity.other.inherited-class.cs
934
{
1035
public void ProcessRequest(HttpContext context)
36+
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.body.cs meta.block.cs
37+
// ^^^^^^ storage.modifier.access.cs
38+
// ^^^^ storage.type.cs
39+
// ^^^^^^^^^^^^^^ meta.method.cs entity.name.function.cs
40+
// ^^^^^^^^^^^^^^^^^^^^^ meta.method.parameters.cs
41+
// ^ punctuation.section.parameters.begin.cs
42+
// ^^^^^^^^^^^ support.type.cs
43+
// ^^^^^^^ variable.parameter.cs
44+
// ^ punctuation.section.parameters.end.cs
1145
{
1246
context.Response.ContentType = "text/plain";
1347
context.Response.Write("Hello World");
48+
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.body.cs meta.block.cs meta.method.body.cs meta.block.cs
49+
// ^^^^^^^ variable.other.cs
50+
// ^ punctuation.accessor.dot.cs
51+
// ^^^^^^^^ variable.other.cs
52+
// ^ punctuation.accessor.dot.cs
53+
// ^^^^^^^^^^^^^^^^^^^^ meta.function-call.cs
54+
// ^^^^^ variable.function.cs
55+
// ^^^^^^^^^^^^^^^ meta.group.cs
56+
// ^ punctuation.section.group.begin.cs
57+
// ^^^^^^^^^^^^^ meta.string.cs string.quoted.double.cs
58+
// ^ punctuation.definition.string.begin.cs
59+
// ^ punctuation.definition.string.end.cs
60+
// ^ punctuation.section.group.end.cs
61+
// ^ punctuation.terminator.statement.cs
1462
}
1563

1664
public bool IsReusable

0 commit comments

Comments
 (0)