diff --git a/.gitignore b/.gitignore index 8b11216..3ba2591 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ client/src/syntaxes/dev* .antlr node_modules client/server +template* .vscode-test sample*/** *.vsix diff --git a/.vscodeignore b/.vscodeignore index 5af0b1c..cc5ad81 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -9,6 +9,7 @@ scripts/** **/tsconfig.json **/tsconfig.base.json contributing.md +template* # Development **/src @@ -24,6 +25,7 @@ contributing.md *.tokens *.vsix *.tsbuildinfo +*.log # Samples and testing sample*/** diff --git a/README.md b/README.md index 1e1c1ee..4d13f35 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,66 @@ -# VBA Extension for VScode +

+ drawing +

-Adds VBA language support to VSCode via LSP compliant Language Server. +# VBA Pro Extension for VScode + +Provides Visual Basic for Applications (VBA) language support in Visual Studio Code using a Language Server Protocol (LSP) compliant backend. We all know that VBA is a dinosaur from the '90s, but it doesn't have to feel like one. ![VBA LSP](images/vba-lsp.png) ## Features -* Syntax highlighting (resolved on client) +* Syntax highlighting * Semantic highlighting * Folding ranges +* Code Snippets * Document symbols -* Document formatting\* +* Document diagnostics +* Document formatting1 + +1Currently full document `Shift+Alt+F` formatting only. + +### Syntax Highlighting + +The most complete and bug-free TextMate grammar for VBA out there. + +### Semantic Highlighting + +TextMate does a great job with syntax highlighting but there are some things it can't know. Semantic highlighting is resolved by the language server and helps support where context is required. + +### Folding Ranges + +Folding ranges help organise code, collapsing things out of the way when you don't need to be looking at them. + +### Code Snippets + +A small but growing collection of highly useful code snippets. The idea is to keep these to a "rememberable" level, but if there's something you use all the time and you think it's missing, I'd love to hear from you. + +### Document Symbols + +Document Symbols allow you to view a structured outline of your code in the VSCode Outline view and breadcrumbs. These make it easy to understand and navigate files. + +### Document Diagnostics + +Displays warnings and errors in the Problems panel, as well as underlining the relevant sections in your code. Only a few diagnostics have been implemented to date, however these will be fleshed out over time. + +## Document Formatting + +Whole of document formatting is supported with `Shift+Alt+F`. Keeps your code properly indented and easy to read. Also supports half indentation for conditional compilation logic and the complexities that come with it. -\*Currently full document `Shift+Alt+F` formatting only. +```vba +#If VBA7 then + Public Property Get Foo() As LongPtr +#Else + Public Property Get Foo() As Long +#End If + Foo = 0 +End Property +``` ## Coming Soon * Hovers -* Diagnostics (info, warnings, and errors) ## Installation diff --git a/client/src/extension.ts b/client/src/extension.ts index 9e8106f..34a23ef 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -39,7 +39,11 @@ export function activate(context: ExtensionContext) { // Options to control the language client const clientOptions: LanguageClientOptions = { // Register the server for plain text documents - documentSelector: [{ scheme: 'file', language: 'vba' }], + documentSelector: [ + { scheme: 'file', language: 'vba-class' }, + { scheme: 'file', language: 'vba-module' }, + { scheme: 'file', language: 'vba-form' } + ], synchronize: { // Notify the server about file changes to '.clientrc files contained in the workspace fileEvents: workspace.createFileSystemWatcher('**/.clientrc') diff --git a/icons/vba_90sGreen_dark.svg b/icons/vba_90sGreen_dark.svg new file mode 100644 index 0000000..d57bd90 --- /dev/null +++ b/icons/vba_90sGreen_dark.svg @@ -0,0 +1,15 @@ + + + + + + + VBA + \ No newline at end of file diff --git a/icons/vba_90sGreen_light.svg b/icons/vba_90sGreen_light.svg new file mode 100644 index 0000000..623f581 --- /dev/null +++ b/icons/vba_90sGreen_light.svg @@ -0,0 +1,15 @@ + + + + + + + VBA + diff --git a/icons/vba_90sPurple_dark.svg b/icons/vba_90sPurple_dark.svg new file mode 100644 index 0000000..1f9c7c9 --- /dev/null +++ b/icons/vba_90sPurple_dark.svg @@ -0,0 +1,14 @@ + + + + + + VBA + \ No newline at end of file diff --git a/icons/vba_90sPurple_light.svg b/icons/vba_90sPurple_light.svg new file mode 100644 index 0000000..622264f --- /dev/null +++ b/icons/vba_90sPurple_light.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + VBA + diff --git a/icons/vba_90sYellow_dark.svg b/icons/vba_90sYellow_dark.svg new file mode 100644 index 0000000..58a3e9a --- /dev/null +++ b/icons/vba_90sYellow_dark.svg @@ -0,0 +1,14 @@ + + + + + + VBA + \ No newline at end of file diff --git a/icons/vba_90sYellow_light.svg b/icons/vba_90sYellow_light.svg new file mode 100644 index 0000000..609c4c1 --- /dev/null +++ b/icons/vba_90sYellow_light.svg @@ -0,0 +1,15 @@ + + + + + + + VBA + diff --git a/icons/vba_blue.svg b/icons/vba_blue.svg deleted file mode 100644 index fda5e28..0000000 --- a/icons/vba_blue.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - VBA - \ No newline at end of file diff --git a/icons/vba_green.svg b/icons/vba_green.svg deleted file mode 100644 index bdf0d22..0000000 --- a/icons/vba_green.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - VBA - \ No newline at end of file diff --git a/icons/vba_orange.svg b/icons/vba_orange.svg deleted file mode 100644 index d82777c..0000000 --- a/icons/vba_orange.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - VBA - \ No newline at end of file diff --git a/images/vba-lsp-icon.png b/images/vba-lsp-icon.png index e9ddeda..067f49d 100644 Binary files a/images/vba-lsp-icon.png and b/images/vba-lsp-icon.png differ diff --git a/images/vba-lsp.png b/images/vba-lsp.png index 37f2d9a..de7cb04 100644 Binary files a/images/vba-lsp.png and b/images/vba-lsp.png differ diff --git a/package-lock.json b/package-lock.json index b1c3164..afb2bf4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vba-lsp", - "version": "1.5.4", + "version": "1.5.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vba-lsp", - "version": "1.5.4", + "version": "1.5.5", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 28d1e10..27c6e3f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "icon": "images/vba-lsp-icon.png", "author": "SSlinky", "license": "MIT", - "version": "1.5.4", + "version": "1.5.5", "repository": { "type": "git", "url": "https://github.com/SSlinky/VBA-LanguageServer" @@ -16,8 +16,7 @@ "Programming Languages", "Snippets", "Linters", - "Formatters", - "Themes" + "Formatters" ], "keywords": [ "multi-root ready" @@ -30,23 +29,34 @@ "contributes": { "languages": [ { - "id": "vba", - "aliases": [ - "VBA" - ], - "extensions": [ - ".bas", - ".cls", - ".frm" - ], - "configuration": "./vba.language-configuration.json" - } - ], - "iconThemes": [ + "id": "vba-class", + "aliases": ["VBA Class"], + "extensions": [".cls"], + "configuration": "./vba.language-configuration.json", + "icon": { + "dark": "icons/vba_90sGreen_dark.svg", + "light": "icons/vba_90sGreen_light.svg" + } + }, + { + "id": "vba-module", + "aliases": ["VBA Module"], + "extensions": [".bas"], + "configuration": "./vba.language-configuration.json", + "icon": { + "dark": "icons/vba_90sPurple_dark.svg", + "light": "icons/vba_90sPurple_light.svg" + } + }, { - "id": "vba-lsp", - "label": "VBA Icons", - "path": "icon-theme.json" + "id": "vba-form", + "aliases": ["VBA Form"], + "extensions": [".frm"], + "configuration": "./vba.language-configuration.json", + "icon": { + "dark": "icons/vba_90sYellow_dark.svg", + "light": "icons/vba_90sYellow_light.svg" + } } ], "configurationDefaults": { @@ -125,14 +135,32 @@ }, "grammars": [ { - "language": "vba", + "language": "vba-class", + "scopeName": "source.vba", + "path": "./client/out/vba.tmLanguage.json" + }, + { + "language": "vba-module", + "scopeName": "source.vba", + "path": "./client/out/vba.tmLanguage.json" + }, + { + "language": "vba-form", "scopeName": "source.vba", "path": "./client/out/vba.tmLanguage.json" } ], "snippets": [ { - "language": "vba", + "language": "vba-class", + "path": "./snippets/vba.json" + }, + { + "language": "vba-module", + "path": "./snippets/vba.json" + }, + { + "language": "vba-form", "path": "./snippets/vba.json" } ]