Skip to content

Commit 080e222

Browse files
author
Lukas Neubert
committed
syntax: highlight With, For, Each, In
fix #21
1 parent adcbe7a commit 080e222

File tree

3 files changed

+39
-22
lines changed

3 files changed

+39
-22
lines changed

syntaxes/tests/other.bas

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
' SYNTAX TEST "source.vba" "main syntax test"
2+
Attribute VB_Name = "SyntaxTest"
3+
' <--------- keyword.Attribute.vba
24

3-
Attribute VB_Name = "SyntaxTest"
4-
' ^^^^^^^^^ keyword.Attribute.vba
5+
Public Const FOO As Integer = 1
6+
' <------ storage.modifier.visibility
7+
' ^^^^^ keyword.Const.vba
8+
' ^^ keyword.As.vba
59

6-
Public Const FOO As Integer = 1
7-
' ^^^^^^ storage.modifier.visibility
8-
' ^^^^^ keyword.Const.vba
9-
' ^^ keyword.As.vba
10-
11-
' some comment
12-
' ^^^^^^^^^^^^^^ comment.line.quote
13-
14-
Dim obj As Object
15-
' ^^^ keyword.Dim.vba
16-
Set obj = Nothing
17-
' ^^^ keyword.Set.vba
18-
' ^^^^^^^ keyword.Nothing.vba
10+
Dim obj As Object
11+
' <--- keyword.Dim.vba
12+
Set obj = Nothing
13+
' <--- keyword.Set.vba
14+
' ^^^^^^^ keyword.Nothing.vba
1915
Set obj = New Object
2016
' ^^^ keyword.New.vba
17+
18+
With presentation
19+
' <---- keyword.control.With.vba
20+
For Each slide In .Slides
21+
' ^^^ keyword.control.For.vba
22+
' ^^^^ keyword.control.Each.vba
23+
Next ' Some comment
24+
' ^^^^ keyword.control.Next.vba
25+
' ^^^^^^^^^^^^^^ comment.line.quote
26+
End With
27+
' <-------- keyword.control.End.vba

syntaxes/tests/procedure.bas

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
Private Sub doStuff(x As String)
44
' ^^^^^^^ storage.modifier.visibility
55
' ^^^ keyword.Sub.vba
6-
End Sub
7-
' ^^^ keyword.End.vba
8-
' ^^^ keyword.Sub.vba
6+
End Sub
7+
' <------- keyword.End.vba
98

109
Function foo() As Boolean
1110
' ^^^^^^^^ keyword.Function.vba
1211
' ^^ keyword.As.vba
1312
' ^^^^^^^ support.type.Boolean
14-
End Function
15-
' ^^^ keyword.End.vba
16-
' ^^^^^^^^ keyword.Function.vba
13+
End Function
14+
' <------------ keyword.End.vba
1715

1816
Function withParam(Optional p1 As MyType)
1917
' ^^^^^^^^ storage.modifier.visibility

syntaxes/vba.tmLanguage.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,19 @@
2424
"patterns": [
2525
{
2626
"name": "keyword.$1.vba",
27-
"match": "\\b(As|Attribute|Const|Dim|Function|New|Nothing|Set|Sub|End)\\b"
27+
"match": "\\b(As|Attribute|Const|Dim|Function|New|Nothing|Set|Sub)\\b"
28+
},
29+
{
30+
"name": "keyword.End.vba",
31+
"match": "\\bEnd (Sub|Function)\\b"
32+
},
33+
{
34+
"name": "keyword.control.$1.vba",
35+
"match": "\\b(Each|For|In|Next|With)\\b"
36+
},
37+
{
38+
"name": "keyword.control.End.vba",
39+
"match": "\\bEnd (With)\\b"
2840
}
2941
]
3042
},

0 commit comments

Comments
 (0)