mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
do not emit create for directory again
This commit is contained in:
parent
f88355ccb5
commit
7f7c4e7465
3 changed files with 6 additions and 8 deletions
|
@ -68,11 +68,11 @@ impl Worker {
|
||||||
let watcher_clone = watcher.clone();
|
let watcher_clone = watcher.clone();
|
||||||
let (worker, worker_handle) =
|
let (worker, worker_handle) =
|
||||||
thread_worker::spawn("vfs", 128, move |input_receiver, output_sender| {
|
thread_worker::spawn("vfs", 128, move |input_receiver, output_sender| {
|
||||||
let res = input_receiver
|
input_receiver
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|t| handle_task(t, &watcher_clone))
|
.map(|t| handle_task(t, &watcher_clone))
|
||||||
.try_for_each(|it| output_sender.send(it));
|
.try_for_each(|it| output_sender.send(it))
|
||||||
res.unwrap()
|
.unwrap()
|
||||||
});
|
});
|
||||||
match Watcher::start(worker.inp.clone()) {
|
match Watcher::start(worker.inp.clone()) {
|
||||||
Ok(w) => {
|
Ok(w) => {
|
||||||
|
@ -99,6 +99,7 @@ impl Worker {
|
||||||
if let Some(watcher) = self.watcher.lock().take() {
|
if let Some(watcher) = self.watcher.lock().take() {
|
||||||
let _ = watcher.shutdown();
|
let _ = watcher.shutdown();
|
||||||
}
|
}
|
||||||
|
let _ = self.worker.shutdown();
|
||||||
self.worker_handle.shutdown()
|
self.worker_handle.shutdown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl Watcher {
|
||||||
&mut self,
|
&mut self,
|
||||||
dir: &Path,
|
dir: &Path,
|
||||||
filter_entry: impl Fn(&DirEntry) -> bool,
|
filter_entry: impl Fn(&DirEntry) -> bool,
|
||||||
emit_for_existing: bool,
|
emit_for_contents: bool,
|
||||||
) {
|
) {
|
||||||
for res in WalkDir::new(dir).into_iter().filter_entry(filter_entry) {
|
for res in WalkDir::new(dir).into_iter().filter_entry(filter_entry) {
|
||||||
match res {
|
match res {
|
||||||
|
@ -98,7 +98,7 @@ impl Watcher {
|
||||||
Err(e) => log::warn!("could not watch \"{}\": {}", dir.display(), e),
|
Err(e) => log::warn!("could not watch \"{}\": {}", dir.display(), e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if emit_for_existing {
|
if emit_for_contents && entry.depth() > 0 {
|
||||||
// emit as create because we haven't seen it yet
|
// emit as create because we haven't seen it yet
|
||||||
if let Err(e) =
|
if let Err(e) =
|
||||||
self.sender
|
self.sender
|
||||||
|
|
|
@ -40,9 +40,6 @@ fn test_vfs_works() -> std::io::Result<()> {
|
||||||
fs::write(file_path, text)?
|
fs::write(file_path, text)?
|
||||||
}
|
}
|
||||||
|
|
||||||
let gitignore = dir.path().join("a/.gitignore");
|
|
||||||
fs::write(gitignore, "/target").unwrap();
|
|
||||||
|
|
||||||
let a_root = dir.path().join("a");
|
let a_root = dir.path().join("a");
|
||||||
let b_root = dir.path().join("a/b");
|
let b_root = dir.path().join("a/b");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue