Skip to content

Commit 57c6db6

Browse files
authored
minor README and script updates (#91)
* readme: include logo * contrib: update wording * mention wip snippets * minor updates for gen_json_grammar - add --dry flag to skip push - move copy and sanity check into function * mention gh linguist
1 parent 0c12e0a commit 57c6db6

File tree

6 files changed

+56
-37
lines changed

6 files changed

+56
-37
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
## 0.10.0
33
_unreleased_
44

5+
- Highlight custom types with underscores or numbers
56

67
## 0.9.1
78
_30 July 2023_

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
Thanks for your interest in improving vscode-vba!
33

44
## Creating Issues
5-
Before you create a new issue, please first search in [open issues][issues] to check it is not already reported.
5+
Report bugs or suggest new features.
66

7-
In case your issue already exists, add a reaction and possibly create relevant comments.
7+
Before opening a issue, please first search in [open issues][issues] to check it is not already reported.
88

9-
Otherwise proceed with opening a new one.
9+
In case your issue already exists, add a reaction and if possible, comment with further information.
1010

1111
## Creating Pull Requests
1212
> Before making bigger changes, please discuss them in an issue.
@@ -21,14 +21,14 @@ It allows merging them faster with less conflicts and will reduce review time.
2121
- Create a new working branch for your changes
2222

2323
## Regexes
24-
TextMate uses Oniguruma regexes it's mostly compatible with PCRE but not always.
24+
TextMate uses Oniguruma regexes which are mostly compatible with PCRE.
2525
A quite decent overview and comparison can be found here: https://rbuckton.github.io/regexp-features/engines/oniguruma.html
2626

27-
As far as I know, the best tool to test regexes is https://regexr.com/ in PCRE mode.
27+
A good tool to test these regexes is https://regexr.com/ in PCRE mode.
2828

2929
### Unit Tests
3030
Every PR should contain a test case that covers the added feature or bug fix.
31-
This prevents regressions and makes reviewing the changes easier by proofing correct functionality.
31+
This prevents regressions and makes reviewing the changes easier by providing a proof of correct functionality.
3232

3333
Tests for the language grammar (syntax highlighting) are in [`syntaxes/tests`](syntaxes/tests/).
3434
They can be run with the following command:

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
# VBA and WWB support for VS Code
1+
<img align="left" width=110 src="images/icon_256x256.png">
2+
3+
# VBA Support for VS Code
24
[![CI][ci-badge]][ci-status]
35
[![Marketplace Installs][badge-installs-market]][vs-marketplace]
46
[![Open VSX Installs][badge-installs-vsx]][open-vsx]
7+
---
58

6-
Adds syntax highlighting to Visual Studio Code for the following languages:
7-
- Visual Basic for Applications (VBA)
8-
- WinWrap Basic (WWB)
9+
## Key Features
10+
- Syntax highlighting for the following languages (also used by [GitHub Linguist][gh-linguist])
11+
- Visual Basic for Applications (VBA)
12+
- WinWrap Basic (WWB)
13+
- :construction: Export and Import of Macros for Office Documents
14+
- :construction: Comprehensive snippets
915

1016
## Installation
1117
Launch the command palette (<kbd>Ctrl</kbd>+<kbd>P</kbd>) and run
@@ -14,12 +20,13 @@ Launch the command palette (<kbd>Ctrl</kbd>+<kbd>P</kbd>) and run
1420
The extension is also available on [Open VSX][open-vsx].
1521

1622
## Contributing
17-
Any contributions are highly appreciated!
18-
For details see [CONTRIBUTING.md](CONTRIBUTING.md).
23+
Thank you in advance, any contributions are highly appreciated!
24+
25+
For details, please see [CONTRIBUTING.md](CONTRIBUTING.md).
1926

2027
## License
2128
Source code and grammars are licensed under the [Mozilla Public License (MPL-2.0)](LICENSE.txt).<br>
22-
The icon is licensed under [Creative Commons ShareAlike](images/LICENSE).
29+
The icon is licensed under the [Creative Commons ShareAlike](images/LICENSE) License.
2330

2431
<!-- links -->
2532
[ci-badge]: https://github.com/serkonda7/vscode-vba/actions/workflows/ci.yml/badge.svg
@@ -28,3 +35,4 @@ The icon is licensed under [Creative Commons ShareAlike](images/LICENSE).
2835
[badge-installs-vsx]: https://img.shields.io/open-vsx/dt/serkonda7/vscode-vba?label=VSX%20downloads
2936
[vs-marketplace]: https://marketplace.visualstudio.com/items?itemName=serkonda7.vscode-vba
3037
[open-vsx]: https://open-vsx.org/extension/serkonda7/vscode-vba
38+
[gh-linguist]: https://github.com/DecimalTurn/linguist/blob/master/vendor/licenses/git_submodule/vscode-vba-json.dep.yml

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vscode-vba",
33
"displayName": "VBA",
4-
"description": "Visual Basic for Applications and WinWrap Basic support for VS Code.",
4+
"description": "VBA tooling, syntax highlighting and snippets for VS Code.",
55
"icon": "images/icon_256x256.png",
66
"version": "0.10.0-dev",
77
"license": "MIT",

scripts/gen_json_grammar.bt

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is part of vscode-vba.
2-
// Copyright (c) 2023-present Lukas Neubert
2+
// Copyright (c) 2023-present Lukas Neubert.
33
// This Source Code is subject to the terms of the Mozilla Public License 2.0.
44

55
package main
@@ -9,7 +9,9 @@ import bait.util
99

1010
const GIT_USER := 'tiabeast-bot'
1111
const GIT_MAIL := '[email protected]'
12+
const REPO_DIR := '/tmp/vscode-vba-json'
1213

14+
const DRY_RUN := os.user_args().contains('--dry')
1315
const IS_CI := os.getenv('CI') == 'true'
1416

1517
fun main() {
@@ -22,55 +24,63 @@ fun main() {
2224
errors += git_command('config --global user.email "${GIT_MAIL}"')
2325
}
2426

25-
target_repo_dir := '/tmp/vscode-vba-json'
26-
if os.exists(target_repo_dir) {
27-
os.rmdir_all(target_repo_dir)
27+
if os.exists(REPO_DIR) {
28+
os.rmdir_all(REPO_DIR)
2829
}
2930

3031
// Clone repo as bot user
3132
access_token := os.getenv('BOT_TOKEN')
32-
errors += git_command('clone --depth 1 https://${GIT_USER}:${access_token}@github.com/tiabeast/vscode-vba-json.git ${target_repo_dir}')
33+
errors += git_command('clone --depth 1 https://${GIT_USER}:${access_token}@github.com/tiabeast/vscode-vba-json.git ${REPO_DIR}')
3334

3435
// Run conversion
3536
errors += os.system('npm run convert-yaml')
3637

37-
// Copy syntax files
38-
syntax_dir := '${target_repo_dir}/syntaxes'
39-
os.cp('./out/vba.tmGrammar.json', '${syntax_dir}/vba.tmGrammar.json')
40-
os.cp('./out/wwb.tmGrammar.json', '${syntax_dir}/wwb.tmGrammar.json')
41-
42-
// Sanity check for a reasonable file size
43-
text := os.read_file(syntax_dir + '/vba.tmGrammar.json')
44-
if text.length < 1000 {
45-
eprintln('grammar is too small. Something went wrong.')
46-
exit(1)
47-
}
38+
// Copy grammar files
39+
println('Copying grammar files...')
40+
copy_grammar('vba', 1500)
41+
copy_grammar('wwb', 100)
4842

4943
// Stage changes
50-
errors += git_command('-C ${target_repo_dir} add .')
44+
errors += git_command('-C ${REPO_DIR} add .')
5145

5246
// Exit if there is nothing to commit
53-
has_changes := git_command('-C ${target_repo_dir} diff-index --quiet HEAD')
47+
has_changes := git_command('-C ${REPO_DIR} diff-index --quiet HEAD')
5448
if has_changes == 0 {
5549
println('No changes to commit.')
5650
exit(0)
5751
}
5852

5953
// Create commit
6054
println('Creating commit...')
61-
os.chdir(target_repo_dir)
55+
os.chdir(REPO_DIR)
6256
commit_msg := 'update grammars'
6357
errors += git_command('commit -m "${commit_msg}"')
6458

6559
// Safety rebase and push changes
66-
println('Pushing changes...')
67-
errors += git_command('pull --rebase')
68-
errors += git_command('push')
60+
if not DRY_RUN {
61+
println('Pushing changes...')
62+
errors += git_command('pull --rebase')
63+
errors += git_command('push')
64+
}
6965

7066
// Exit with the number of errors
7167
exit(errors)
7268
}
7369

70+
fun copy_grammar(lang string, min_size i32) {
71+
src := './out/${lang}.tmGrammar.json'
72+
73+
// Sanity check for a reasonable file size
74+
text := os.read_file(src)
75+
if text.length < min_size {
76+
eprintln('error: Grammar for ${lang} is too small.')
77+
exit(1)
78+
}
79+
80+
// Copy
81+
os.cp(src, '${REPO_DIR}/syntaxes/${lang}.tmGrammar.json')
82+
}
83+
7484
fun git_command(cmd string) i32 {
7585
esc_cmd := util.shell_escape(cmd)
7686
return os.system('git ${esc_cmd}')

src/extension.js.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is part of vscode-vba.
2-
// Copyright (c) 2021-present Lukas Neubert
2+
// Copyright (c) 2021-present Lukas Neubert.
33
// This Source Code is subject to the terms of the Mozilla Public License 2.0.
44
package extension
55

0 commit comments

Comments
 (0)