Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions crates/project-model/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ impl ProjectWorkspace {

let exclude = vec![
pkg_root.join(".git"),
pkg_root.join("target"),
pkg_root.join("tests"),
pkg_root.join("examples"),
pkg_root.join("benches"),
Expand Down Expand Up @@ -840,8 +839,6 @@ impl ProjectWorkspace {
let mut exclude = vec![pkg_root.join(".git")];
if is_local {
include.extend(self.extra_includes.iter().cloned());

exclude.push(pkg_root.join("target"));
} else {
exclude.push(pkg_root.join("tests"));
exclude.push(pkg_root.join("examples"));
Expand Down Expand Up @@ -903,8 +900,6 @@ impl ProjectWorkspace {
let mut exclude = vec![pkg_root.join(".git")];
if is_local {
include.extend(self.extra_includes.iter().cloned());

exclude.push(pkg_root.join("target"));
} else {
exclude.push(pkg_root.join("tests"));
exclude.push(pkg_root.join("examples"));
Expand Down
15 changes: 12 additions & 3 deletions crates/vfs-notify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,18 @@ impl NotifyActor {
return false;
}

// We want to filter out subdirectories that are roots themselves, because they will be visited separately.
dirs.exclude.iter().all(|it| it != path)
&& (root == path || dirs.include.iter().all(|it| it != path))
if dirs.exclude.iter().any(|it| path.starts_with(it)) {
// Directly excluded.
false
} else if root == path {
// Needed so that we won't enter the next if.
true
} else if dirs.include.iter().any(|it| it == path) {
// A subdirectory that is a project on its own, exclude it or it will be scanned twice.
false
} else {
true
}
});

let files = walkdir.filter_map(|it| it.ok()).filter_map(|entry| {
Expand Down
4 changes: 2 additions & 2 deletions crates/vfs/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ impl Entry {
/// Entry::Directories(Directories {
/// extensions: ["rs"],
/// include: [base],
/// exclude: [base/.git, base/target],
/// exclude: [base/.git],
/// })
/// ```
pub fn local_cargo_package(base: AbsPathBuf) -> Entry {
Entry::Directories(dirs(base, &[".git", "target"]))
Entry::Directories(dirs(base, &[".git"]))
}

/// Returns:
Expand Down