A very early version of a Modelica Language Server based on OpenModelica/tree-sitter-modelica.
For syntax highlighting install enxtension AnHeuermann.metamodelica in addition.
This Language Server works for Modelica files. It has the following language features:
To make the language server aware of libraries outside your workspace (such as
the Modelica Standard Library), add their root directories to
modelica.libraries in your VS Code settings.
Workspace settings (.vscode/settings.json):
{
"modelica.libraries": [
"/path/to/Modelica 4.0.0+maint.om"
]
}User settings (via File → Preferences → Settings, search for
modelica.libraries): click Add Item and enter the path to each library
root directory — the folder that contains a package.mo file.
Typical paths:
| Platform | Default OpenModelica library location |
|---|---|
| Linux | ~/.openmodelica/libraries/ |
| Windows | %APPDATA%\OpenModelica\libraries\ |
| macOS | ~/.openmodelica/libraries/ |
The server loads all configured libraries at startup. Changes take effect after reloading the VS Code window (Developer: Reload Window).
Download the latest modelica-language-server-0.2.2.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 modelica-language-server-0.2.2.vsixContributions 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.
.
├── client // Language Client
│ ├── src
│ │ ├── test // End to End tests for Language Client / Server
│ │ └── extension.ts // Language Client entry point
├── package.json // The extension manifest.
└── server // Modelica Language Server
└── src
└── server.ts // Language Server entry point- Run
npm installandnpm run postinstallin this folder.This installs all necessary npm modules in both the client and server folder - Open VS Code on this folder.
- Press Ctrl+Shift+B to start compiling the client and server in watch mode.
- 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).
- In the Extension Development Host
instance of VSCode, open a document in 'modelica' language mode.
- Check the console output of
Language Server Modelicato see the parsed tree of the opened file.
- Check the console output of
npx vsce packagemodelica-language-server is licensed under the OSMC Public License v1.8, see OSMC-License.txt.
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 Modelica language server.
OpenModelica/tree-sitter-modelica v0.2.0 is included in this extension and is licensed under the OSMC-PL v1.8.
This package was initially developed by Hochschule Bielefeld - University of Applied Sciences and Arts.

