The following configuration integrates Creusot with rust-analyzer, enabling these features:
- Typecheck Pearlite code (contracts, etc.) on save (see
check.overrideCommandbelow). - Go-to-definition in Pearlite (see
cargo.extraEnvbelow).
For VS Code users, you can write the following settings
in the .vscode/settings.json file at the root of your project:
{
"rust-analyzer.check.overrideCommand": [
"cargo",
"creusot",
"--only=coma",
"--",
"--message-format=json"
],
"rust-analyzer.cargo.extraEnv": {
"RUSTUP_TOOLCHAIN": "nightly-2026-08-03",
"RUSTFLAGS": "--cfg creusot --cfg feature=\"creusot\""
}
}
Important
The
cargo.extraEnventry assumes that you are using rustup to manage your Rust installation. In particular, this does not work for Nix users.The
RUSTUP_TOOLCHAINentry should contain the nightly toolchain used by Creusot. It is shown by the commandcargo creusot version.
For other editors, see https://rust-analyzer.github.io/book/other_editors.html to add the above option to your configuration.
Note that you will probably want to enable this option only in projects that use creusot.