Skip to content

Commit

Permalink
add a few snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
serkonda7 committed Feb 27, 2024
1 parent ae6f8a3 commit f62b238
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*.md]
indent_style = space
indent_size = 3

[*.{yml,yaml-tmlanguage}]
indent_style = space
indent_size = 2
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ _2022-11-02_
**Additions**
- Syntax highlighting for the WinWrap Basic language
- Highlight vba keywords `Eqv`, `Imp`, `TypeOf`, `AddressOf`, `WithEvents`, `Event`, `RaiseEvent`,
`Erase` and `Any`
`Erase` and `Any`

**Fixes**
- Highlight `Exit` at line start and after tabs
Expand Down Expand Up @@ -125,10 +125,10 @@ _2022-04-12_

**Additions**
- Highlighting keywords: `And`, `Case`, `Case Else`, `Currency`, `Date`, `If`, `Is`, `Else`,
`ElseIf`, `Empty`, `End If`, `End Select`, `End With`, `False`, `Let`, `Mod`, `Not`, `Null`,
`Select Case`, `Then`, `Or`, `ReDim`, `Preserve`, `To`, `True`, `Step`, `ByRef`, `ByVal`,
`Class`, `Exit`, `Get`, `Static`, `Property`, `Like`, `Xor`, `On Error`, `GoTo`
> Note: not all are covered by syntax tests
`ElseIf`, `Empty`, `End If`, `End Select`, `End With`, `False`, `Let`, `Mod`, `Not`, `Null`,
`Select Case`, `Then`, `Or`, `ReDim`, `Preserve`, `To`, `True`, `Step`, `ByRef`, `ByVal`,
`Class`, `Exit`, `Get`, `Static`, `Property`, `Like`, `Xor`, `On Error`, `GoTo`
> Note: not all are covered by syntax tests
- Highlight names of function declarations
- Highlight date literals

Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-vba",
"displayName": "VBA",
"description": "VBA tooling, syntax highlighting and snippets for VS Code.",
"description": "VBA tooling, syntax highlighting and snippets.",
"icon": "images/icon_256x256.png",
"version": "0.9.6",
"license": "MIT",
Expand All @@ -17,6 +17,7 @@
},
"categories": [
"Programming Languages",
"Snippets",
"Language Packs"
],
"keywords": [
Expand Down Expand Up @@ -72,6 +73,12 @@
"path": "./out/wwb.json"
}
],
"snippets": [
{
"language": "vba",
"path": "./out/vba_snippets.json"
}
],
"commands": [
{
"command": "vba.extract_from_doc",
Expand Down Expand Up @@ -114,7 +121,7 @@
"test-wwb": "vscode-tmgrammar-test -g ./out/wwb.json \"syntaxes/tests/other/*.wwd\"",
"install-dev-ext": "vsce package -o ./out/vscode-vba-dev.vsix && code --install-extension ./out/vscode-vba-dev.vsix --force",
"package": "vsce package",
"convert-yaml": "yaml2json language-configuration.yml \"syntaxes/*.yaml-tmlanguage\"",
"convert-yaml": "yaml2json language-configuration.yml \"syntaxes/*.yaml-tmlanguage\" \"snippets/*.yml\"",
"vscode:prepublish": "pnpm run compile && pnpm run convert-yaml"
},
"devDependencies": {
Expand Down
35 changes: 35 additions & 0 deletions snippets/vba_snippets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# SPDX-FileCopyrightText: 2024-present Lukas Neubert <lukas.neubert@proton.me>
# SPDX-License-Identifier: MPL-2.0

If:
prefix: If
body:
- If ${1:condition} Then
- "\t${2}"
- End If

ElseIf:
prefix: ElseIf
body:
- ElseIf ${1:condition} Then
- "\t${2}"

Else:
prefix: Else
body:
- Else
- "\t${0}"

Sub:
prefix: Sub
body:
- Sub ${1:Name}()
- "\t${2}"
- End Sub

Function:
prefix: Function
body:
- Function ${1:Name}()
- "\t${2}"
- End Function
2 changes: 1 addition & 1 deletion src/extension.js.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023-present Lukas Neubert <serkonda7@pm.me>
// SPDX-FileCopyrightText: 2023-present Lukas Neubert <lukas.neubert@proton.me>
// SPDX-License-Identifier: MPL-2.0

package extension
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/vba.yaml-tmlanguage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Lukas Neubert <serkonda7@pm.me>
# SPDX-FileCopyrightText: 2023-present Lukas Neubert <lukas.neubert@proton.me>
# SPDX-License-Identifier: MPL-2.0

name: Visual Basic for Applications
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/wwb.yaml-tmlanguage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Lukas Neubert <serkonda7@pm.me>
# SPDX-FileCopyrightText: 2023-present Lukas Neubert <lukas.neubert@proton.me>
# SPDX-License-Identifier: MPL-2.0

scopeName: source.wwb
Expand Down

0 comments on commit f62b238

Please sign in to comment.