Skip to content

Commit

Permalink
CARGO: Allow choosing which features are passed to "cargo metadata"
Browse files Browse the repository at this point in the history
We want to accurately track feature flags so lets not tell cargo
to always enable all features for us.
Always enabling all features can also causes problems as some non standard
feature dependency may not be available.

Instead let the user configure which features should be enabled.
The new default behavior is to only enable default features.

This setting is stored per project and reachable via Settings >
Languages & Frameworks > Rust > Cargo.

We do not yet use this features setting for any other commands like
- cargo check
- cargo build
- cargo test
- cargo run
- ...

Fixes intellij-rust#2635
See also intellij-rust#651 ecce3fa.
  • Loading branch information
kumbayo committed Feb 17, 2019
1 parent b342ee6 commit e449ed3
Showing 1 changed file with 15 additions and 0 deletions.
Expand Up @@ -97,6 +97,21 @@ class CargoConfigurable(project: Project) : RsConfigurableBase(project) {
""")
row("Additional cargo check arguments:", cargoCheckArguments)
}

cargoFeaturesAdditionalField.toolTipText = "Additional features to activate. Space-separated."
cargoFeaturesAdditionalField.emptyText.text = "Additional features to activate. Space-separated."

val p = JPanel().apply {
layout = BoxLayout(this, BoxLayout.X_AXIS)
add(cargoFeaturesComboBox)
add(Label("+"))
add(cargoFeaturesAdditionalField)
}

row("Cargo metadata features:", p, """
Cargo features to enable.
Pass --all-features, --no-default-features and --features to `cargo metadata`.
""")
}

override fun isModified(): Boolean {
Expand Down

0 comments on commit e449ed3

Please sign in to comment.