Skip to content

Commit 308a171

Browse files
authored
Merge pull request #69 from SSlinky/dev
Restore Icon Theme
2 parents 6222c40 + 61d9103 commit 308a171

File tree

4 files changed

+52
-64
lines changed

4 files changed

+52
-64
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Provides Visual Basic for Applications (VBA) language support in Visual Studio C
1414
* Semantic highlighting
1515
* Folding ranges
1616
* Code Snippets
17+
* Icon theme
1718
* Document symbols
1819
* Document diagnostics
1920
* Document formatting<sup>1</sup>
@@ -41,6 +42,14 @@ Folding ranges help organise code, collapsing things out of the way when you don
4142

4243
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.
4344

45+
### Icon Theme
46+
47+
VS Code supports two ways of contributing icons.
48+
* Per language identifier. Limited to one icon for all file types.
49+
* Icon pack. Allows more flexibility, however, only one icon theme can be active at any time.
50+
51+
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.
52+
4453
### Document Symbols
4554

4655
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.

client/src/extension.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ export function activate(context: ExtensionContext) {
4040
const clientOptions: LanguageClientOptions = {
4141
// Register the server for plain text documents
4242
documentSelector: [
43-
{ scheme: 'file', language: 'vba-class' },
44-
{ scheme: 'file', language: 'vba-module' },
45-
{ scheme: 'file', language: 'vba-form' }
43+
{ scheme: 'file', language: 'vba' }
4644
],
4745
synchronize: {
4846
// Notify the server about file changes to '.clientrc files contained in the workspace
@@ -61,7 +59,7 @@ export function activate(context: ExtensionContext) {
6159
// Add logging support for messages received from the server.
6260
client.onNotification("window/logMessage", (params) => {
6361
VscodeLogger.logMessage(params);
64-
})
62+
});
6563

6664
// Start the client. This will also launch the server
6765
client.start();

icon-theme.json

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
{
2-
"fileExtensions": {
3-
"cls": "_class",
4-
"bas": "_module",
5-
"frm": "_userform"
6-
},
72
"iconDefinitions": {
83
"_class": {
9-
"iconPath": "icons/vba_blue.svg"
4+
"iconPath": "icons/vba_90sGreen_dark.svg"
5+
},
6+
"_class_light": {
7+
"iconPath": "icons/vba_90sGreen_light.svg"
108
},
119
"_module": {
12-
"iconPath": "icons/vba_orange.svg"
10+
"iconPath": "icons/vba_90sPurple_dark.svg"
11+
},
12+
"_module_light": {
13+
"iconPath": "icons/vba_90sPurple_light.svg"
1314
},
1415
"_userform": {
15-
"iconPath": "icons/vba_green.svg"
16+
"iconPath": "icons/vba_90sYellow_dark.svg"
17+
},
18+
"_userform_light": {
19+
"iconPath": "icons/vba_90sPurple_light.svg"
20+
}
21+
},
22+
"fileExtensions": {
23+
"cls": "_class",
24+
"bas": "_module",
25+
"frm": "_userform"
26+
},
27+
"light": {
28+
"fileExtensions": {
29+
"cls": "_class_light",
30+
"bas": "_module_light",
31+
"frm": "_userform_light"
1632
}
1733
}
1834
}

package.json

Lines changed: 17 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"Programming Languages",
1717
"Snippets",
1818
"Linters",
19-
"Formatters"
19+
"Formatters",
20+
"Themes"
2021
],
2122
"keywords": [
2223
"multi-root ready"
@@ -30,46 +31,27 @@
3031
"contributes": {
3132
"languages": [
3233
{
33-
"id": "vba-class",
34+
"id": "vba",
3435
"aliases": [
35-
"VBA Class"
36+
"VBA"
3637
],
3738
"extensions": [
38-
".cls"
39+
".cls",
40+
".bas",
41+
".frm"
3942
],
4043
"configuration": "./vba.language-configuration.json",
4144
"icon": {
4245
"dark": "icons/vba_90sGreen_dark.svg",
4346
"light": "icons/vba_90sGreen_light.svg"
4447
}
45-
},
46-
{
47-
"id": "vba-module",
48-
"aliases": [
49-
"VBA Module"
50-
],
51-
"extensions": [
52-
".bas"
53-
],
54-
"configuration": "./vba.language-configuration.json",
55-
"icon": {
56-
"dark": "icons/vba_90sPurple_dark.svg",
57-
"light": "icons/vba_90sPurple_light.svg"
58-
}
59-
},
48+
}
49+
],
50+
"iconThemes": [
6051
{
61-
"id": "vba-form",
62-
"aliases": [
63-
"VBA Form"
64-
],
65-
"extensions": [
66-
".frm"
67-
],
68-
"configuration": "./vba.language-configuration.json",
69-
"icon": {
70-
"dark": "icons/vba_90sYellow_dark.svg",
71-
"light": "icons/vba_90sYellow_light.svg"
72-
}
52+
"id": "vba-lsp",
53+
"label": "VBA Icons",
54+
"path": "icon-theme.json"
7355
}
7456
],
7557
"configurationDefaults": {
@@ -148,39 +130,22 @@
148130
},
149131
"grammars": [
150132
{
151-
"language": "vba-class",
152-
"scopeName": "source.vba",
153-
"path": "./client/syntaxes/vba.tmLanguage.json"
154-
},
155-
{
156-
"language": "vba-module",
157-
"scopeName": "source.vba",
158-
"path": "./client/syntaxes/vba.tmLanguage.json"
159-
},
160-
{
161-
"language": "vba-form",
133+
"language": "vba",
162134
"scopeName": "source.vba",
163135
"path": "./client/syntaxes/vba.tmLanguage.json"
164136
}
165137
],
166138
"snippets": [
167139
{
168-
"language": "vba-class",
169-
"path": "./snippets/vba.json"
170-
},
171-
{
172-
"language": "vba-module",
173-
"path": "./snippets/vba.json"
174-
},
175-
{
176-
"language": "vba-form",
140+
"language": "vba",
177141
"path": "./snippets/vba.json"
178142
}
179143
]
180144
},
181145
"scripts": {
182146
"vscode:prepublish": "npm run package",
183147
"build": "npm run check-types && node esbuild.js",
148+
"fullBuild": "npm run textMate && npm run antlr",
184149
"build-test": "node esbuild.js --test",
185150
"check-types": "tsc --noEmit",
186151
"watch": "npm-run-all -p watch:*",
@@ -191,7 +156,7 @@
191156
"postinstall": "cd client && npm install && cd ../server && npm install && cd ..",
192157
"textMate": "npx js-yaml client/syntaxes/vba.tmLanguage.yaml > client/syntaxes/vba.tmLanguage.json && npm run tmSnapTest",
193158
"antlr": "npm run antlr4ngPre && npm run antlr4ng && npm run antlr4ngFmt && npm run build",
194-
"antlr4ng": "antlr4ng -Dlanguage=TypeScript -visitor -Xlog ./server/src/antlr/vba.g4 -o ./server/src/antlr/out/",
159+
"antlr4ng": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vba.g4 -o ./server/src/antlr/out/",
195160
"antlr4ngPre": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbapre.g4 -o ./server/src/antlr/out/",
196161
"antlr4ngFmt": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbafmt.g4 -o ./server/src/antlr/out/",
197162
"test": "npm run tmSnapTest && npm run tmUnitTest && npm run vsctest",

0 commit comments

Comments
 (0)