Skip to content

Commit

Permalink
Use YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
xsebek committed Jun 9, 2024
1 parent db08ba7 commit 1a73dfa
Show file tree
Hide file tree
Showing 9 changed files with 298 additions and 215 deletions.
1 change: 1 addition & 0 deletions .github/workflows/vscode-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
npm clean-install && \
tsc --build . && \
cd .. && \
npm run gen-syntax && \
npm clean-install && \
npm run build --if-present
- run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/vscode-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
npm clean-install && \
tsc --build . && \
cd .. && \
npm run gen-syntax && \
npm clean-install && \
npm run build --if-present
- name: Publish to Visual Studio Marketplace
Expand Down
16 changes: 13 additions & 3 deletions editors/vscode/DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@

### Updating the syntax highlighting

Whenever swarm language adds new features, the highlighting needs to be updated.
Whenever swarm language adds new features, the highlighting might need to be updated.

To save some time, get the current reserved words by running `swarm-docs`:
```bash
cabal run swarm:swarm-docs -- editors
```

You still have to add for example types manually.

You still have to add for example type keywords (`rec`, `forall`) manually.

### Add more language features

Expand All @@ -53,9 +52,17 @@ npm install

If you want to include the LSP client then after the previous install do:
```sh
cd client
npm update
npm install
tsc --build
```

To generate the JSON TextMate grammar do:
```sh
npm run gen-syntax
```

To build the VSIX package do:
```sh
vsce package --baseImagesUrl "https://raw.githubusercontent.com/swarm-game/swarm/editors/vscode"
Expand All @@ -75,3 +82,6 @@ Then you may have to update the test snapshot as follows:
```
npm test vscode-tmgrammar-snap -- --updateSnapshot
```

**WARNING:** Always run the snapshot test to see if half of the
syntax is not suddenly missing because of a typo.
6 changes: 3 additions & 3 deletions editors/vscode/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

109 changes: 67 additions & 42 deletions editors/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions editors/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"repository": {
"url": "https://github.com/swarm-game/swarm"
},
"keywords": [
"multi-root ready"
],
"engines": {
"vscode": "^1.75.0"
},
"activationEvents": [
"onLanguage:swarm"
],
"keywords": [
"multi-root ready"
],
"engines": {
"vscode": "^1.75.0"
},
"activationEvents": [
"onLanguage:swarm"
],
"categories": [
"Programming Languages"
],
Expand Down Expand Up @@ -50,11 +50,13 @@
"@typescript-eslint/parser": "^4.23.0",
"esbuild": "^0.13.13",
"eslint": "^7.26.0",
"js-yaml": "^4.1.0",
"mocha": "^10.4.0",
"typescript": "^4.4.3",
"vscode-tmgrammar-test": "^0.1.1"
},
"scripts": {
"gen-syntax": "npx js-yaml ./syntaxes/swarm.tmLanguage.yaml > ./syntaxes/swarm.tmLanguage.json",
"vscode:prepublish": "npm run esbuild-base -- --minify",
"esbuild-base": "esbuild ./client/src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node",
"esbuild": "npm run esbuild-base -- --sourcemap",
Expand Down
1 change: 1 addition & 0 deletions editors/vscode/syntaxes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
swarm.tmLanguage.json
Loading

0 comments on commit 1a73dfa

Please sign in to comment.