diff --git a/.github/workflows/createPackage.yml b/.github/workflows/ci.yml similarity index 54% rename from .github/workflows/createPackage.yml rename to .github/workflows/ci.yml index 138d4b7..cc12345 100644 --- a/.github/workflows/createPackage.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ -name: Create MetaModelica VS Code Extension -on: +name: CI +on: push: branches: - main @@ -8,29 +8,69 @@ on: pull_request: branches: - main + jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Setup npm uses: actions/setup-node@v4 with: node-version: 20 - - name: Install the dependencies + + - name: Install dependencies run: npm install - - name: Build package + + - name: Translate grammar to JSON + run: npm run prebuild + + - name: Archive tmGrammar files + uses: actions/upload-artifact@v4 + with: + name: tmGrammar.json + path: syntaxes/*.tmGrammar.json + + - name: Build Package + if: always() run: npm run build + - name: Archive vsix package + if: always() uses: actions/upload-artifact@v4 with: name: metamodelica.vsix path: metamodelica-*.vsix + test: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup npm + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm install + + - name: Download tmGrammar files + uses: actions/download-artifact@v4 + with: + name: tmGrammar.json + path: syntaxes + + - name: Run Test + run: npm run test + release: if: startsWith(github.ref, 'refs/tags/') - needs: build + needs: test runs-on: ubuntu-latest permissions: contents: write diff --git a/.vscode/launch.json b/.vscode/launch.json index 13111b2..1fca752 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,7 +3,7 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 { - "version": "0.2.0", + "version": "0.2.0", "configurations": [ { "name": "Extension", diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..b0d0f00 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,35 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "tmGrammar tests", + "type": "shell", + "command": "npx vscode-tmgrammar-test -c 'test/**/*.test.*'", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new", + }, + "problemMatcher": { + "owner": "vscode-tmgrammar-test", + "fileLocation": [ + "relative", + "${workspaceFolder}", + ], + "pattern": [ + { + "regexp": "^(ERROR)\\s([^:]+):(\\d+):(\\d+):(\\d+)\\s(.*)$", + "severity": 1, + "file": 2, + "line": 3, + "column": 4, + "endColumn": 5, + "message": 6, + }, + ], + } + } + ] +} diff --git a/README.md b/README.md index 0726901..e043bdb 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -[![Build Extension](https://github.com/AnHeuermann/modelica-language-vscode/actions/workflows/createPackage.yml/badge.svg)](https://github.com/AnHeuermann/modelica-language-vscode/actions/workflows/createPackage.yml) +[![Test](https://github.com/AnHeuermann/modelica-language-vscode/actions/workflows/ci.yml/badge.svg)](https://github.com/AnHeuermann/modelica-language-vscode/actions/workflows/ci.yml) # MetaModelica and Susan in Visual Studio Code -This extension adds support for the Modelica, Optimica, MetaModelica and Susan languages -to Visual Studio Code. -This extension is meant to use for developers of OpenModelica. -If you want Modelica support use the great extension -[Modelica by SimplyDanny](https://marketplace.visualstudio.com/items?itemName=SimplyDanny.modelica) +This extension adds support for the Modelica, Optimica, MetaModelica and Susan +languages to Visual Studio Code. This extension is meant to use for developers +of OpenModelica. If you want Modelica support use the great extension [Modelica +by +SimplyDanny](https://marketplace.visualstudio.com/items?itemName=SimplyDanny.modelica) which is the base for this extensions. ## Source -This extension is based on the Modelica extension taken from -[SimplyDanny/modelica-language-vscode](https://github.com/SimplyDanny/modelica-language-vscode) +This extension is based on the Modelica extension +[SimplyDanny/modelica-language-vscode](https://github.com/SimplyDanny/modelica-language-vscode). ## Features @@ -43,29 +43,63 @@ This extension is based on the Modelica extension taken from ### Select MetaModelica as a language -* On the bottom-right corner, click on the *select language mode* button, if you have - created a new file it should display *Plain Text*. +* On the bottom-right corner, click on the *select language mode* button, if you + have created a new file it should display *Plain Text*. * Select *MetaModelica* or *Susan* or *Modelica* in the list of languages. - -Alternatively, saving the file with a `.mo` extension will allow VS Code to understand -that it is a MetaModelica file and automatically select the language. If it is a Modelica -file one has to manually change the language mode to *Modelica*. -The `.mop` extension will be associated with the Optimica language respectively. -The `.tpl` extension will be associated with Susan Template language. -Additional extensions can be connected to the languages in any `settings.json` file using -the `"files.associations"` setting. +Alternatively, saving the file with a `.mo` extension will allow VS Code to +understand that it is a MetaModelica file and automatically select the language. +If it is a Modelica file one has to manually change the language mode to +*Modelica*. The `.mop` extension will be associated with the Optimica language +respectively. The `.tpl` extension will be associated with Susan Template +language. Additional extensions can be connected to the languages in any +`settings.json` file using the `"files.associations"` setting. ### Using snippets Just start to type and choose a snippet that may be proposed. Alternatively, use -`Ctrl+Shift+P` to open the command palette and type `Insert Snippet` to see a list of all -possible snippets to choose from. +`Ctrl+Shift+P` to open the command palette and type `Insert Snippet` to see a +list of all possible snippets to choose from. ## Development -Use the provided dev container to build and publish the extension. See -[https://code.visualstudio.com/api/working-with-extensions/publishing-extension#installation](code.visualstudio.com/api/working-with-extensions/publishing-extension). +There is a dev container available to build and publish the extension. +See +[https://code.visualstudio.com/api/working-with-extensions/publishing-extension#installation](code.visualstudio.com/api/working-with-extensions/publishing-extension) +for more details on the publishing process. + +### Dependencies + + - Node.js + - VSCode + - sh (or translate [yaml2json.sh](./yaml2json.sh) to your shell equivalent) + +### Build + +```bash +npm install +``` + +Translate the `*tmGrammar.yaml` files to `*.tmGrammar.json` JSON files. + +```bash +npm run prebuild +``` + +### Test + +Run the `tmGrammer tests` task: + - Open Command Palette (Ctrl+Shift+P) + - Type `tasks: Run task` + - Choose `tmGrammer tests` + +or run it manually: + +```bash +npx vscode-tmgrammar-test test/**/*.test.* +``` + +### Build Package Generate .vsix package file: ```bash diff --git a/examples/LotkaVolterra.mo b/examples/LotkaVolterra.mo index 652537f..6eb896a 100644 --- a/examples/LotkaVolterra.mo +++ b/examples/LotkaVolterra.mo @@ -1,9 +1,9 @@ model LotkaVolterra "Lotka-Volterra equations" - Real x(start = 1) "Prey"; - Real y(start = 1) "Predator"; - parameter Real lambda = 0.5; - input Real u; + Real x(start = 1) "Prey"; + Real y(start = 1) "Predator"; + parameter Real lambda = 0.5; + input Real u; equation - der(x) = x - x * y - lambda * u; - der(y) = -y + x * y - u; + der(x) = x - x * y - lambda * u; + der(y) = -y + x * y - u; end LotkaVolterra; diff --git a/package-lock.json b/package-lock.json index f63034b..2704459 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,16 +10,17 @@ "license": "See LICENSE.txt", "devDependencies": { "@vscode/vsce": "^2.21.1", - "js-yaml": "^4.1.0" + "js-yaml": "^4.1.0", + "vscode-tmgrammar-test": "^0.1.3" }, "engines": { "vscode": "^1.79.0" } }, "node_modules/@vscode/vsce": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.22.0.tgz", - "integrity": "sha512-8df4uJiM3C6GZ2Sx/KilSKVxsetrTBBIUb3c0W4B1EWHcddioVs5mkyDKtMNP0khP/xBILVSzlXxhV+nm2rC9A==", + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.24.0.tgz", + "integrity": "sha512-p6CIXpH5HXDqmUkgFXvIKTjZpZxy/uDx4d/UsfhS9vQUun43KDNUbYeZocyAHgqcJlPEurgArHz9te1PPiqPyA==", "dev": true, "dependencies": { "azure-devops-node-api": "^11.0.1", @@ -126,6 +127,12 @@ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "dev": true }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -171,14 +178,19 @@ } }, "node_modules/call-bind": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", - "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dev": true, "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.1", - "set-function-length": "^1.1.1" + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -328,17 +340,20 @@ } }, "node_modules/define-data-property": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", - "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/detect-libc": { @@ -351,6 +366,15 @@ "node": ">=8" } }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -428,6 +452,27 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -479,16 +524,20 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", - "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dev": true, "dependencies": { + "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -542,21 +591,21 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", - "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.2" + "es-define-property": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", "dev": true, "engines": { "node": ">= 0.4" @@ -578,9 +627,9 @@ } }, "node_modules/hasown": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, "dependencies": { "function-bind": "^1.1.2" @@ -677,9 +726,9 @@ } }, "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", "dev": true }, "node_modules/keytar": { @@ -823,9 +872,9 @@ "optional": true }, "node_modules/node-abi": { - "version": "3.52.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.52.0.tgz", - "integrity": "sha512-JJ98b02z16ILv7859irtXn4oUaFWADtvkzy2c0IAatNVX2Mc9Yoh8z6hZInn3QwvMEYhHuQloYi+TTQy67SIdQ==", + "version": "3.56.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.56.0.tgz", + "integrity": "sha512-fZjdhDOeRcaS+rcpve7XuwHBmktS1nS1gzgghwKUQQ8nTy2FdSDr6ZT8k6YhvlJeHmmQMYiT/IH9hfco5zeW2Q==", "dev": true, "optional": true, "dependencies": { @@ -931,9 +980,9 @@ "dev": true }, "node_modules/prebuild-install": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", - "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.2.tgz", + "integrity": "sha512-UnNke3IQb6sgarcZIDU3gbMeTp/9SSU1DAIkil7PrqG1vZlBtY5msYccSKSHDqa3hNg436IXK+SNImReuA1wEQ==", "dev": true, "optional": true, "dependencies": { @@ -969,12 +1018,12 @@ } }, "node_modules/qs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.0.tgz", + "integrity": "sha512-trVZiI6RMOkO476zLGaBIzszOdFPnCCXHPG9kn0yuS1uz6xdVxPfZdB3vUig9pxPFDM9BRAgz/YUIVQ1/vuiUg==", "dev": true, "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -1026,21 +1075,6 @@ "node": ">= 6" } }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1069,9 +1103,9 @@ "dev": true }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -1084,29 +1118,35 @@ } }, "node_modules/set-function-length": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", - "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "dev": true, "dependencies": { - "define-data-property": "^1.1.1", - "get-intrinsic": "^1.2.1", + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1222,15 +1262,12 @@ } }, "node_modules/tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", + "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", "dev": true, - "dependencies": { - "rimraf": "^3.0.0" - }, "engines": { - "node": ">=8.17.0" + "node": ">=14.14" } }, "node_modules/tunnel": { @@ -1291,6 +1328,46 @@ "dev": true, "optional": true }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-7.0.4.tgz", + "integrity": "sha512-9hJp0xL7HW1Q5OgGe03NACo7yiCTMEk3WU/rtKXUbncLtdg6rVVNJnHwD88UhbIYU2KoxY0Dih0x+kIsmUKn2A==", + "dev": true + }, + "node_modules/vscode-tmgrammar-test": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/vscode-tmgrammar-test/-/vscode-tmgrammar-test-0.1.3.tgz", + "integrity": "sha512-Wg6Pz+ePAT1O+F/A1Fc4wS5vY2X+HNtgN4qMdL+65NLQYd1/zdDWH4fhwsLjX8wTzeXkMy49Cr4ZqWTJ7VnVxg==", + "dev": true, + "dependencies": { + "bottleneck": "^2.19.5", + "chalk": "^2.4.2", + "commander": "^9.2.0", + "diff": "^4.0.2", + "glob": "^7.1.6", + "vscode-oniguruma": "^1.5.1", + "vscode-textmate": "^7.0.1" + }, + "bin": { + "vscode-tmgrammar-snap": "dist/snapshot.js", + "vscode-tmgrammar-test": "dist/unit.js" + } + }, + "node_modules/vscode-tmgrammar-test/node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || >=14" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index bddc137..07ceaca 100644 --- a/package.json +++ b/package.json @@ -127,10 +127,12 @@ }, "scripts": { "prebuild": "sh yaml2json.sh", - "build": "vsce package" + "build": "vsce package", + "test": "vscode-tmgrammar-test test/**/*.test.*" }, "devDependencies": { "@vscode/vsce": "^2.21.1", - "js-yaml": "^4.1.0" + "js-yaml": "^4.1.0", + "vscode-tmgrammar-test": "^0.1.3" } } diff --git a/test/modelica/Class.test.mo b/test/modelica/Class.test.mo new file mode 100644 index 0000000..9b6bf9a --- /dev/null +++ b/test/modelica/Class.test.mo @@ -0,0 +1,8 @@ +// SYNTAX TEST "source.modelica" "Class" + +model MyModel +//<---keyword +// ^^^^^^^ entity.name.type +end MyModel; +//<---keyword +// ^^^^^^^ entity.name.type diff --git a/test/modelica/Comments.test.mo b/test/modelica/Comments.test.mo new file mode 100644 index 0000000..4ee5b6b --- /dev/null +++ b/test/modelica/Comments.test.mo @@ -0,0 +1,11 @@ +// SYNTAX TEST "source.modelica" "Comments" + +model M "Documentation" +// ^^^^^^^^^^^^^^^ comment.line + Real x "Variable x"; +// ^^^^^^^^^^^^ comment.line + Real y = 1.0 "Variable y"; + String z = "hello" "Variable z"; + Foo foo(x=1) "Variable foo"; +// ^^^^^^^^^^^^^^ comment.line +end M;