Substrate for Visual Studio Code
Full-featured editor support for Substrate phylum development — the ELPS Lisp dialect used to write Hyperledger Fabric chaincode business logic.
Features
Syntax Highlighting
Rich TextMate grammar covering all ELPS forms plus substrate-specific extensions:
- Definitions:
defun, defmacro, deftype, defconst, lambda, let/let*
- Substrate endpoints:
defendpoint, defendpointnames
- Substrate builtins:
route-success, route-failure
- Qualified calls:
statedb:get, cc:warnf, sidedb:put, crypto:sha256, etc.
- Literals: strings, numbers, keywords, booleans, nil
Language Server (LSP)
Powered by shirotester lsp, which boots a full substrate runtime including all Go-registered builtins:
- Completions for
cc:*, statedb:*, sidedb:*, crypto:*, elpspath:*, connector:*, batch:*, and all ELPS standard library symbols
- Hover documentation for 500+ symbols
- Go to definition and find references
- Diagnostics (lint errors, undefined symbols, arity mismatches)
- Document symbols and workspace symbols
- Format on save via
elps fmt
Debugger (DAP)
Step-through debugging with shirotester debug:
- Breakpoints (line and conditional)
- Step in/over/out
- Variable inspection including statedb and private data collection scopes
- REPL via debug console
Installation
Install from the VS Code Marketplace.
The extension bundles the shirotester binary for macOS and Linux (x64 and arm64). No additional installation is required.
Using a custom binary
If you need a specific version of shirotester, set the path in your settings:
{
"substrate.path": "/path/to/shirotester"
}
The extension searches for the binary in this order:
substrate.path setting (if configured)
- Bundled binary (platform-specific package)
$GOBIN/shirotester
$GOPATH/bin/shirotester
~/go/bin/shirotester
~/.local/bin/shirotester
/usr/local/bin/shirotester
/opt/homebrew/bin/shirotester
shirotester on PATH
Settings
| Setting |
Default |
Description |
substrate.path |
shirotester |
Path to the shirotester binary |
substrate.lsp.enable |
true |
Enable the language server |
substrate.lsp.trace.server |
off |
Trace LSP communication (off, messages, verbose) |
Debug Configuration
Add to .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "substrate",
"request": "launch",
"name": "Debug Substrate",
"program": "${file}",
"stopOnEntry": true
}
]
}
Attach to a running DAP server
{
"type": "substrate",
"request": "attach",
"name": "Attach to Substrate",
"host": "localhost",
"port": 4711
}
Developing
Building and testing locally
# From the substrate repo root:
# Build shirotester into the extension's bin directory
go build -o editors/vscode/bin/shirotester ./cmd/shirotester
# Build the extension
cd editors/vscode
npm install
npm run build
# Run grammar tests
npm test
# Package a platform-specific vsix
npx vsce package --target darwin-arm64 --allow-missing-repository
Installing / uninstalling for local testing
# Install the locally-built vsix
code --install-extension substrate-darwin-arm64-0.1.0.vsix
# Uninstall
code --uninstall-extension luthersystems.substrate
# Verify
code --list-extensions | grep substrate
After installing, reload VS Code (Cmd+Shift+P → "Reload Window") to pick up the new extension.
Debugging a phylum
To use the substrate debugger, create .vscode/launch.json with "type": "substrate":
{
"version": "0.2.0",
"configurations": [
{
"type": "substrate",
"request": "launch",
"name": "Debug Substrate",
"program": "${file}",
"stopOnEntry": true
}
]
}
Without a launch.json, VS Code may prompt you to install the ELPS extension instead — the "type": "substrate" field tells VS Code to use this extension's debugger.
Cleanup test artifacts
rm -f substrate-*.vsix bin/shirotester
About Luther Systems
Our mission is to accelerate the advent of the automated enterprise. Founded by a team who spent years automating complex processes for some of the world's largest financial institutions, Luther Systems builds platforms that bring enterprise-grade infrastructure and operations to teams of every size.