Don't clobber diagnostics when getting new snapshot from background scanner
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
7357b3ff2a
commit
9bbe67f0ea
1 changed files with 12 additions and 1 deletions
|
@ -34,6 +34,7 @@ use std::{
|
|||
ffi::{OsStr, OsString},
|
||||
fmt,
|
||||
future::Future,
|
||||
mem,
|
||||
ops::{Deref, Range},
|
||||
path::{Path, PathBuf},
|
||||
sync::{
|
||||
|
@ -583,7 +584,9 @@ impl Worktree {
|
|||
match self {
|
||||
Self::Local(worktree) => {
|
||||
let is_fake_fs = worktree.fs.is_fake();
|
||||
worktree.snapshot = worktree.background_snapshot.lock().clone();
|
||||
worktree
|
||||
.snapshot
|
||||
.assign(worktree.background_snapshot.lock().clone());
|
||||
if worktree.is_scanning() {
|
||||
if worktree.poll_task.is_none() {
|
||||
worktree.poll_task = Some(cx.spawn(|this, mut cx| async move {
|
||||
|
@ -1842,6 +1845,14 @@ impl Snapshot {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn assign(&mut self, mut other: Self) {
|
||||
mem::swap(
|
||||
&mut self.diagnostic_summaries,
|
||||
&mut other.diagnostic_summaries,
|
||||
);
|
||||
*self = other;
|
||||
}
|
||||
|
||||
pub fn file_count(&self) -> usize {
|
||||
self.entries_by_path.summary().file_count
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue