From ef96799a6c7af2d6b3a96898d8cdaf1d7824d0b6 Mon Sep 17 00:00:00 2001 From: sslinky <39886505+SSlinky@users.noreply.github.com> Date: Sat, 12 Apr 2025 08:27:09 +0800 Subject: [PATCH 1/3] Fixes #65 --- server/src/antlr/vba.g4 | 2 +- test/fixtures/ScopeDiagnostics.bas | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/ScopeDiagnostics.bas diff --git a/server/src/antlr/vba.g4 b/server/src/antlr/vba.g4 index d015d38..f8a8f56 100644 --- a/server/src/antlr/vba.g4 +++ b/server/src/antlr/vba.g4 @@ -427,7 +427,7 @@ constantName // ; constDeclaration - : variableModifier? CONST wsc constItemList + : (variableModifier wsc)? CONST wsc constItemList ; constItemList diff --git a/test/fixtures/ScopeDiagnostics.bas b/test/fixtures/ScopeDiagnostics.bas new file mode 100644 index 0000000..dfed423 --- /dev/null +++ b/test/fixtures/ScopeDiagnostics.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "ScopeDiagnostics" + +Option Explicit + +Private Const ABC As Long = 0 + +Public Enum XfaskofeaFoo + Enum1 = 2 ^ 1 + Bar = 2 ^ 2 + Bar = 2 ^ 3 +End Enum + +Public Sub XfaskofeaFoo() +Attribute XfaskofeaFoo.VB_Description = "docstring." + +End Sub \ No newline at end of file From 702b323af1b18539bbbd11039087d46cbca04078 Mon Sep 17 00:00:00 2001 From: sslinky <39886505+SSlinky@users.noreply.github.com> Date: Sat, 12 Apr 2025 08:29:35 +0800 Subject: [PATCH 2/3] Couple of negative tests to ensure #61 doesn't break again --- test/fixtures/ScopeDiagnostics.bas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/fixtures/ScopeDiagnostics.bas b/test/fixtures/ScopeDiagnostics.bas index dfed423..e192387 100644 --- a/test/fixtures/ScopeDiagnostics.bas +++ b/test/fixtures/ScopeDiagnostics.bas @@ -10,7 +10,7 @@ Public Enum XfaskofeaFoo Bar = 2 ^ 3 End Enum -Public Sub XfaskofeaFoo() +Public Sub XfaskofeaFoo(Optional test_param As Variant = -0.1) Attribute XfaskofeaFoo.VB_Description = "docstring." - + Call SomeSub(param, -0.15) End Sub \ No newline at end of file From 5d1396a2747e35bdd6f45f094a04948c09bed0f8 Mon Sep 17 00:00:00 2001 From: sslinky <39886505+SSlinky@users.noreply.github.com> Date: Sat, 12 Apr 2025 08:32:46 +0800 Subject: [PATCH 3/3] 1.5.9 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 339ecbb..4b4bcce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vba-lsp", - "version": "1.5.8", + "version": "1.5.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vba-lsp", - "version": "1.5.8", + "version": "1.5.9", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 0a44e5b..c51b72d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "icon": "images/vba-lsp-icon.png", "author": "SSlinky", "license": "MIT", - "version": "1.5.8", + "version": "1.5.9", "repository": { "type": "git", "url": "https://github.com/SSlinky/VBA-LanguageServer"