From af4eb266457eb784010da28d80535f9fd38d4d1e Mon Sep 17 00:00:00 2001 From: oxalica Date: Fri, 13 Dec 2019 18:16:34 +0800 Subject: Support setting cargo features --- crates/ra_lsp_server/src/config.rs | 5 +++++ crates/ra_lsp_server/src/main_loop.rs | 1 + 2 files changed, 6 insertions(+) (limited to 'crates/ra_lsp_server/src') diff --git a/crates/ra_lsp_server/src/config.rs b/crates/ra_lsp_server/src/config.rs index 8045f3d60..67942aa41 100644 --- a/crates/ra_lsp_server/src/config.rs +++ b/crates/ra_lsp_server/src/config.rs @@ -9,6 +9,7 @@ use rustc_hash::FxHashMap; +use ra_project_model::CargoFeatures; use serde::{Deserialize, Deserializer}; /// Client provided initialization options @@ -37,6 +38,9 @@ pub struct ServerConfig { /// Fine grained feature flags to disable specific features. pub feature_flags: FxHashMap, + + /// Cargo feature configurations. + pub cargo_features: CargoFeatures, } impl Default for ServerConfig { @@ -49,6 +53,7 @@ impl Default for ServerConfig { max_inlay_hint_length: None, with_sysroot: true, feature_flags: FxHashMap::default(), + cargo_features: Default::default(), } } } diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 158cac0be..965e7c53c 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -67,6 +67,7 @@ pub fn main_loop( let workspace = ra_project_model::ProjectWorkspace::discover_with_sysroot( ws_root.as_path(), config.with_sysroot, + &config.cargo_features, ); match workspace { Ok(workspace) => loaded_workspaces.push(workspace), -- cgit v1.2.3