- The fantastic language support is provided by the rls
- The blazing-fast workspace search is powered by ripgrep
Rust Version
Gitpod always comes with the latest available Rust toolchain pre-installed using rustup. (As of this writing, the Rust version is1.68.1
.
You can also use rustup
yourself in Gitpod in order to switch to a different Rust version, or to install extra components. See the rustup book to learn more about rustup
itself.
Note: If you try to use rustup
in your repository’s .gitpod.Dockerfile, you might get the following error:
rustup
command in a login Bash shell, like so:
rustup-toolchain
file in the root of your repository. Say for example you need the nightly compiler for March 4th, 2020, you would create a rustup-toolchain
file and add the following
Example Repositories
Here are a few Rust example projects that are already automated with Gitpod:Repository | Description | Try it |
---|---|---|
template-rust-cli | Rust CLI template |
VS Code Extensions
The most popular Rust VS Code extensions are already pre-installed in Gitpod. But here are a few “nice to have” extensions you may choose to install as well. In order to install one of these extensions for your repository, simply head to Gitpod’s Extensions panel (find it in the IDE’s left vertical menu), then search for the desired extension by name, and install it for your project. This will add an entry to your .gitpod.yml file that ensures all future Gitpod workspaces for your repository will already have this extension pre-installed.Rust Test Explorer

The Rust Test Explorer makes it easy to run Rust tests.
Crates
Note: This extension outputs emojis by default if the crate version is set at the latest. You can disable this by usingThe VS Code extension Crates makes it easier to manage your Cargo dependency versions.crates.upToDateDecorator
option in your preferences >
Search Crates.io
Do you have an idea of a library you want to use but don’t know the version well just type in the name of the library and Search Crates.io will get the version.Better TOML

Cargo.toml
.
Cross-compiling with MUSL
To cross-compile with MUSL in Gitpod, you can:- Run
rustup target add x86_64-unknown-linux-musl
, for example in your .gitpod.Dockerfile - Then, build with
cargo build --target x86_64-unknown-linux-musl
Debugging
In this section we will show you how to configure your project for debugging in Gitpod. First, before we get to that we need to get some prerequisites set-up. First we’ll install the needed extension. If you haven’t already, head over to Gitpod’s Extensions panel (left vertical menu in the IDE) and search for an extension calledNative Debug
by webfreak. When you see it, click to install it for your project.
The next prerequisite is a Docker configuration.
If you already have a .gitpod.Dockerfile just add the following:
.gitpod.Dockerfile
with the following content:
- Go to the debug menu and select “Add Configuration…”
- Next, in the dropdown choose “GDB: Launch Program”
- Go to the
Cargo.toml
file and find the name of the program. - Modify the target field and change it to
${workspaceFolder}/target/debug/<PROGRAM_NAME>
where<PROGRAM_NAME>
is the name of the program under the name field in theCargo.toml
file. - Add another property to the created file called
preLaunchTask
and set it to “cargo” - Go to the terminal menu and click configure tasks
- Select cargo build from the menu that pops up
- change the tag
type
tocommand
- change the tag
subcommand
toargs
and the value to["build"]
- Next remove the
problemMatcher
field. - Add a field called
type
and set it toprocess
- Add a field called
label
and set it tocargo
- Go to the Rust file you want to debug
- Add a breakpoint or two
- Go back to the debug menu that has the crossed out spider
- Click the green run button.
- Finally, start debugging your Rust program!
.theia/
, and inside add a file called launch.json
, add the following to it:
.theia/
directory called tasks.json
with the following content:
To see a basic repository with Rust debugging configured, please check out gitpod-io/Gitpod-Rust-Debug:
Further Reading
- Rocket-Example For an example of how to setup a project for the
Rocket
web-development framework