MetaModelica Language ServerA very early version of a MetaModelica Language Server based on OpenModelica/tree-sitter-metamodelica. For syntax highlighting install extension AnHeuermann.metamodelica in addition. FunctionalityThis Language Server works for MetaModelica files. It has the following language features:
CLI (
|
| Argument / option | Description |
|---|---|
<paths...> |
Files or directories to process. Directories are scanned recursively for .mo files. |
--fix |
Apply quick-fixes in-place and save the modified files. Without this flag the tool only reports issues and exits with 1. |
--check <name> |
Limit processing to a specific check (repeatable). When omitted all checks run. See Supported quick-fixes for available names. |
--jobs N |
Process files in parallel using N worker threads (default: number of CPU cores; pass 1 to disable). |
--help |
Print usage information. |
Example
Report all issues in a source tree:
mmlsc src/
Apply quick-fixes for all detected issues:
mmlsc --fix src/
Apply only the unused-variable fix:
mmlsc --fix --check unused-var src/
When installed globally (npm install -g . from the repository root after
building), the tool is available as mmlsc.
Supported quick-fixes
| Check name | Diagnostic | Fix |
|---|---|---|
unused-var |
Unused variable in a protected section or local block |
Remove the variable declaration |
unused-match-arg |
Unused match/matchcontinue argument (pattern is _ in every case) |
Remove the argument from the input tuple and all case patterns |
unused-case-binding |
Unused binding in a case pattern — the bound identifier is never read in the case body |
Replace the binding with _ |
unused-silenced-output |
Unnecessary output silencing (_ := expr) — the _ := prefix can be omitted |
Remove the _ := prefix, keeping only the expression |
wildcard-match |
Wildcard before match/matchcontinue (_ := match …) — _ silently discards any return value; () is preferred because the compiler will error if a branch returns a non-unit value, catching accidental discards |
Replace _ with () |
dead-silenced-assign |
Dead assignment _ := variable; where the RHS is a plain variable (no side effect) |
Drop the entire statement |
redundant-parens |
Single-element parentheses in a match input, case pattern, or assignment LHS |
Unwrap the parentheses |
wildcard-tuple |
All-wildcard tuple pattern (_, _, _) nested inside a case pattern — every element is already a wildcard |
Collapse to a single _ |
Installation
Via Marketplace
Via VSIX File
Download the latest metamodelica-language-server-0.3.0.vsix from the releases page.
Check the VS Code documentation
on how to install a .vsix file.
Use the Install from VSIX command or run
code --install-extension metamodelica-language-server-0.3.0.vsix
Contributing ❤️
Contributions are very welcome!
We made the first tiny step but need help to add more features and refine the language server.
If you are searching for a good point to start check the good first issue. To see where the development is heading to check the Projects section. If you need more information start a discussion over at OpenModelica/OpenModelica.
Found a bug or having issues? Open a new issue.
Build
Dependencies
- Node.js >= 22
Quick install
npm install
npm run esbuild
VS Code
- Open VS Code on this folder.
- Press
Ctrl+Shift+Bto start compiling the client and server. - Switch to the Run and Debug View in the Sidebar (
Ctrl+Shift+D). - Select
Launch Clientfrom the drop down (if it is not already). - Press ▷ to run the launch config (
F5). - Both build task and launch are available in watch mode
- In the Extension Development
Host
instance of VSCode, open a document in
'metamodelica'language mode.- Check the console output of
MetaModelica Language Serverto see the parsed tree of the opened file.
- Check the console output of
Testing
The test suite runs inside a VS Code instance (via @vscode/test-electron) and requires a display. It also exercises the GDB adapter, so gdb and omc must be on PATH.
Prerequisites
- Node.js >= 22
gdbomc(OpenModelica Compiler)- A display server — on a headless machine use
xvfb
Running the tests
Build the extension first, then run the suite:
npm install
npm run esbuild
npm test
On a headless machine (e.g. WSL2 without WSLg, or a CI server) provide a
virtual display with xvfb-run:
sudo apt-get install -y xvfb gdb
xvfb-run -a npm test
This is equivalent to what the CI workflow does.
Build and Install Extension
npx vsce package
License
metamodelica-language-server is licensed under the OSMC Public License v1.8, see License.txt.
3rd Party Licenses
This extension is based on https://github.com/microsoft/vscode-extension-samples/tree/main/lsp-sample, licensed under MIT license.
Some parts of the source code are taken from bash-lsp/bash-language-server, licensed under the MIT license and adapted to the MetaModelica language server.
The debugger is based on microsoft/vscode-mock-debug licensed under MIT.
OpenModelica/tree-sitter-metamodelica is included in this extension and is licensed under the OSMC-PL v1.8.
Acknowledgments
This package was initially developed by Hochschule Bielefeld - University of Applied Sciences and Arts.

