diff options
Diffstat (limited to 'crates/rust-analyzer/src/config.rs')
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 9cc14fe82..372180ab5 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -7,7 +7,7 @@ | |||
7 | //! configure the server itself, feature flags are passed into analysis, and | 7 | //! configure the server itself, feature flags are passed into analysis, and |
8 | //! tweak things like automatic insertion of `()` in completions. | 8 | //! tweak things like automatic insertion of `()` in completions. |
9 | 9 | ||
10 | use std::{ffi::OsString, path::PathBuf}; | 10 | use std::{convert::TryFrom, ffi::OsString, path::PathBuf}; |
11 | 11 | ||
12 | use flycheck::FlycheckConfig; | 12 | use flycheck::FlycheckConfig; |
13 | use hir::PrefixKind; | 13 | use hir::PrefixKind; |
@@ -227,12 +227,25 @@ impl Config { | |||
227 | self.notifications = | 227 | self.notifications = |
228 | NotificationsConfig { cargo_toml_not_found: data.notifications_cargoTomlNotFound }; | 228 | NotificationsConfig { cargo_toml_not_found: data.notifications_cargoTomlNotFound }; |
229 | self.cargo_autoreload = data.cargo_autoreload; | 229 | self.cargo_autoreload = data.cargo_autoreload; |
230 | |||
231 | let rustc_source = if let Some(rustc_source) = data.rustcSource { | ||
232 | let rustpath: PathBuf = rustc_source.into(); | ||
233 | AbsPathBuf::try_from(rustpath) | ||
234 | .map_err(|_| { | ||
235 | log::error!("rustc source directory must be an absolute path"); | ||
236 | }) | ||
237 | .ok() | ||
238 | } else { | ||
239 | None | ||
240 | }; | ||
241 | |||
230 | self.cargo = CargoConfig { | 242 | self.cargo = CargoConfig { |
231 | no_default_features: data.cargo_noDefaultFeatures, | 243 | no_default_features: data.cargo_noDefaultFeatures, |
232 | all_features: data.cargo_allFeatures, | 244 | all_features: data.cargo_allFeatures, |
233 | features: data.cargo_features.clone(), | 245 | features: data.cargo_features.clone(), |
234 | load_out_dirs_from_check: data.cargo_loadOutDirsFromCheck, | 246 | load_out_dirs_from_check: data.cargo_loadOutDirsFromCheck, |
235 | target: data.cargo_target.clone(), | 247 | target: data.cargo_target.clone(), |
248 | rustc_source: rustc_source, | ||
236 | }; | 249 | }; |
237 | self.runnables = RunnablesConfig { | 250 | self.runnables = RunnablesConfig { |
238 | override_cargo: data.runnables_overrideCargo, | 251 | override_cargo: data.runnables_overrideCargo, |
@@ -532,5 +545,6 @@ config_data! { | |||
532 | rustfmt_overrideCommand: Option<Vec<String>> = None, | 545 | rustfmt_overrideCommand: Option<Vec<String>> = None, |
533 | 546 | ||
534 | withSysroot: bool = true, | 547 | withSysroot: bool = true, |
548 | rustcSource : Option<String> = None, | ||
535 | } | 549 | } |
536 | } | 550 | } |