This extension adds language support for PLAIN to VS Code and was developed as part of a research project at the Mannheim University of Applied Sciences (Hochschule Mannheim). The scope of this extension is to assist with writing PLAIN medical logical modules (MLMs) in VS Code by adding features like syntax highlighting.
- Download the VSIX package from the latest github release
- Install the extension manually in your local VS Code editor (in the Extensions menu, choose "Install from VSIX")
- Open or create any
*.mlm(x)
file to activate the extension. Language Mode "PLAIN" should be active in your VS Code Editor (lower right corner).
Note
This extension is considered experimental and not yet available on the VS Code Extensions Marketplace. Use at your own risk.
PLAIN (Programming Language, Arden INspired) is an experimental, domain-specific language primarily used for the design of clinical algorithms. It is based on the Arden Syntax 2.8 and was first proposed in "Generalizing the Arden Syntax to a Common Clinical Application Language, S. Kraus, University Erlangen-Nürnberg" (2018, also in 2018, 2019, 2020). For more details on the language features, see the official PLAIN homepage and documentation (http only).
The extension features a client-side implementation to provide the basic language support and a internal server-side implementation using the language server protocol (LSP) to make use of the advanced VS Code language support features, e.g. the built in support for HTML and CSS syntax checking and autocompletion. For a list of changes, see CHANGELOG.
- Associates medical logical module (*mlm) files with PLAIN and cached files (.mlmx) with JSON
- Themed syntax highlighting for all known PLAIN keywords
- Auto bracket-matching, indentation and folding of basic keywords
- Insertable code snippets (macros) for commonly used PLAIN statements (using
Ctrl+Space
)
- Provides support for HTML, CSS and JavaScript by integrating the existing VS Code grammars
- Enables syntax highlighting for said languages embedded in PLAIN strings
- Utilization of syntax error checking and autocompletion features
Apart from some minor improvements, there are currently no new major features planned. Please Star the Repo in case you want to get noticed on future updates.
To start developing, you'll need the latest Visual Studio Code release and Node npm. The PLAIN language configuration and grammars can be found in the client
directory, the language support server for utilizing advanced programmatic language features in the server
directory, respectively. Major extension contributions and configuration can be found in the package.json
. The LSP server features are written using TypeScript (ES2022). Running the extension requires the npm packages to be installed (which is done automatically with the 'vscode:prepublish' step).
To edit the existing plain language grammar, edit the file syntaxes/plain.tmLanguage.yaml
. This configuration file uses a TextMate like syntax. Regular expressions are based on the "ruby-style" Oniguruma dialect by K. Kosako. Configuration is kept in YAML for better readability and needs to be parsed to JSON when changes are made. This can be done e.g. using js-yaml
(see scripts
section within package.json
).
You can explore and debug the syntax highlighting behaviour and TextMate scopes using the VS Code Scope Inspector Tool: Ctrl+Alt+Shift+i
Building this extension in a development environment is supported natively within VS Code via 'Run and Debug' (F5). Building and publishing the extension into a file is possible using the tool vsce
. The required commands are defined in the scripts
section within package.json
.
- PLAIN homepage and documentation (http only)
- Visual Studio Code Extension API Documentation
- TextMate Documentation - Language Grammars & Rules
- Writing a TextMate Grammar: Some Lessons Learned
- Rubular - a Ruby regular expression editor
This extension is built upon the publicly available vscode-extension-samples provided by (c) Microsoft Corporation and therefore released unter the MIT License. You can contact the author via github.