From a9605937e5b06366983e05bab938dde636613c2e Mon Sep 17 00:00:00 2001 From: gfgafn <87858323+gfgafn@users.noreply.github.com> Date: Tue, 23 Jan 2024 23:20:24 +0800 Subject: [PATCH] chore: improve doc and update CI config --- .github/workflows/main.yml | 3 ++- .vscode/tasks.json | 5 +++-- README.md | 14 +++++++++++--- package.json | 5 +++++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3f9324e..4be53c7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,8 @@ jobs: steps: - uses: actions/checkout@v2 - name: run Textmate scope tests - run: npx vscode-tmgrammar-test@0.0.11 -s source.rust -g syntaxes/rust.tmLanguage.json -t "test/**/*.rs" + # use the same version of vscode-tmgrammar-test as in package.lock.json + run: npx vscode-tmgrammar-test@0.1.1 "./test/**/*.rs" --compact --grammar ./syntaxes/rust.tmLanguage.json build: runs-on: ubuntu-latest steps: diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 62d9393..1fe15be 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -24,8 +24,9 @@ }, { "label": "Test TM scopes", - "type": "shell", - "command": "npx vscode-tmgrammar-test -c -s source.rust -g syntaxes/rust.tmLanguage.json -t \"test/**/*.rs\"", + "type": "npm", + "script": "test", + "detail": "npm run test-TM-scope", "group": { "kind": "test", "isDefault": true diff --git a/README.md b/README.md index 450f3ad..fa0e5f9 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,15 @@ The VS Code command `Developer: Inspect Editor Tokens and Scopes` will show you ## Contributing The grammar is maintained as YAML, using tasks to generate JSON on save (please don't edit the JSON grammar directly). -You can regenerate the JSON manually from the command palette using -`Tasks: Run Build Task`, or running `gulp yaml` in a terminal. -[Rust Analyzer]: https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer +```sh +npm install + +# Watch for changes of YAML files and regenerate JSON +npm start + +# Run tests +npm test +``` + +If you are using VS Code, you can use the `Tasks: Run Build Task` command from the command palette to run the gulp task. And you can use the `Tasks: Run Test Task` command to run the tests. diff --git a/package.json b/package.json index 136b1e3..cee2fac 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,11 @@ "author": { "name": "dustypomerleau" }, + "scripts": { + "start": "npx gulp watch-yaml", + "test": "npm run test-TM-scope", + "test-TM-scope": "npx vscode-tmgrammar-test \"./test/**/test*.rs\" --compact --grammar ./syntaxes/rust.tmLanguage.json" + }, "repository": { "type": "git", "url": "https://github.com/dustypomerleau/rust-syntax"