diff options
Diffstat (limited to 'crates/rust-analyzer/src/config.rs')
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 761bc9c2d..0e5dc56fd 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -261,6 +261,22 @@ impl Config { | |||
261 | self.lens = LensConfig::NO_LENS; | 261 | self.lens = LensConfig::NO_LENS; |
262 | } | 262 | } |
263 | 263 | ||
264 | if let Some(linked_projects) = get::<Vec<ManifestOrJsonProject>>(value, "/linkedProjects") { | ||
265 | if !linked_projects.is_empty() { | ||
266 | self.linked_projects.clear(); | ||
267 | for linked_project in linked_projects { | ||
268 | let linked_project = match linked_project { | ||
269 | ManifestOrJsonProject::Manifest(it) => match ProjectManifest::from_manifest_file(it) { | ||
270 | Ok(it) => it.into(), | ||
271 | Err(_) => continue, | ||
272 | } | ||
273 | ManifestOrJsonProject::JsonProject(it) => it.into(), | ||
274 | }; | ||
275 | self.linked_projects.push(linked_project); | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | |||
264 | log::info!("Config::update() = {:#?}", self); | 280 | log::info!("Config::update() = {:#?}", self); |
265 | 281 | ||
266 | fn get<'a, T: Deserialize<'a>>(value: &'a serde_json::Value, pointer: &str) -> Option<T> { | 282 | fn get<'a, T: Deserialize<'a>>(value: &'a serde_json::Value, pointer: &str) -> Option<T> { |
@@ -324,3 +340,10 @@ impl Config { | |||
324 | } | 340 | } |
325 | } | 341 | } |
326 | } | 342 | } |
343 | |||
344 | #[derive(Deserialize)] | ||
345 | #[serde(untagged)] | ||
346 | enum ManifestOrJsonProject { | ||
347 | Manifest(PathBuf), | ||
348 | JsonProject(JsonProject), | ||
349 | } | ||