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/swim -
Install some additional tools1 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/swim -
Install some additional tools1 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 a variety of third-party plugins integrating Spade with different editors. For in-editor error messages and things like go to definition, you have to install the spade language server. You can do this by running:
cargo install --git https://gitlab.com/spade-lang/spade spade-language-server
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.
Otherwise, you can use spade-vim, following the instructions at that repository for manual setup.
Vscode
Install the plugin from the Marketplace.
Helix
The Helix Editor supports Spade out of the box.
Zed
The Zed Editor supports Spade via this extension.
Emacs
There is an Emacs Mode for Spade.
Other Editors
Made a plugin for your favorite editor? Submit a merge request to add it to this list!
- 1The OSS CAD Suite which needs about 2.5 GB of disk space.