Installing Spade
So far, the code we have written has been simple enough that it can all be written in the playground. But as we move on to more advanced language features and bigger projects, it is time to install Spade and its build system called Swim, and to set up your editor.
Shown here is the recommended way to install Spade, but there are a some other options available if you have specific needs.
Linux
First, if you don’t have Rust installed already, install it via the rustup installer by simply running:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shand accepting the default options when prompted.
Restart your terminal to get access to the new binaries this installed.
If you are on a fresh Linux or WSL install, you have to install a few packages for the next step:
sudo apt install build-essential libssl-dev pkg-config git(Or equivalent packages on the distribution of your choice.)
Install the Spade build tool called
swimwith:cargo install --git https://gitlab.com/spade-lang/swimInstall some additional tools 1 that Swim needs with:
swim install-tools
Mac OS
First, if you don’t have Rust installed already, install it via the rustup installer by simply running:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shand accepting the default options when prompted.
Restart your terminal to get access to the new binaries this installed.
Install the Spade build tool called
swimwith:cargo install --git https://gitlab.com/spade-lang/swimInstall some additional tools that Swim needs with:
swim install-tools
Windows
The Swim build tool currently does not natively support Windows, so you have to do the rest of the tutorial inside the Windows Subsystem for Linux (WSL). If you have not installed it yet, do so by following the instructions.
Once done, open a WSL shell by just typing wsl in cmd, and then follow the Linux instructions above.
Set Up Your Editor
There are plugins for syntax highlighting and language server support like go to definition, inline-errors, and basic completion.
Official Support
We provide official plugins for Visual Studio Code, Helix, and Zed, which means that these editors will usually have up to date syntax highlighting and working LSPs.
Vscode
Install the plugin from the Marketplace.
Helix
The latest git version of helix Helix Editor supports modern Spade out of the box.
The latest release (currently 25.07.1) has some support for Spade, but it is missing some updated grammar definitions and is using an older LSP system. If you use this or another older version, you can add the following to ~/.config/helix/languages.toml (or the equivalent config directory on your OS)
[language-server.spade-language-server]
command = "swim"
args = ["lsp"]This will fix the LSP, but the grammar will still be outdated leading to non-perfect syntax highlighting. Fixing this requires a bit more effort. First, you need up-to-date Spade grammars, copy them from upstream helix https://github.com/helix-editor/helix/tree/master/runtime/queries/spade and add them to your runtime queries directory (https://docs.helix-editor.com/guides/adding_languages.html). Then modify the languages.toml again to add
[[grammar]]
name = "spade"
source = { git = "https://codeberg.org/spade-lang/tree-sitter-spade", rev = "<latest revision>" }where <latest revision> is the rev present in the Helix git repo https://github.com/helix-editor/helix/blob/master/languages.toml#L4733
Zed
The Zed Editor supports Spade via this extension.
Community Plugins
In addition to the officially supported editors, there are a few community maintained plugins for other editors. As they are community maintained, they may not be as quick at supporting new language features. If you write a plugin for your favourite editor, feel free to add it to this list
Vim / NeoVim
If you use Neovim, you can install spade.nvim, which is maintained by Ethan at that GitHub repository. This plugin sets up syntax highlighting and the language server automatically, along with some other quality-of-life features.
Emacs
There is an Emacs Mode for Spade.
- The OSS CAD Suite which needs about 2.5 GB of disk space. ↩︎