SOMns Language Server and VS Code extension
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a VS code extension for the SOMns research language. The extension provides support for:

  • syntax highlighting
  • parse errors
  • code navigation
  • code completion
  • basic linting
  • CodeLens for running minitests
  • and debugging of SOMns programs

Screenshot of SOMns Syntax Highlighting

Screenshot of SOMns syntax highlighting

Screencast of debugging a SOMns Program

Screencast of SOMns debug session

Development Setup

To work on the extension, you can build it with the following commands:

npm install .
npm run compile

When working on the extension, it is better to not install it via the Marketplace, but link the code repo directly into the VS Code extension directory. Please replace $pathToCheckout in the following with the actual path to your checkout:

cd ~/.vscode/extensions
ln -s /$pathToCheckout/SOMns-vscode SOMns-vscode

This extension is based on the Language Server Protocol to connect to a SOMns language server, which provides the IDE capabilities.

Once the setup is completed with the instructions above, you can work on it. To for instance debug it, open the main folder in VS code, for instance with code .. Now, you can run the extension from the debug menu.

Because of current restrictions in VS Code, the same project cannot be opened twice, and it is not possible to debug the debugger and the language server at the same time. As a work around, one can use a separate folder with symlinks:

.vscode -> ../SOMns-vscode/.vscode
out -> ../SOMns-vscode/out
package.json -> ../SOMns-vscode/package.json
src -> ../SOMns-vscode/src
syntaxes -> ../SOMns-vscode/syntaxes
tsconfig.json -> ../SOMns-vscode/tsconfig.json
typings -> ../SOMns-vscode/typings
typings.json -> ../SOMns-vscode/typings.json

Debugging the Language Server in Java

When working on the Language Server, which provides the IDE services, it is best to start it for instance from Eclipse.

To instruct VS code to use an already running instance of the language server, add the following to your VS Code User Settings:

"somns.debugMode" : true

The server can also be started from the command line:

cd /$pathToCheckout/SOMns-vscode/server
./ # executes the server, the console will show all communication

Debugging the Debugger Adapter

To debug the Debugger Adapter, load the code in VS code, and select "Run Debugger as server" in the debugger menu.

In the configuration of the VS Code instance with the SOM code, add a configuration that executes a SOM program, and add the debugServer port as part of the configuration. This needs to be inside the config, i.e., for instance next to the "program" setting.

  "debugServer": 4711,