Skip to content

Commit

Permalink
Merge branch 'main' into office-sync-prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
serkonda7 authored Dec 2, 2023
2 parents e68d83b + db41910 commit f79fa1b
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Changelog
## 0.9.4
_1 December 2023_

- Highlight `Implements` keyword
- Highlight lot's of I/O-related keywords


## 0.9.3
_24 September 2023_

Expand Down
14 changes: 11 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
# Contributing Guide
Thanks for your interest in improving vscode-vba!


## Creating Issues
Report bugs or suggest new features.

Before opening a issue, please first search in [open issues][issues] to check it is not already reported.

In case your issue already exists, add a reaction and if possible, comment with further information.


## Creating Pull Requests
> Before making bigger changes, please discuss them in an issue.
In general PRs should be kept as small as possible (e.g. one feature/fix per PR).
It allows merging them faster with less conflicts and will reduce review time.


### Repository Setup
- Install the Bait programming language: https://github.com/tiabeast/bait#building-from-source
- Create and clone a fork of https://github.com/serkonda7/vscode-vba
- Run `npm install` inside the cloned directory
- Create a new working branch for your changes

## Regexes
TextMate uses Oniguruma regexes which are mostly compatible with PCRE.
A quite decent overview and comparison can be found here: https://rbuckton.github.io/regexp-features/engines/oniguruma.html

## Regexes and TextMate Scopes (Syntax Highlighting)
TextMate uses Oniguruma regexes which are mostly compatible with PCRE ([Compariosn][oniguruma-overview]).
A good tool to test these regexes is https://regexr.com/ in PCRE mode.

For a list of predefined scopes see https://macromates.com/manual/en/language_grammars#naming_conventions.


### Unit Tests
Every PR should contain a test case that covers the added feature or bug fix.
This prevents regressions and makes reviewing the changes easier by providing a proof of correct functionality.
Expand All @@ -36,6 +41,7 @@ They can be run with the following command:
npm run test
```


### Install a dev version
If you'd like to install a development version of the extension, follow these steps:
1. ```sh
Expand All @@ -47,5 +53,7 @@ If you'd like to install a development version of the extension, follow these st

> Note: It is not required to uninstall any previous versions.

<!-- links -->
[issues]: https://github.com/serkonda7/vscode-vba/issues
[oniguruma-overview]: https://rbuckton.github.io/regexp-features/engines/oniguruma.html
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.

18 changes: 18 additions & 0 deletions syntaxes/tests/vba/io.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
' SYNTAX TEST "source.vba" "I/O related keywords"

Open "file" For Input As #f
' <--- keyword.io.vba
' ^^^^^ - keyword.io.vba
Input #f myVar
' ^^^^^ keyword.io.vba
' ^^^ - keyword.io.vba

Line Input #f myLineVar
' ^^^^^^^^^^ keyword.io.vba
Close #f
' <---- keyword.io.vba

Open "file2" For Output As #2
Print #2 "a"
' ^^^^^ keyword.io.vba
Close #2
3 changes: 3 additions & 0 deletions syntaxes/tests/vba/other.bas
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Attribute VB_Name = "SyntaxTest"
' <--------- keyword.other.vba

Implements IRandomizer
' <---------- keyword.other.vba

Public Const FOO As Integer = 1
' ^^^^^ keyword.other.vba
' ^^ keyword.control.vba
Expand Down
16 changes: 10 additions & 6 deletions syntaxes/vba.tmGrammar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,20 @@ repository:

keywords:
patterns:
- name: keyword.other.option.vba
match: (?i)\bOption (Base [01]|Compare (Binary|Text)|Explicit|Private Module)\b
- name: keyword.conditional.vba
match: (?i:\b(Do(( While)|( Until))?|While|Case( Else)?|Else(If)?|For( Each)?|(I)?If|In|New|(Select )?Case|Then|To|Step|With)\b)
- name: keyword.conditional.end.vba
match: (?i:\b(End( )?If|End (Select|With)|Next|Wend|Loop(( While)|( Until))?|Exit (For|Do|While))\b)
- name: keyword.control.vba
match: (?i:(\b(Exit (Function|Property|Sub)|As|And|By(Ref|Val)|Goto|Is|Like|Mod|Not|On Error|Optional|Or|Resume Next|Stop|Xor|Eqv|Imp|TypeOf|AddressOf)\b)|(\b(End)\b(?=\n)))
- name: keyword.io.vba
match: (?i:\b(Open|Close|Line Input|Lock|Unlock|Print|Seek|Get|Put|Write)\b)
- name: keyword.io.vba
match: "(?i:\\b(Input)(?= #))"
- name: keyword.other.vba
match: (?i:\b(Attribute|Call|End (Function|Property|Sub|Type|Enum)|(Const|Function|Property|Sub|Type|Enum)|Declare|PtrSafe|WithEvents|Event|RaiseEvent)\b)
match: (?i:\b(Attribute|Call|End (Function|Property|Sub|Type|Enum)|(Const|Function|Property|Sub|Type|Enum)|Declare|PtrSafe|WithEvents|Event|RaiseEvent|Implements)\b)
- name: keyword.other.option.vba
match: (?i)\bOption (Base [01]|Compare (Binary|Text)|Explicit|Private Module)\b
- name: keyword.other.visibility.vba
match: (?i:\b(Private|Public|Friend)\b)
- name: constant.language.vba
Expand All @@ -63,13 +67,13 @@ repository:
begin: "(?i)^\\s*(BEGIN)\\b"
beginCaptures:
'1':
name: "keyword.metadata.vba"
name: "keyword.metadata.vba"
end: "(?i)^\\s*(END)\\b"
endCaptures:
'0':
name: "keyword.metadata.vba"
patterns:
- include: "source.vba"
patterns:
- include: "source.vba"

numbers:
patterns:
Expand Down

0 comments on commit f79fa1b

Please sign in to comment.