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
1,125 changes: 628 additions & 497 deletions client/syntaxes/vba.tmLanguage.json

Large diffs are not rendered by default.

601 changes: 351 additions & 250 deletions client/syntaxes/vba.tmLanguage.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"icon": "images/vba-lsp-icon.png",
"author": "SSlinky",
"license": "MIT",
"version": "1.5.11",
"version": "1.5.12",
"repository": {
"type": "git",
"url": "https://github.com/SSlinky/VBA-LanguageServer"
Expand Down
1,937 changes: 970 additions & 967 deletions test/textmate/snapshot/Dictionary.cls.snap

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/textmate/snapshot/DictionaryTests.bas
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Public Type MyFooType 'Comment
'Comment
Length As Long 'Comment
'Comment

Length As Long 'Comment
'Comment
End Type 'Comment
Expand Down Expand Up @@ -679,7 +679,7 @@ Attribute TestDictionary_RemoveRemovesKey.VB_Description = "Test that remove rem
d.Add INPKEYB, Nothing

' Act
d.Remove(INPKEYA)
d.Remove INPKEYA

' Assert
On Error Resume Next
Expand Down
2,678 changes: 1,339 additions & 1,339 deletions test/textmate/snapshot/DictionaryTests.bas.snap

Large diffs are not rendered by default.

28 changes: 2 additions & 26 deletions test/textmate/unit/logicFlowBlock.vba
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
' SYNTAX TEST "source.vba" "logic flow"
' SYNTAX TEST "source.vba" "logic blocks"

Attribute VB_Name = "Logic"
' Copyright 2024 Sam Vanderslink
'
' Permission is hereby granted, free of charge, to any person obtaining a copy
' of this software and associated documentation files (the "Software"), to deal
' in the Software without restriction, including without limitation the rights
' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
' copies of the Software, and to permit persons to whom the Software is
' furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in
' all copies or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
' FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
' IN THE SOFTWARE.

Option Explicit


Public Sub Foo()
Sub Foo()
' Variable positive
If condition Then
' ^^^^^^^^^^^^^^^^^ meta.block-if-else.vba
Expand Down
4 changes: 2 additions & 2 deletions test/textmate/unit/logicFlowInline.vba
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
' SYNTAX TEST "source.vba" "logic flow inline"
' SYNTAX TEST "source.vba" "logic inline"

Attribute VB_Name = "Logic inline"

Public Sub Foo()
Sub Foo()

''''''''''''''''''''''''''''''''
' 1. Inline Ifs (without nesting)
Expand Down
130 changes: 130 additions & 0 deletions test/textmate/unit/logicFlowLoop.vba
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
' SYNTAX TEST "source.vba" "loop for"

' Normal people for loops

Sub Foo()
' Supports omitting Step.
For i = 1 To 10
' ^^^^^^^^^^^^^^^ meta.flow.for-loop.vba
' ^^^^^^^^^^^ meta.for-iterator-loop.vba
' ^ variable.other.readwrite.vba
' ^ keyword.operator.assignment.vba
' ^ ^^ constant.numeric.vba
' ^^ keyword.control.flow.loop.vba
Next i
' ^^^^^^ meta.flow.for-loop.vba
' ^^^^ keyword.control.flow.loop.vba

' Supports number literals.
For i = 1 To 10 Step 2
' ^^^^^^^^^^^^^^^^^^^^^^ meta.flow.for-loop.vba
' ^^^^^^^^^^^^^^^^^^ meta.for-iterator-loop.vba
' ^ variable.other.readwrite.vba
' ^ keyword.operator.assignment.vba
' ^ ^^ ^ constant.numeric.vba
' ^^ ^^^^ keyword.control.flow.loop.vba
Next i
' ^^^^^^ meta.flow.for-loop.vba
' ^^^^ keyword.control.flow.loop.vba

' Supports negative number literals.
For i = -1 To -10 Step -2
' ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.flow.for-loop.vba
' ^^^^^^^^^^^^^^^^^^^^^ meta.for-iterator-loop.vba
' ^ variable.other.readwrite.vba
' ^ keyword.operator.assignment.vba
' ^^ ^^^ ^^ constant.numeric.vba
' ^^ ^^^^ keyword.control.flow.loop.vba
Next i
' ^^^^^^ meta.flow.for-loop.vba
' ^^^^ keyword.control.flow.loop.vba

' Supports properties.
For i = .Low To .High Step .Step
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.flow.for-loop.vba
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.for-iterator-loop.vba
' ^ variable.other.readwrite.vba
' ^^^^ ^^^^^ ^^^^^ meta.variable-or-property.vba
' ^ keyword.operator.assignment.vba
' ^^ ^^^^ keyword.control.flow.loop.vba
Next i
' ^^^^^^ meta.flow.for-loop.vba
' ^^^^ keyword.control.flow.loop.vba

' Supports functions.
For i = .GetLow() To .GetHigh() Step .GetStep()
Next i
' ^^^^^^ meta.flow.for-loop.vba
' ^^^^ keyword.control.flow.loop.vba

' Simple for each.
For Each obj In collection
' ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.flow.for-loop.vba
' ^^^^^^^^^^^^^^^^^^^^^^ meta.for-each-loop.vba
' ^^^ ^^^^^^^^^^ meta.variable-or-property.vba
' ^^ keyword.control.flow.loop.vba
Next obj
' ^^^^^^^^ meta.flow.for-loop.vba
' ^^^^ keyword.control.flow.loop.vba

' Supports properties.
For Each obj In .Collection
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.flow.for-loop.vba
' ^^^^^^^^^^^^^^^^^^^^^^^ meta.for-each-loop.vba
' ^^^ ^^^^^^^^^^^ meta.variable-or-property.vba
' ^^ keyword.control.flow.loop.vba
Next obj
' ^^^^^^^^ meta.flow.for-loop.vba
' ^^^^ keyword.control.flow.loop.vba

' Supports functions.
For Each obj In .Collection()
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.flow.for-loop.vba
' ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.for-each-loop.vba
' ^^^ meta.variable-or-property.vba
' ^^ keyword.control.flow.loop.vba
' ^^^^^^^^^^^^^ meta.function.call.vba
Next obj
' ^^^^^^^^ meta.flow.for-loop.vba
' ^^^^ keyword.control.flow.loop.vba

' Supports normal block things.
For Each obj In collection
For j = 1 To 10
' ^^^^^^^^^^^^^^^ meta.flow.for-loop.vba
If condition Then DoSomething
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.flow.inline-if.vba
Next j

For Each obj In collection
' ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.flow.for-loop.vba
Next obj

If condition Then
' ^^^^^^^^^^^^^^^^^ meta.block-if-else.vba
End If
Next obj
End Sub

' Line continued tests

Sub Bar()
For _
' ^^^ keyword.control.flow.loop.vba
i _
' ^ variable.other.readwrite.vba
= _
' ^ keyword.operator.assignment.vba
-2 _
' ^^ constant.numeric.vba
To _
' ^^ keyword.control.flow.loop.vba
10 _
' ^^ constant.numeric.vba
Step _
' ^^^^ keyword.control.flow.loop.vba
20
' ^^ constant.numeric.vba
Next i
' ^^^^ keyword.control.flow.loop.vba
End Sub
109 changes: 109 additions & 0 deletions test/textmate/unit/openStatement.vba
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
' SYNTAX TEST "source.vba" "open statements"

' Normal people tests
Sub Foo()
' Mode: Input, Output, Binary, Random
Open path For Input As #1
' ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^ keyword.control.vba
' ^^^^ meta.variable-or-property.vba
' ^^^^^ storage.type.vba
' ^ support.type.primitive.vba
' ^ constant.numeric.vba
Open "xx" For Output As #f
' ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^ keyword.control.vba
' ^^^^ string.quoted.double.vba
' ^^^^^^ storage.type.vba
' ^ support.type.primitive.vba
' ^ meta.variable-or-property.vba
Open .f.o For Binary As .f
' ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^ keyword.control.vba
' ^^^^ meta.variable-or-property.vba
' ^^^^^^ storage.type.vba
' ^^ meta.variable-or-property.vba

Open xx() For Random As #1
' ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^ keyword.control.vba
' ^^^^ meta.function.call.vba
' ^^^^^^ storage.type.vba
' ^ support.type.primitive.vba
' ^ constant.numeric.vba

' Access: Read, Write
Open xx() For Input Access Read As #1
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^^^^^ keyword.control.vba
' ^^^^ meta.function.call.vba
' ^^^^^ ^^^^ storage.type.vba

Open path For Input Access Write As #1
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^^^^^ keyword.control.vba
' ^^^^ meta.variable-or-property.vba
' ^^^^^ ^^^^^ storage.type.vba


' Lock: Read, Write, Read Write
Open path For Input Lock Read As #1
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^^^ keyword.control.vba
' ^^^^ meta.variable-or-property.vba
' ^^^^^ ^^^^ storage.type.vba
Open path For Input Lock Write As #1
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^^^ keyword.control.vba
' ^^^^ meta.variable-or-property.vba
' ^^^^^ ^^^^^ storage.type.vba
Open path For Input Lock Read Write As #1
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^^^ keyword.control.vba
' ^^^^ meta.variable-or-property.vba
' ^^^^^ ^^^^ ^^^^^ storage.type.vba


' Access / Lock
Open path For Input Access Read Lock Read As #1
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^^^^^ ^^^^ keyword.control.vba
' ^^^^^ ^^^^ ^^^^ storage.type.vba


Open path For Random As #1 Len = Len(MyRecord)
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.open-statement.vba
' ^^^^ ^^^ ^^ ^^^ keyword.control.vba
' ^^^^^^ storage.type.vba
' ^ keyword.operator.assignment.vba
' ^^^^^^^^^^^^^ meta.expression.vba
End Sub

' Crazy people tests
Sub Bar()
Open _
' ^^^^ keyword.control.vba
foo _
' ^^^ meta.variable-or-property.vba
For _
' ^^^ keyword.control.vba
Binary _
' ^^^^^^ storage.type.vba
Access _
' ^^^^^^ keyword.control.vba
Read _
' ^^^^ storage.type.vba
Write _
' ^^^^^ storage.type.vba
As _
' ^^ keyword.control.vba
#1 _
' ^ support.type.primitive.vba
' ^ constant.numeric.vba
Len _
' ^^^ keyword.control.vba
= _
' ^ keyword.operator.assignment.vba
Len("abc") + 1
' ^^^^^^^^^^^^^^ meta.expression.vba
End Sub