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 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ client/src/syntaxes/dev*
.antlr
node_modules
client/server
template*
.vscode-test
sample*/**
*.vsix
Expand Down
2 changes: 2 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ scripts/**
**/tsconfig.json
**/tsconfig.base.json
contributing.md
template*

# Development
**/src
Expand All @@ -24,6 +25,7 @@ contributing.md
*.tokens
*.vsix
*.tsbuildinfo
*.log

# Samples and testing
sample*/**
Expand Down
55 changes: 49 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@
# VBA Extension for VScode
<p align="center">
<img src="images/vba-lsp-icon.png" alt="drawing" width="128"/>
</p>

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 formatting<sup>1</sup>

<sup>1</sup>Currently 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

Expand Down
6 changes: 5 additions & 1 deletion client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
15 changes: 15 additions & 0 deletions icons/vba_90sGreen_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions icons/vba_90sGreen_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions icons/vba_90sPurple_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions icons/vba_90sPurple_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions icons/vba_90sYellow_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions icons/vba_90sYellow_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions icons/vba_blue.svg

This file was deleted.

9 changes: 0 additions & 9 deletions icons/vba_green.svg

This file was deleted.

9 changes: 0 additions & 9 deletions icons/vba_orange.svg

This file was deleted.

Binary file modified images/vba-lsp-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/vba-lsp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.

70 changes: 49 additions & 21 deletions 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.4",
"version": "1.5.5",
"repository": {
"type": "git",
"url": "https://github.com/SSlinky/VBA-LanguageServer"
Expand All @@ -16,8 +16,7 @@
"Programming Languages",
"Snippets",
"Linters",
"Formatters",
"Themes"
"Formatters"
],
"keywords": [
"multi-root ready"
Expand All @@ -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": {
Expand Down Expand Up @@ -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"
}
]
Expand Down