Skip to content

Commit 7b02eb0

Browse files
committed
limit function name highlighting
fix #52 - known issue: highlight in `Call funName()` also removed
1 parent 27857a0 commit 7b02eb0

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

syntaxes/tests/array.bas

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
' SYNTAX TEST "source.vba" "array syntax"
2+
3+
Dim curExpense(364) As Currency
4+
' ^^^^^^^^^^ - entity.name.function.vba
5+
Dim intI As Integer
6+
For intI = 0 to 364
7+
curExpense(intI) = 20
8+
' ^^^^^^^^^^ - entity.name.function.vba
9+
Next

syntaxes/tests/procedure.bas

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ End Function
2323
' <------------ keyword.other.vba
2424

2525
Function withParam(Optional ByVal p1 As MyType, _
26-
' <---- keyword.other.vba
26+
' <-------- keyword.other.vba
2727
' ^^^^^^^^^ entity.name.function.vba
2828
' ^^^^^^^^ keyword.control.vba
2929
' ^^^^^ keyword.control.vba
@@ -36,7 +36,3 @@ Function withParam(Optional p1 As MyType)
3636
' ^^^^^^^^ keyword.control.vba
3737
End Function
3838
' <------------ keyword.other.vba
39-
40-
Call Mod.mSub()
41-
' <---- keyword.other.vba
42-
' ^^^^ entity.name.function.vba

syntaxes/tests/visibilityKeywords.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
' SYNTAX TEST "source.vba" "module level variable declaration"
1+
' SYNTAX TEST "source.vba" "module scope visibility modifiers"
22

33
Public strName As String
44
' <------ keyword.other.visibility.vba

syntaxes/vba.tmGrammar.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ patterns:
1111
- include: "#storage"
1212
- include: "#strings"
1313
- include: "#types"
14-
- name: entity.name.function.vba
15-
match: (?i:\b[a-zA-Z][a-zA-Z0-9_]*\b)(?=\(\)?)
14+
- include: "#functions"
1615
- name: constant.other.vba
1716
match: _(?=\s*\n)
1817

@@ -39,6 +38,10 @@ repository:
3938
- name: constant.language.vba
4039
match: (?i)\b(Empty|False|Nothing|Null|True)\b
4140

41+
functions:
42+
name: entity.name.function.vba
43+
match: (?i:\b(?<=(Function|Sub)\s)[a-zA-Z][a-zA-Z0-9_]*\b)(?=\(\)?)
44+
4245
numbers:
4346
patterns:
4447
- name: constant.numeric.date

0 commit comments

Comments
 (0)