Auto merge of #12341 - vemoo:exclude_dirs, r=Veykril
make `files.excludeDirs` work
There's a small issue because if all projects are excluded, this: 01d412f4d7/crates/rust-analyzer/src/main_loop.rs (L114) will be shown.
I thought about not showing it if `files.excludeDirs` is set, but that is not necessarily correct.
Fixes #7755
This commit is contained in:
@@ -697,7 +697,22 @@ impl Config {
|
||||
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(),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user