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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Provides Visual Basic for Applications (VBA) language support in Visual Studio C
* Semantic highlighting
* Folding ranges
* Code Snippets
* Icon theme
* Document symbols
* Document diagnostics
* Document formatting<sup>1</sup>
Expand Down Expand Up @@ -41,6 +42,14 @@ Folding ranges help organise code, collapsing things out of the way when you don

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.

### Icon Theme

VS Code supports two ways of contributing icons.
* Per language identifier. Limited to one icon for all file types.
* Icon pack. Allows more flexibility, however, only one icon theme can be active at any time.

This extension provides both methods. Users with no icon pack installed can use the icon pack provided by this extension to see a visual difference between classes, modules, and forms. Users who prefer to use an alternative icon pack can fall back to the language assigned icon.

### Document Symbols

Document Symbols allow you to view a structured outline of your code in the VS Code Outline view and breadcrumbs. These make it easy to understand and navigate files.
Expand Down
6 changes: 2 additions & 4 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export function activate(context: ExtensionContext) {
const clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [
{ scheme: 'file', language: 'vba-class' },
{ scheme: 'file', language: 'vba-module' },
{ scheme: 'file', language: 'vba-form' }
{ scheme: 'file', language: 'vba' }
],
synchronize: {
// Notify the server about file changes to '.clientrc files contained in the workspace
Expand All @@ -61,7 +59,7 @@ export function activate(context: ExtensionContext) {
// Add logging support for messages received from the server.
client.onNotification("window/logMessage", (params) => {
VscodeLogger.logMessage(params);
})
});

// Start the client. This will also launch the server
client.start();
Expand Down
32 changes: 24 additions & 8 deletions icon-theme.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
{
"fileExtensions": {
"cls": "_class",
"bas": "_module",
"frm": "_userform"
},
"iconDefinitions": {
"_class": {
"iconPath": "icons/vba_blue.svg"
"iconPath": "icons/vba_90sGreen_dark.svg"
},
"_class_light": {
"iconPath": "icons/vba_90sGreen_light.svg"
},
"_module": {
"iconPath": "icons/vba_orange.svg"
"iconPath": "icons/vba_90sPurple_dark.svg"
},
"_module_light": {
"iconPath": "icons/vba_90sPurple_light.svg"
},
"_userform": {
"iconPath": "icons/vba_green.svg"
"iconPath": "icons/vba_90sYellow_dark.svg"
},
"_userform_light": {
"iconPath": "icons/vba_90sPurple_light.svg"
}
},
"fileExtensions": {
"cls": "_class",
"bas": "_module",
"frm": "_userform"
},
"light": {
"fileExtensions": {
"cls": "_class_light",
"bas": "_module_light",
"frm": "_userform_light"
}
}
}
69 changes: 17 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"Programming Languages",
"Snippets",
"Linters",
"Formatters"
"Formatters",
"Themes"
],
"keywords": [
"multi-root ready"
Expand All @@ -30,46 +31,27 @@
"contributes": {
"languages": [
{
"id": "vba-class",
"id": "vba",
"aliases": [
"VBA Class"
"VBA"
],
"extensions": [
".cls"
".cls",
".bas",
".frm"
],
"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"
}
},
}
],
"iconThemes": [
{
"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"
}
"id": "vba-lsp",
"label": "VBA Icons",
"path": "icon-theme.json"
}
],
"configurationDefaults": {
Expand Down Expand Up @@ -148,39 +130,22 @@
},
"grammars": [
{
"language": "vba-class",
"scopeName": "source.vba",
"path": "./client/syntaxes/vba.tmLanguage.json"
},
{
"language": "vba-module",
"scopeName": "source.vba",
"path": "./client/syntaxes/vba.tmLanguage.json"
},
{
"language": "vba-form",
"language": "vba",
"scopeName": "source.vba",
"path": "./client/syntaxes/vba.tmLanguage.json"
}
],
"snippets": [
{
"language": "vba-class",
"path": "./snippets/vba.json"
},
{
"language": "vba-module",
"path": "./snippets/vba.json"
},
{
"language": "vba-form",
"language": "vba",
"path": "./snippets/vba.json"
}
]
},
"scripts": {
"vscode:prepublish": "npm run package",
"build": "npm run check-types && node esbuild.js",
"fullBuild": "npm run textMate && npm run antlr",
"build-test": "node esbuild.js --test",
"check-types": "tsc --noEmit",
"watch": "npm-run-all -p watch:*",
Expand All @@ -191,7 +156,7 @@
"postinstall": "cd client && npm install && cd ../server && npm install && cd ..",
"textMate": "npx js-yaml client/syntaxes/vba.tmLanguage.yaml > client/syntaxes/vba.tmLanguage.json && npm run tmSnapTest",
"antlr": "npm run antlr4ngPre && npm run antlr4ng && npm run antlr4ngFmt && npm run build",
"antlr4ng": "antlr4ng -Dlanguage=TypeScript -visitor -Xlog ./server/src/antlr/vba.g4 -o ./server/src/antlr/out/",
"antlr4ng": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vba.g4 -o ./server/src/antlr/out/",
"antlr4ngPre": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbapre.g4 -o ./server/src/antlr/out/",
"antlr4ngFmt": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbafmt.g4 -o ./server/src/antlr/out/",
"test": "npm run tmSnapTest && npm run tmUnitTest && npm run vsctest",
Expand Down