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},
|
ffi::{OsStr, OsString},
|
||||||
fmt,
|
fmt,
|
||||||
future::Future,
|
future::Future,
|
||||||
|
mem,
|
||||||
ops::{Deref, Range},
|
ops::{Deref, Range},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
sync::{
|
sync::{
|
||||||
|
@ -583,7 +584,9 @@ impl Worktree {
|
||||||
match self {
|
match self {
|
||||||
Self::Local(worktree) => {
|
Self::Local(worktree) => {
|
||||||
let is_fake_fs = worktree.fs.is_fake();
|
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.is_scanning() {
|
||||||
if worktree.poll_task.is_none() {
|
if worktree.poll_task.is_none() {
|
||||||
worktree.poll_task = Some(cx.spawn(|this, mut cx| async move {
|
worktree.poll_task = Some(cx.spawn(|this, mut cx| async move {
|
||||||
|
@ -1842,6 +1845,14 @@ impl Snapshot {
|
||||||
Ok(())
|
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 {
|
pub fn file_count(&self) -> usize {
|
||||||
self.entries_by_path.summary().file_count
|
self.entries_by_path.summary().file_count
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue