Skip to content

Improved Pre-parsing #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 11, 2025
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
8 changes: 3 additions & 5 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ jobs:
- run: npm ci
# For some reason, antlr4ng writes to a different location on the VM
# than it does locally, preventing compile. Command added to move the generated files.
- run: npm run textMate
- name: npm run antlr
- name: npm run generate
run: |
npm run antlr4ng
npm run antlr4ngPre
npm run antlr4ngFmt
npm run antlr
npm run build:textMate
mv ./server/src/antlr/out/server/src/antlr/* ./server/src/antlr/out
- run: npm run build
- run: xvfb-run -a npm test
Expand Down
24 changes: 11 additions & 13 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# Contributing
**Signed commits are turned on for this repo.**
This repository is under active development. Please ensure your contributions do not cause merge conflicts with the dev branch.

## Setup

1. Fork this repo
1. Install VS Code Extension [esBuild Problem Matchers](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers).
2. Install [Java](https://www.oracle.com/au/java/technologies/downloads/) >= 11
3. Install [NPM](https://github.com/coreybutler/nvm-windows)
4. `npm install` to install dependencies.
5. `npm run textMate` first time and every time grammar is changed.
6. `npm run antlr` first time and every time grammar is changed.
2. Install VS Code Extension [esBuild Problem Matchers](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers).
3. Install [Java](https://www.oracle.com/au/java/technologies/downloads/) >= 11
4. Install [NPM](https://github.com/coreybutler/nvm-windows)
5. `npm install` to install dependencies.
6. `npm run test` to build and unit test.
7. Create a `.\sample` directory as a default workspace for client debugging (or update .\\.vscode\\launch.json as preferred).
7. (Optional) Install [ANTLR4 grammar syntax support](https://marketplace.visualstudio.com/items?itemName=mike-lischke.vscode-antlr4) VS Code extension.
8. (Optional) Install [ANTLR4 grammar syntax support](https://marketplace.visualstudio.com/items?itemName=mike-lischke.vscode-antlr4) VS Code extension.
Note: to debug a grammar, you'll first need to activate the extension by opening one of the *.g4 files.

To contribute, you'll need to [create a pull request from a fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork).
**Signed commits are turned on for this repo.**

## Debugging Language Server

Expand All @@ -41,10 +39,10 @@ Note the grammar file for this project can be found at /server/src/antlr/vba.g4

The grammar call graph is interesting, but not particularly useful. Generating "valid" input generates garbage.

### Run unit tests for TextMate grammar
## TextMate Snapshots

To verify that your changes haven't broken existing syntax or tests, and to ensure any new tests pass, run the following command:
Your edits to the TextMate grammar may cause changes to the snapshot. If these changes are expected and unit tested, update the snapshot.

```
npm run tmUnitTest
```
npm run tmSnapUpdate
```
30 changes: 14 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,28 +144,26 @@
},
"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",
"build": "npm-run-all -p build:* && npm run check-types && node esbuild.js",
"package": "npm-run-all -p build:* && npm run check-types && node esbuild.js --production",
"check-types": "tsc --noEmit",
"watch": "npm-run-all -p watch:*",
"watch:esbuild": "node esbuild.js --watch",
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
"package": "npm run textMate && npm run antlr && npm run check-types && node esbuild.js --production",
"lint": "eslint ./client/src ./server/src --ext .ts,.tsx",
"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 ./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",
"testsh": "sh ./scripts/e2e.sh",
"testps": "powershell ./scripts/e2e.ps1",
"tmUnitTest": "vscode-tmgrammar-test ./test/textmate/**/*.vba",
"tmSnapTest": "vscode-tmgrammar-snap ./test/textmate/snapshot/*.??s",
"build:textMate": "npx js-yaml client/syntaxes/vba.tmLanguage.yaml > client/syntaxes/vba.tmLanguage.json",
"antlr": "npm-run-all -p build:antlr*",
"build:antlr": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vba.g4 -o ./server/src/antlr/out/",
"build:antlrPre": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbapre.g4 -o ./server/src/antlr/out/",
"build:antlrFmt": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbafmt.g4 -o ./server/src/antlr/out/",
"tmSnapUpdate": "vscode-tmgrammar-snap --updateSnapshot ./test/textmate/snapshot/*.??s",
"vsctest": "npm run build-test && vscode-test"
"test": "npm run build && npm-run-all -p test:*:*",
"test:textMate:unit": "vscode-tmgrammar-test ./test/textmate/**/*.vba",
"test:textMate:snap": "vscode-tmgrammar-snap ./test/textmate/snapshot/*.??s",
"test:vsc:unit": "vscode-test",
"testsh": "sh ./scripts/e2e.sh",
"testps": "powershell ./scripts/e2e.ps1"
},
"dependencies": {
"antlr4ng": "^3.0.16",
Expand All @@ -189,4 +187,4 @@
"typescript": "^5.8.3",
"vscode-tmgrammar-test": "^0.1.3"
}
}
}
Loading