A VS Code extension providing support for Creusot, a deductive verifier for Rust code.
This project is work in progress. An official release is upcoming.
Creusot IDE helps you nagivate between your Rust sources and the verification artifacts generated by Creusot and Why3find.
- Run and inspect proofs from within the editor.
- Functions with proof obligations will have a button in the gutter to their left.
Click to run the prover (
why3find prove). Alt+click to start Why3 IDE (only if the prover fails).
- Functions with proof obligations will have a button in the gutter to their left.
Click to run the prover (
- Diagnostics underline locations with failed proofs
- Syntax highlighting:
.rsfiles: Creusot-specific attributes and Pearlite expressions,.comafiles.
Creusot itself should be installed separately.
Creusot IDE consists of two parts:
-
The Creusot IDE extension, installed via VS Code: open VS Code > Extensions > Search "Creusot IDE".
-
The Creusot LSP language server, which must currently be installed separately:
-
First, install Creusot, Why3, and Why3find; see https://github.com/creusot-rs/creusot for instructions
-
git clone https://github.com/creusot-rs/creusot-ide -
The installation location is the Creusot-local switch, which depends on your OS.
Be at the root of the
creusot-idedirectory, where thecreusot-lsp.opamfile is located:cd creusot-ideOn Linux:
opam pin --switch=~/.local/share/creusot creusot-lsp . -yOn MacOS:
opam pin --switch=~/.creusot creusot-lsp . -y
-
At the moment, installing creusot-lsp in another switch or without opam altogether is not supported.
-
Rust analyzer doesn't know how to parse Creusot specifications (attributes such as
ensures, etc.), so they are underlined in red.Add this option in
settings.jsonto run Creusot for checks instead:"rust-analyzer.check.overrideCommand": [ "cargo", "creusot", "--", "--message-format=json" ] -
Rust analyzer overrides Creusot IDE's syntax highlighting by emitting semantic tokens inside attributes and macros.
Disable semantic tokens: Settings (
Ctrl+P› Preferences: Open Settings (UI)) › Editor › Semantic Highlighting: Enabled › false
Available in the command palette (Ctrl+P):
- Restart language server
- Stop language server
-
creusot.lspPath: Path to thecreusot-lspexecutable. Default:"", finding the executable in Creusot's Opam switch. -
creusot.home,creusot.dataHome,creusot.configHome: Override the environment variablesHOME,XDG_DATA_HOME, andXDG_CONFIG_HOMEwhen invoking Creusot. This allows running Creusot from VS Code and other applications installed via Ubuntu Snap, which sets those variables to some custom directories, breaking Creusot. On Linux you probably want to set these paths:creusot.home:/home/$USER(where$USERis your user name)creusot.dataHome:/home/$USER/.local/share(there should be acreusotdirectory at this location)creusot.configHome:/home/$USER/.config(there should be acreusotdirectory at this location)
To build and install the VS Code extension from source:
npx vsce package
Then, in VS Code: Command Palette > Install from VSIX. Select the creusot-ide-X.Y.Z.vsix file created by the previous command.