rvi

A small tool to let you write rust with rust-analyzer not using cargo.

[package]
name = "test"
version = "0.1.0"
edition = "2021"

[lib]
path= "test.rs"

[dependencies]
..

Install

Download from release page

OR

shell cargo install rvi

Configure

1.Copy rvi.toml into $HOME/.config/, you can edit it according to your actual environment.

2.If you use Youcompleteme, you must fill the ycm_extra_conf field in above file, the configfile is like .ycm_extra_conf.py.example, you should place it in your directory and rename it to .ycm_extra_conf.py. The tool will copy it to your projectdir automatically.

3.If you do not use Youcompleteme, you should transfer the rust-analyzer.checkOnSave.overrideCommand configuration item to rust-analyzer lsp as your client explain. The following is official description:

Note that calls to cargo check are disabled when using rust-project.json by default, so compilation errors and warnings will no longer be sent to your LSP client. To enable these compilation errors you will need to specify explicitly what command rust-analyzer should run to perform the checks using the checkOnSave.overrideCommand configuration. As an example, the following configuration explicitly sets cargo check as the checkOnSave command.

```json

{ "rust-analyzer.checkOnSave.overrideCommand": ["cargo", "check", "--message-format=json"] }

```

The checkOnSave.overrideCommand requires the command specified to output json error messages for rust-analyzer to consume. The --message-format=json flag does this for cargo check so whichever command you use must also output errors in this format. See the Configuration section for more information.

Usage

rvi your_file.rs