VS Code Aster
Contributing

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) and requirements-dev.txt (tests and numpy; install medcoupling too to run the tests of the Python mesh converters, which skip without it), plus ruff and mypy for the lint checks.

Setup

TerminalCode
git clone https://github.com/simvia-tech/vs-code-aster.git cd vs-code-aster npm install

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:

  1. Extension host (src/): TypeScript bundled by esbuild into dist/extension.js. src/extension.ts registers the commands, the sidebar, the custom editors and starts the language client.
  2. Python language server (python/lsp/): a pygls server launched over stdio with the interpreter of vs-code-aster.pythonExecutablePath. Per-feature logic lives in python/lsp/managers/. The command catalog is found by src/CatalogResolver.ts: the asterCatalogPath setting, the cave-selected Docker image, or the bundled fallback in python/data/.
  3. Svelte webviews (webviews/): viewer (VTK.js mesh viewer), export (the .export form), study (study generator) and validation (validation report), with shared components in webviews/shared/. Each builds into its own dist/ 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:

TaskWhat it does
npm: watch:esbuildRebuilds the extension host on save
npm: watch:tscType-checks the extension host continuously
npm: watch:webviewRebuilds 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

TerminalCode
npm run build:webview npm run compile

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

CommandWhat it runs
npm testVitest (TypeScript and webviews), then pytest
npm run test:unitVitest unit tests of the extension host
npm run test:webviewVitest tests of the webviews
npm run test:scenarioStudy generator golden files (test:scenario:update refreshes them)
npm run test:pypytest on python/tests (mesh tests skip when medcoupling is missing)
npm run test:integrationVS 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:

TerminalCode
python tests/fixtures/med/make_fixtures.py

To compare on your own meshes (any .med, .mmed, .rmed under the given folders):

TerminalCode
MED_PYTHON=/path/to/python-with-medcoupling MED_CORPUS=/path/to/meshes npx vitest run --project unit medCorpus

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.

TerminalCode
cd docs-site && pnpm install && pnpm dev
TerminalCode
cd site && pnpm install && pnpm dev
Last modified on