Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/sh
set -e

npx prettier --write "src/**/*.ts" "webviews/viewer/src/**/*.{ts,svelte}" "webviews/export/**/*.{js,css,html}"
git add -u
# Only format files staged for this commit, and re-stage only those files.
# A blanket `git add -u` would otherwise sweep unrelated tracked
# modifications into the commit.
staged_files=$(git diff --cached --name-only --diff-filter=ACMR | \
grep -E '^(src/.*\.ts|webviews/viewer/src/.*\.(ts|svelte)|webviews/export/.*\.(js|css|html))$' || true)

if [ -n "$staged_files" ]; then
echo "$staged_files" | tr '\n' '\0' | xargs -0 npx prettier --write
echo "$staged_files" | tr '\n' '\0' | xargs -0 git add
fi

npx eslint --max-warnings=0 src/ webviews/export/
npx svelte-check --tsconfig webviews/viewer/tsconfig.json --fail-on-warnings
python3 -m ruff check python/lsp/ python/med2obj.py
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to the **VS Code Aster** extension will be documented in thi
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.5.4] - 2026-04-15

File icon improvements and language support for `.export` and MED files.

### Added
- Dedicated file icons for `.export` files (blue rocket) and `.med` / `.mmed` / `.rmed` files (orange cube)
- Refreshed code_aster logo, now bundled with its SVG source
- `vs-code-aster.medFileExtensions` setting to register arbitrary extensions (e.g. `.21`, `.71`) as MED files, which code_aster writes under the I/O unit number

## [1.5.3] - 2026-03-26

Comment toggle support and Windows debugging improvements.
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cff-version: 1.5.3
cff-version: 1.5.4
title: VS Code Aster
message: >-
If you use this software, please cite it using the
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center"><img src="https://raw.githubusercontent.com/simvia-tech/vs-code-aster/main/media/images/simvia.png" alt="Simvia Logo" width="50%" /></p>

<p align="center">
<a href="/"><img src="https://img.shields.io/badge/version-1.5.3-blue" alt="Version" /></a>
<a href="/"><img src="https://img.shields.io/badge/version-1.5.4-blue" alt="Version" /></a>
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-GPL%203.0-green" alt="License" /></a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The extension aims to reduce friction between modeling, validation, execution, and analysis by bringing **code_aster** native workflows into the editor.

## Current Capabilities (v1.5.3)
## Current Capabilities (v1.5.4)

- `.export` file generator
- 3D mesh viewer
Expand Down
Binary file modified media/images/icone-code-aster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions media/images/icone-code-aster.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions media/images/icone-export-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions media/images/icone-export-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions media/images/icone-med-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions media/images/icone-med-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

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

47 changes: 44 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vs-code-aster",
"displayName": "VS Code Aster",
"version": "1.5.3",
"version": "1.5.4",
"description": "VS Code extension for code_aster",
"publisher": "simvia",
"license": "GPL-3.0",
Expand Down Expand Up @@ -78,10 +78,38 @@
".com9"
],
"icon": {
"light": "./media/images/icone-code-aster.png",
"dark": "./media/images/icone-code-aster.png"
"light": "./media/images/icone-code-aster.svg",
"dark": "./media/images/icone-code-aster.svg"
},
"configuration": "./language-configuration.json"
},
{
"id": "export",
"aliases": [
"Aster Export"
],
"extensions": [
".export"
],
"icon": {
"light": "./media/images/icone-export-light.svg",
"dark": "./media/images/icone-export-dark.svg"
}
},
{
"id": "med",
"aliases": [
"MED"
],
"extensions": [
".med",
".mmed",
".rmed"
],
"icon": {
"light": "./media/images/icone-med-light.svg",
"dark": "./media/images/icone-med-dark.svg"
}
}
],
"grammars": [
Expand Down Expand Up @@ -143,6 +171,19 @@
],
"markdownDescription": "Specifies the file extensions to be recognized as Code Aster command files. Default includes `.comm`, `.com`, and `.com0`-`.com9`. You can customize this list as needed."
},
"vs-code-aster.medFileExtensions": {
"order": 0,
"type": "array",
"items": {
"type": "string"
},
"default": [
".med",
".mmed",
".rmed"
],
"markdownDescription": "Specifies the file extensions to be recognized as MED mesh/result files. code_aster may also write MED data under numeric extensions matching the I/O unit (e.g. `.21`, `.71`). Add such extensions here to apply the MED icon and language association. Extensions listed here are automatically written to `files.associations`."
},
"vs-code-aster.aliasForRun": {
"order": 1,
"type": "string",
Expand Down
71 changes: 71 additions & 0 deletions src/MedLanguageSync.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
* Keeps `files.associations` in sync with the `vs-code-aster.medFileExtensions` setting.
*
* VS Code's `contributes.languages[].extensions` is static (read once from package.json at
* load time). To let users dynamically map arbitrary extensions (e.g. `.71`, `.72`) to the
* `med` language — which gives them the MED icon and language ID — we programmatically
* write `files.associations` entries on activation and whenever the setting changes.
*
* Ownership tracking: we only ever touch `files.associations` entries whose value is `med`.
* Other entries (added by the user or other extensions) are left untouched.
*/
import * as vscode from 'vscode';

const MED_LANGUAGE_ID = 'med';
const SETTING_KEY = 'medFileExtensions';

function normalizeExtension(ext: string): string | null {
const trimmed = ext.trim();
if (!trimmed) {
return null;
}
const withDot = trimmed.startsWith('.') ? trimmed : `.${trimmed}`;
return withDot.toLowerCase();
}

async function syncAssociations(): Promise<void> {
const asterConfig = vscode.workspace.getConfiguration('vs-code-aster');
const raw = asterConfig.get<string[]>(SETTING_KEY, ['.med', '.mmed', '.rmed']);

const desiredPatterns = new Set(
raw
.map(normalizeExtension)
.filter((e): e is string => e !== null)
.map((ext) => `*${ext}`)
);

const filesConfig = vscode.workspace.getConfiguration('files');
const current = filesConfig.get<Record<string, string>>('associations') ?? {};
const next: Record<string, string> = {};

for (const [pattern, language] of Object.entries(current)) {
if (language === MED_LANGUAGE_ID) {
continue;
}
next[pattern] = language;
}

for (const pattern of desiredPatterns) {
next[pattern] = MED_LANGUAGE_ID;
}

const before = JSON.stringify(current);
const after = JSON.stringify(next);
if (before === after) {
return;
}

await filesConfig.update('associations', next, vscode.ConfigurationTarget.Global);
}

export function activateMedLanguageSync(context: vscode.ExtensionContext): void {
void syncAssociations();

const listener = vscode.workspace.onDidChangeConfiguration((event) => {
if (event.affectsConfiguration(`vs-code-aster.${SETTING_KEY}`)) {
void syncAssociations();
}
});

context.subscriptions.push(listener);
}
3 changes: 3 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ExportEditor } from './ExportEditor';
import { RunAster } from './RunAster';
import { LspServer } from './LspServer';
import { StatusBar } from './StatusBar';
import { activateMedLanguageSync } from './MedLanguageSync';
import { setTelemetryContext } from './telemetry';

/**
Expand Down Expand Up @@ -39,6 +40,8 @@ export async function activate(context: vscode.ExtensionContext) {

StatusBar.instance.activate(context);

activateMedLanguageSync(context);

context.subscriptions.push(runaster);
context.subscriptions.push(createExportDoc);
context.subscriptions.push(createMesh);
Expand Down
Loading