Development
How to build, run and test VS Code Aster from source. For the contribution workflow (branches, pull requests), see CONTRIBUTING.md.
Prerequisites
- Node.js 22 and npm.
- Python 3.11+ with the packages of
requirements.txt(bundled with the extension) andrequirements-dev.txt(tests and numpy; installmedcouplingtoo to run the tests of the Python mesh converters, which skip without it), plusruffandmypyfor the lint checks.
Setup
Code
npm install also installs the Husky pre-commit hook, which formats staged files with Prettier and runs the lint checks.
Architecture
The extension runs as three processes:
- Extension host (
src/): TypeScript bundled by esbuild intodist/extension.js.src/extension.tsregisters the commands, the sidebar, the custom editors and starts the language client. - Python language server (
python/lsp/): apyglsserver launched over stdio with the interpreter ofvs-code-aster.pythonExecutablePath. Per-feature logic lives inpython/lsp/managers/. The command catalog is found bysrc/CatalogResolver.ts: theasterCatalogPathsetting, the cave-selected Docker image, or the bundled fallback inpython/data/. - Svelte webviews (
webviews/):viewer(VTK.js mesh viewer),export(the.exportform),study(study generator) andvalidation(validation report), with shared components inwebviews/shared/. Each builds into its owndist/with Vite.
Running the extension
Press F5 (Run > Start Debugging). This opens a second VS Code window with the extension loaded and starts the watch tasks of .vscode/tasks.json:
| Task | What it does |
|---|---|
npm: watch:esbuild | Rebuilds the extension host on save |
npm: watch:tsc | Type-checks the extension host continuously |
npm: watch:webview | Rebuilds the four webviews on save |
After a change in src/, reload the debug window (Ctrl+R). After a change in a webview, wait for the rebuild and run Developer: Reload Webviews.
Building
Code
npm run compile type-checks, lints and bundles the extension host. The .vsix is built by CI with nox -s package, which first installs the Python dependencies into python/bundled/libs/ so they ship with the extension.
Tests
| Command | What it runs |
|---|---|
npm test | Vitest (TypeScript and webviews), then pytest |
npm run test:unit | Vitest unit tests of the extension host |
npm run test:webview | Vitest tests of the webviews |
npm run test:scenario | Study generator golden files (test:scenario:update refreshes them) |
npm run test:py | pytest on python/tests (mesh tests skip when medcoupling is missing) |
npm run test:integration | VS Code integration tests (test:integration:headless under xvfb) |
MED reader
The mesh viewer and the study generator read MED files in TypeScript (src/med/, with the HDF5 library h5wasm), in a worker thread. tests/unit/medReader.test.ts checks it against the medcoupling-based converters it replaced (python/med2obj.py, python/mesh_groups.py, kept for this only): tests/fixtures/med/ holds small meshes of every element family with their reference outputs. Regenerate them with medcoupling installed:
Code
To compare on your own meshes (any .med, .mmed, .rmed under the given folders):
Code
Checks run by CI
Prettier, ESLint, tsc --noEmit, svelte-check on each webview, Ruff (lint and format) and mypy on python/lsp. CI only checks, it never fixes: the pre-commit hook applies the formatting.
Website and documentation
The website lives in site/ (Next.js) and the documentation in docs-site/ (Zudoku), which builds its pages from docs/. Both deploy to GitHub Pages on every push to main that touches them.
Code
Code