diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index d7ae4c72f5c..d7e6c8a82ad 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -694,7 +694,22 @@ pub fn linked_projects(&self) -> Vec { match self.data.linkedProjects.as_slice() { [] => match self.discovered_projects.as_ref() { Some(discovered_projects) => { - discovered_projects.iter().cloned().map(LinkedProject::from).collect() + let exclude_dirs: Vec<_> = self + .data + .files_excludeDirs + .iter() + .map(|p| self.root_path.join(p)) + .collect(); + discovered_projects + .iter() + .filter(|p| { + let (ProjectManifest::ProjectJson(path) + | ProjectManifest::CargoToml(path)) = p; + !exclude_dirs.iter().any(|p| path.starts_with(p)) + }) + .cloned() + .map(LinkedProject::from) + .collect() } None => Vec::new(), },