Skip to content

AnHeuermann/metamodelica-language-vscode

Repository files navigation

Modelica, Base Modelica, MetaModelica, Susan and MOS Scripting in Visual Studio Code

CI

This extension adds support for the following Modelica and OpenModelica related languages to Visual Studio Code:

Features

Syntax Highlighting

Modelica Language: Modelica

Base Modelica Language: Base Modelica

MetaModelica language used by OpenModelica: MetaModelica

Susan template language used by OpenModelica: Susan

OpenModelica scripting language used by OpenModelica's *.mos files: OpenModelica Scripting

Snippets

snippets-editor

snippets-command-palette

Usage

Install the extension in VS Code

  • Download the VS Code extension file.
  • Open the command palette using Ctrl+Shift+P or F1.
  • Type extensions: Install from VSIX... in the command palette.
  • Browse to downloaded *.vsix file.

Select MetaModelica as a language

  • On the bottom-right corner, click on the select language mode button, if you have created a new file it should display Plain Text.
  • Select MetaModelica or Susan or Modelica in the list of languages.

Alternatively, saving the file with a .mo extension will allow VS Code to understand that it is a MetaModelica file and automatically select the language. If it is a Modelica file one has to manually change the language mode to Modelica. The .mop extension will be associated with the Optimica language respectively. The .tpl extension will be associated with Susan Template language. Additional extensions can be connected to the languages in any settings.json file using the "files.associations" setting.

Using snippets

Just start to type and choose a snippet that may be proposed. Alternatively, use Ctrl+Shift+P to open the command palette and type Insert Snippet to see a list of all possible snippets to choose from.

Development

There is a dev container available to build and publish the extension. See publishing-extension for more details on the publishing process.

Dependencies

  • Node.js
  • VSCode
  • sh (or translate yaml2json.sh to your shell equivalent)

Build

npm install

Translate the *.tmGrammar.yaml files to *.tmGrammar.json JSON files. Start build task (Ctrl+Shift+B)

npm run prebuild

Test

Run the tmGrammer tests task:

  • Open Command Palette (Ctrl+Shift+P)
  • Type tasks: Run task
  • Choose tmGrammer tests

or run it manually:

npm run test

Build Package

Generate .vsix package file:

npm run build

Publish package

Visual Studio Marketplace

npx vsce login <publisher name>
npx vsce publish

Open VSX

npx ovsx publish metamodelica-<version>.vsix -p <token>

Acknowledgement

This extension is based on the Modelica extension SimplyDanny/modelica-language-vscode.

About

Extension for Visual Studio Code that adds language support for Modelica, Base Modelica, MetaModelica and Susan.

Topics

Resources

License

Stars

Watchers

Forks

Contributors