Snapshot file instead of path when creating a buffer snapshot
This commit is contained in:
parent
15b13fe511
commit
eda569d6b2
5 changed files with 21 additions and 20 deletions
|
@ -4013,7 +4013,7 @@ impl Project {
|
|||
})
|
||||
.log_err();
|
||||
}
|
||||
buffer.file_updated(Box::new(new_file), cx).detach();
|
||||
buffer.file_updated(Arc::new(new_file), cx).detach();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -4565,7 +4565,7 @@ impl Project {
|
|||
.and_then(|b| b.upgrade(cx))
|
||||
.ok_or_else(|| anyhow!("no such buffer"))?;
|
||||
buffer.update(cx, |buffer, cx| {
|
||||
buffer.file_updated(Box::new(file), cx).detach();
|
||||
buffer.file_updated(Arc::new(file), cx).detach();
|
||||
});
|
||||
Ok(())
|
||||
})
|
||||
|
@ -5089,8 +5089,8 @@ impl Project {
|
|||
anyhow!("no worktree found for id {}", file.worktree_id)
|
||||
})?;
|
||||
buffer_file =
|
||||
Some(Box::new(File::from_proto(file, worktree.clone(), cx)?)
|
||||
as Box<dyn language::File>);
|
||||
Some(Arc::new(File::from_proto(file, worktree.clone(), cx)?)
|
||||
as Arc<dyn language::File>);
|
||||
buffer_worktree = Some(worktree);
|
||||
Ok::<_, anyhow::Error>(())
|
||||
})?;
|
||||
|
|
|
@ -519,7 +519,7 @@ impl LocalWorktree {
|
|||
let (file, contents) = this
|
||||
.update(&mut cx, |t, cx| t.as_local().unwrap().load(&path, cx))
|
||||
.await?;
|
||||
Ok(cx.add_model(|cx| Buffer::from_file(0, contents, Box::new(file), cx)))
|
||||
Ok(cx.add_model(|cx| Buffer::from_file(0, contents, Arc::new(file), cx)))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -648,7 +648,7 @@ impl LocalWorktree {
|
|||
};
|
||||
|
||||
buffer_handle.update(&mut cx, |buffer, cx| {
|
||||
buffer.did_save(version, file.mtime, Some(Box::new(file)), cx);
|
||||
buffer.did_save(version, file.mtime, Some(Arc::new(file)), cx);
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue