Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installing Spade

So far, the 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 swim, and to set up your editor.

Here is the recommended way to install, but there are a few other options available if you have specific needs

Linux

  • First, if you don’t have Rust installed already, install it by running

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

    and 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 the equivalent packages on your distro of choice)

  • Install the Spade build tool called swim with

    cargo install --git https://gitlab.com/spade-lang/swim
  • Install some additional tools that Swim needs with

    swim install-tools

macos

  • First, if you don’t have Rust installed already, install it by running

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Restart your terminal to get access to the new binaries this installed

  • Install the Spade build tool called swim with

    cargo install --git https://gitlab.com/spade-lang/swim
  • Install 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 at https://learn.microsoft.com/en-us/windows/wsl/install

Once done, open a WSL shell by just typing wsl in cmd, and then follow the Linux instructions above

Set Up Your Editor

You probably also want to set up your editor with a plugin for syntax highlighting:

There are a variety of third-party plugins integrating Spade in different editors. For in-editor error messages and things like go to definition, you have to install the language server

cargo install --git https://gitlab.com/spade-lang/spade spade-language-server 

Vim

If you use Neovim, you can use spade.nvim, which is maintained by Ethan at that GitHub repository. This plugin sets up syntax highlighting and LSP automatically along with some other quality-of-life features.

Otherwise, you can use https://gitlab.com/spade-lang/spade-vim, following the instructions at that repository for manual setup.

Vscode

Helix

Helix supports Spade out of the box.

Zed

Emacs

Other Editors

Made a plugin for your favorite editor? Submit a merge request to add it to this list!