mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Support setting cargo features
This commit is contained in:
parent
5eb5e80de9
commit
af4eb26645
8 changed files with 118 additions and 21 deletions
|
@ -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<String, bool>,
|
||||
|
||||
/// 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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue