Visual Studio-like configuration management for Rust?

Is there any way to get a Visual Studio-like pulldown configuration toggle in VSCode for Rust? Or are there any well-supported Rust IDEs that provide this functionality? There's an old Visual Studio plugin for Rust but I've never gotten it to work as well as the VSCode plugins.

Something like:
image

Specifically, I'd like to be able to switch between configs for #[cfg] blocks. Right now I have very little control over which blocks are active and which are grayed out. I have some mutually exclusive #[cfg] blocks so I can't have a single build configuration that enables them all, and so I'd like to be able to switch between them quickly to iterate on code.

IntelliJ-Rust allows creating many run configurations with any cargo arguments and quickly switch between them using the dropdown menu:

image

https://plugins.jetbrains.com/plugin/8182-rust/docs/rust-run-targets.html


UPD: if you were talking about enabling-disabling features to affect the IDE's code analysis, you can do this using gutter icons in the Cargo.toml file:

/api/webhelp/8182/a28c1c4a-2266-44b8-8016-645c09544732/img/rust_cargofeatures_toggle.png

https://plugins.jetbrains.com/plugin/8182-rust/docs/code-assistance-in-toml.html#enabling-and-disabling-features

2 Likes

Is there anything like that to enable/disable feature functionality for other #[cfg] options? One of the things I'm trying to find support for is custom config conditionals and controlling when blocks are active/grayed based on those.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.