Skip to content

Commit 47ef544

Browse files
committed
Added the rust-analyzer.checkOnSave.features option.
1 parent 684b6fa commit 47ef544

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,10 @@ impl Config {
242242
set(value, "/checkOnSave/command", command);
243243
set(value, "/checkOnSave/allTargets", all_targets);
244244
set(value, "/checkOnSave/allFeatures", all_features);
245-
*features = self.cargo.features.clone();
245+
set(value, "/checkOnSave/features", features);
246+
if features.is_empty() && !self.cargo.features.is_empty() {
247+
*features = self.cargo.features.clone();
248+
}
246249
}
247250
}
248251
};

editors/code/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@
322322
"default": false,
323323
"markdownDescription": "Check with all features (will be passed as `--all-features`)"
324324
},
325+
"rust-analyzer.checkOnSave.features": {
326+
"type": "array",
327+
"items": {
328+
"type": "string"
329+
},
330+
"default": [],
331+
"description": "List of features to activate. Set to `rust-analyzer.cargo.features` if empty."
332+
},
325333
"rust-analyzer.inlayHints.enable": {
326334
"type": "boolean",
327335
"default": true,

0 commit comments

Comments
 (0)