mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
hardcode ".git" and "node_modules" also
This commit is contained in:
parent
10a24cf649
commit
0a08650852
2 changed files with 10 additions and 2 deletions
|
@ -132,7 +132,7 @@ fn handle_task(task: Task, watcher: &Arc<Mutex<Option<Watcher>>>) -> TaskResult
|
||||||
root_filter,
|
root_filter,
|
||||||
nested_roots,
|
nested_roots,
|
||||||
} => {
|
} => {
|
||||||
watch(watcher, &path, &*root_filter, false);
|
watch(watcher, &path, root_filter.as_ref(), false);
|
||||||
log::debug!("loading {} ...", path.as_path().display());
|
log::debug!("loading {} ...", path.as_path().display());
|
||||||
let files = load_root(
|
let files = load_root(
|
||||||
path.as_path(),
|
path.as_path(),
|
|
@ -59,7 +59,15 @@ impl RootFilter {
|
||||||
|
|
||||||
pub(crate) fn default_filter(path: &Path, rel_path: &RelativePath) -> bool {
|
pub(crate) fn default_filter(path: &Path, rel_path: &RelativePath) -> bool {
|
||||||
if path.is_dir() {
|
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 {
|
} else {
|
||||||
rel_path.extension() == Some("rs")
|
rel_path.extension() == Some("rs")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue