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
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
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
./run.sh # executes the server, the console will show all communication
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,