From 47ef544fa57ca1833b466e491315e54a88780b4d Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Wed, 10 Jun 2020 08:51:11 +0200 Subject: [PATCH] Added the rust-analyzer.checkOnSave.features option. --- crates/rust-analyzer/src/config.rs | 5 ++++- editors/code/package.json | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 5d5f7d66a7..320414ecf3 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -242,7 +242,10 @@ impl Config { set(value, "/checkOnSave/command", command); set(value, "/checkOnSave/allTargets", all_targets); set(value, "/checkOnSave/allFeatures", all_features); - *features = self.cargo.features.clone(); + set(value, "/checkOnSave/features", features); + if features.is_empty() && !self.cargo.features.is_empty() { + *features = self.cargo.features.clone(); + } } } }; diff --git a/editors/code/package.json b/editors/code/package.json index 779d7e1b87..6389499e9a 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -322,6 +322,14 @@ "default": false, "markdownDescription": "Check with all features (will be passed as `--all-features`)" }, + "rust-analyzer.checkOnSave.features": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "List of features to activate. Set to `rust-analyzer.cargo.features` if empty." + }, "rust-analyzer.inlayHints.enable": { "type": "boolean", "default": true,