Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/rust-analyzer/src/config.rs8
-rw-r--r--crates/rust-analyzer/tests/slow-tests/main.rs36
-rw-r--r--crates/vfs-notify/src/lib.rs5
-rw-r--r--docs/book/src/configuration_generated.md4
-rw-r--r--editors/code/package.json4
5 files changed, 46 insertions, 11 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 7656c07c94..daddeae13a 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -84,10 +84,10 @@ config_data! {
completion_snippets_custom: FxHashMap<String, SnippetDef> = Config::completion_snippets_default(),
- /// These directories will be ignored by rust-analyzer. They are
+ /// These paths (file/directories) will be ignored by rust-analyzer. They are
/// relative to the workspace root, and globs are not supported. You may
/// also need to add the folders to Code's `files.watcherExclude`.
- files_excludeDirs: Vec<Utf8PathBuf> = vec![],
+ files_exclude | files_excludeDirs: Vec<Utf8PathBuf> = vec![],
@@ -1787,7 +1787,7 @@ impl Config {
fn discovered_projects(&self) -> Vec<ManifestOrProjectJson> {
let exclude_dirs: Vec<_> =
- self.files_excludeDirs().iter().map(|p| self.root_path.join(p)).collect();
+ self.files_exclude().iter().map(|p| self.root_path.join(p)).collect();
let mut projects = vec![];
for fs_proj in &self.discovered_projects_from_filesystem {
@@ -1909,7 +1909,7 @@ impl Config {
}
_ => FilesWatcher::Server,
},
- exclude: self.files_excludeDirs().iter().map(|it| self.root_path.join(it)).collect(),
+ exclude: self.files_exclude().iter().map(|it| self.root_path.join(it)).collect(),
}
}
diff --git a/crates/rust-analyzer/tests/slow-tests/main.rs b/crates/rust-analyzer/tests/slow-tests/main.rs
index 2b3c0a47a2..5ad28d0b90 100644
--- a/crates/rust-analyzer/tests/slow-tests/main.rs
+++ b/crates/rust-analyzer/tests/slow-tests/main.rs
@@ -1372,6 +1372,40 @@ pub fn foo() {}
name = "bar"
version = "0.0.0"
+[dependencies]
+foo = { path = "../foo" }
+
+//- /bar/src/lib.rs
+"#,
+ )
+ .root("foo")
+ .root("bar")
+ .root("baz")
+ .with_config(json!({
+ "files": {
+ "exclude": ["foo"]
+ }
+ }))
+ .server()
+ .wait_until_workspace_is_loaded();
+
+ server.request::<WorkspaceSymbolRequest>(Default::default(), json!([]));
+
+ let server = Project::with_fixture(
+ r#"
+//- /foo/Cargo.toml
+[package]
+name = "foo"
+version = "0.0.0"
+
+//- /foo/src/lib.rs
+pub fn foo() {}
+
+//- /bar/Cargo.toml
+[package]
+name = "bar"
+version = "0.0.0"
+
//- /bar/src/lib.rs
pub fn bar() {}
@@ -1388,7 +1422,7 @@ version = "0.0.0"
.root("baz")
.with_config(json!({
"files": {
- "excludeDirs": ["foo", "bar"]
+ "exclude": ["foo", "bar"]
}
}))
.server()
diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs
index 0ae8b7baf4..3200334176 100644
--- a/crates/vfs-notify/src/lib.rs
+++ b/crates/vfs-notify/src/lib.rs
@@ -280,8 +280,9 @@ impl NotifyActor {
return false;
}
- root == path
- || dirs.exclude.iter().chain(&dirs.include).all(|it| it != path)
+ // 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))
});
let files = walkdir.filter_map(|it| it.ok()).filter_map(|entry| {
diff --git a/docs/book/src/configuration_generated.md b/docs/book/src/configuration_generated.md
index 49eb724889..a7f54289b9 100644
--- a/docs/book/src/configuration_generated.md
+++ b/docs/book/src/configuration_generated.md
@@ -470,9 +470,9 @@ The warnings will be indicated by a blue squiggly underline in code
and a blue icon in the `Problems Panel`.
-**rust-analyzer.files.excludeDirs** (default: [])
+**rust-analyzer.files.exclude** (default: [])
- These directories will be ignored by rust-analyzer. They are
+ These paths (file/directories) will be ignored by rust-analyzer. They are
relative to the workspace root, and globs are not supported. You may
also need to add the folders to Code's `files.watcherExclude`.
diff --git a/editors/code/package.json b/editors/code/package.json
index 57f4254b68..5db8ca52a5 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -1473,8 +1473,8 @@
{
"title": "files",
"properties": {
- "rust-analyzer.files.excludeDirs": {
- "markdownDescription": "These directories will be ignored by rust-analyzer. They are\nrelative to the workspace root, and globs are not supported. You may\nalso need to add the folders to Code's `files.watcherExclude`.",
+ "rust-analyzer.files.exclude": {
+ "markdownDescription": "These paths (file/directories) will be ignored by rust-analyzer. They are\nrelative to the workspace root, and globs are not supported. You may\nalso need to add the folders to Code's `files.watcherExclude`.",
"default": [],
"type": "array",
"items": {