Enable/disabling a single Cargo Feature #35047
Replies: 3 comments
-
|
To be explicit, your request is for the ability to manipulate Cargo.toml features which change rust-analyzer behavior via checkbox? I don't quite understand... is your actual request to ignore features specified in cargo.toml and allow some mechanism to implicitly reconfigure cargo features based on checkboxes overriding os/features next to cargo features? Sorry to be pedantic, but what does it even mean to uncheck/check a cfg[os=windows] feature on macos? Does it mean to add an explicit feature initialization _options workspace setting? Or something implicit? How do you envision these features being stored as state? Should they revert on workspace reload? Etc. |
Beta Was this translation helpful? Give feedback.
-
Yes
When the project loads it should enable the
Having this feature only makes sense for Cargo features and maybe only shown in
The configuration shouldn't be stored and should reset on workspace reload. Maybe there could be a setting for user's to select the behavior to either store the state or not. IMO it shouldn't be stored |
Beta Was this translation helpful? Give feedback.
-
|
I'd like to join the request and mention, that ability to turn features on/off on the fly would be amazing when working on SDKs, full stack web, CLI+library, etc. The simplest use case, somewhat related to the AS1100K's, which I can introduce is full stack web - like leptos. In general it would be very convenient to not just have checkboxes in Cargo.toml, but to be able to configure feature flag sets for the RA and switch between them with a command. e.g: for the mentioned use case, it would be pretty nice to configure two feature flag sets:
And then to be able to switch between them with a Zed command like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This feature request is inspired form RustRover
https://www.jetbrains.com/help/rust/rust-cfg-support.html#enable-disable-feature
Although this functionality can be using Zed
settings.jsonlike:{ "lsp": { "rust-analyzer": { "initialization_options": { "cargo": { "features": ["feature_name_1", "feature_name_2"] } } } } }but if we have the ability to enable/disable some cargo features on the fly that would be amazing
Beta Was this translation helpful? Give feedback.
All reactions