cargo-fuzz icon indicating copy to clipboard operation
cargo-fuzz copied to clipboard

Vscode / Visual Studio tips for Rust Analyzer with cargo fuzz

Open cameronelliott opened this issue 2 years ago • 2 comments

Hey, thanks contributors for making and maintaining this awesome project!

I had an issue with vscode where editing files inside ProjectZ/fuzz/fuzz_targets/targetX.rs wasn't working with or providing me any Rust Analyzer feedback. At least when I would open the ProjectZ folder inside vscode. I would get Rust Analyzer support when opening the fuzz folder, but that seemed to me as a less than ideal workaround. I wanted to open the ProjectZ folder and work on both my project and my fuzz_targets.

It turns out there is a solution by editing this into the end of my vscode settings.json, I get Rust Analyzer support for both my parent project, and inside the fuzz/fuzz_targets folder.

    "rust-analyzer.linkedProjects": [
        "Cargo.toml",
        "fuzz/Cargo.toml"
    ]
}

At the moment I have that in my vscode user settings, and from a quick test, that global setting seems to work fine with Rust projects without a fuzz folder. You might want to put it in your vscode workspace settings if you want to control this on a project by project basis.

cameronelliott avatar Dec 24 '23 01:12 cameronelliott

I wrote this to help future users. It can be closed. I will file a report at the book in case it should be added there.

cameronelliott avatar Dec 24 '23 01:12 cameronelliott