rust-lang / rust-lang/rust-analyzer

Feature Request: Commands to toggle feature(s)

Open
#13,596 5 comments 5 reactions 1 assignee View on GitHub

@ShoyuVanilla is already working on this.

Since Nov 4, 2025.

A-vscode C-feature E-hard fun
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

It would be nice if you could run a command to toggle specific features by automatically editing the rust-analyzer.cargo.features setting. For instance, the commands could be like:

  1. "Enable all features": This would set the rust-analyzer.cargo.features setting to "all".
  2. "Enable feature...": This would cause a text box to appear where you could write the feature. That would then be added to the feature list in the rust-analyzer.cargo.features setting.
  3. "Disable all features": Would simply clear the setting.
  4. "Disable feature...": Should ideally show the list of features already present in the setting and allow you to choose one to disable.

You could also imagine that a code action could be added to #[cfg(feature = "...")] attributes which would enable/disable the feature.

The server should then restart automatically after running this command (which is required whenever editing the setting).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.