mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
hardcode ".git" and "node_modules" also
This commit is contained in:
parent
10a24cf649
commit
0a08650852
@ -132,7 +132,7 @@ fn handle_task(task: Task, watcher: &Arc<Mutex<Option<Watcher>>>) -> TaskResult
|
||||
root_filter,
|
||||
nested_roots,
|
||||
} => {
|
||||
watch(watcher, &path, &*root_filter, false);
|
||||
watch(watcher, &path, root_filter.as_ref(), false);
|
||||
log::debug!("loading {} ...", path.as_path().display());
|
||||
let files = load_root(
|
||||
path.as_path(),
|
@ -59,7 +59,15 @@ impl RootFilter {
|
||||
|
||||
pub(crate) fn default_filter(path: &Path, rel_path: &RelativePath) -> bool {
|
||||
if path.is_dir() {
|
||||
rel_path.components().next() != Some(Component::Normal("target"))
|
||||
for (i, c) in rel_path.components().enumerate() {
|
||||
if let Component::Normal(c) = c {
|
||||
// hardcoded for now
|
||||
if (i == 0 && c == "target") || c == ".git" || c == "node_modules" {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
} else {
|
||||
rel_path.extension() == Some("rs")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user