VS Code language support for MeVisLab MDL files, including syntax highlighting for core MDL structures and validator-derived keywords.
- MDL-related file extensions:
.def.script.mdl.mlab
- Single-line comments (
// ...) - Multi-line comments (
/* ... */) - String forms:
"...""* ... *"@@ ... @@
- Syntax categories generated from
MDLValidation.def:- Block/group keywords (for example
MacroModule,Window,Interface) - Property/tag names (for example
title,dependsOn,allowChild) - Enum literals (for example
stable,deprecated,Top) - MDL preprocessor-like directives (
#include,#ifset,#ifnset)
- Block/group keywords (for example
If you already have a .vsix package, install it with:
code --install-extension .\mdl-0.0.2.vsix --forceFrom this repository root:
npm install
npx @vscode/vsce package
code --install-extension .\mdl-0.0.2.vsix --force- Install dependencies:
npm install- Open this folder in VS Code.
- Press
F5in VS Code to launch an Extension Development Host. - Open a
.defor.scriptfile in the dev host and verify highlighting.
NOTE: The MDLValidation.def file is not included in this repository. You must obtain it from your MeVisLab installation or development environment (it is located at MeVisLab/Modules/MDL/MDLValidation.def in a typical installation).
The grammar is generated/updated by:
- Script:
scripts/update-mdl-language-config.js - Output grammar:
syntaxes/mdl.tmLanguage.json
npm run update-language-config -- "C:/path/to/MDLValidation.def"Optional second argument for custom grammar output path:
node scripts/update-mdl-language-config.js "C:/path/to/MDLValidation.def" "./syntaxes/mdl.tmLanguage.json"- Parses
Group,allow, andallowChilddeclarations for block keyword candidates. - Parses assignment keys (
key = value) for property keyword candidates. - Parses enum
values = "..."literals for enum keyword candidates. - Rewrites repository sections in the grammar (
blockKeywords,propertyKeywords,enumLiterals,directives). - Writes metadata under
generatedFromwith source path, generation timestamp, and keyword counts.
- Run the updater against the desired
MDLValidation.def. - Review grammar changes in
syntaxes/mdl.tmLanguage.json. - Run tests.
- Validate visually in VS Code with representative
.defand.scriptfiles. - Commit both updater and grammar changes together.
Run all tests:
npm testCurrent updater tests include:
- Parser behavior (block/property/enum extraction)
- Grammar patching behavior
- CLI integration behavior with temporary files
Test file location:
test/update-mdl-language-config.test.js
package.json: Extension manifest and npm scriptslanguage-configuration.json: Brackets, comments, and auto-closing pairssyntaxes/mdl.tmLanguage.json: TextMate grammar used for highlightingscripts/update-mdl-language-config.js: Grammar updater from validator inputtest/update-mdl-language-config.test.js: Updater test suiteCHANGELOG.md: Version history
npx @vscode/vsce packageThis creates a .vsix package in the repository root.
- No highlighting updates after grammar changes:
- Reload VS Code window (
Developer: Reload Window). - Ensure the correct extension instance is installed (local VSIX vs published).
- Reload VS Code window (
- Updater reports missing file:
- Verify the full path to
MDLValidation.def.
- Verify the full path to
- Tests fail unexpectedly:
- Reinstall dependencies with
npm install. - Re-run
npm testand inspect failing case output.
- Reinstall dependencies with
- The repository currently has no license file;
vscewill warn during packaging. - See
vsc-extension-quickstart.mdfor baseline VS Code extension development notes.