Fix a bug where a GPUI macro still used `ModelContext` Rename `AsyncAppContext` -> `AsyncApp` Rename update_model, read_model, insert_model, and reserve_model to update_entity, read_entity, insert_entity, and reserve_entity Release Notes: - N/A
This commit is contained in:
@@ -12,8 +12,7 @@ use fs::Fs;
|
||||
use futures::{channel::oneshot, future::Shared, Future, FutureExt as _, StreamExt};
|
||||
use git::{blame::Blame, diff::BufferDiff, repository::RepoPath};
|
||||
use gpui::{
|
||||
App, AppContext as _, AsyncAppContext, Context, Entity, EventEmitter, Subscription, Task,
|
||||
WeakEntity,
|
||||
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity,
|
||||
};
|
||||
use http_client::Url;
|
||||
use language::{
|
||||
@@ -787,7 +786,7 @@ impl LocalBufferStore {
|
||||
) -> Task<Result<Entity<Buffer>>> {
|
||||
let load_buffer = worktree.update(cx, |worktree, cx| {
|
||||
let load_file = worktree.load_file(path.as_ref(), cx);
|
||||
let reservation = cx.reserve_model();
|
||||
let reservation = cx.reserve_entity();
|
||||
let buffer_id = BufferId::from(reservation.entity_id().as_non_zero_u64());
|
||||
cx.spawn(move |_, mut cx| async move {
|
||||
let loaded = load_file.await?;
|
||||
@@ -795,7 +794,7 @@ impl LocalBufferStore {
|
||||
.background_executor()
|
||||
.spawn(async move { text::Buffer::new(0, buffer_id, loaded.text) })
|
||||
.await;
|
||||
cx.insert_model(reservation, |_| {
|
||||
cx.insert_entity(reservation, |_| {
|
||||
Buffer::build(text_buffer, Some(loaded.file), Capability::ReadWrite)
|
||||
})
|
||||
})
|
||||
@@ -1058,7 +1057,7 @@ impl BufferStore {
|
||||
this: WeakEntity<Self>,
|
||||
text: Result<Option<String>>,
|
||||
buffer: Entity<Buffer>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<Entity<BufferChangeSet>> {
|
||||
let text = match text {
|
||||
Err(e) => {
|
||||
@@ -1562,7 +1561,7 @@ impl BufferStore {
|
||||
pub async fn handle_update_buffer(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::UpdateBuffer>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<proto::Ack> {
|
||||
let payload = envelope.payload.clone();
|
||||
let buffer_id = BufferId::new(payload.buffer_id)?;
|
||||
@@ -1717,7 +1716,7 @@ impl BufferStore {
|
||||
pub async fn handle_update_buffer_file(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::UpdateBufferFile>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<()> {
|
||||
let buffer_id = envelope.payload.buffer_id;
|
||||
let buffer_id = BufferId::new(buffer_id)?;
|
||||
@@ -1765,7 +1764,7 @@ impl BufferStore {
|
||||
pub async fn handle_save_buffer(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::SaveBuffer>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<proto::BufferSaved> {
|
||||
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
|
||||
let (buffer, project_id) = this.update(&mut cx, |this, _| {
|
||||
@@ -1806,7 +1805,7 @@ impl BufferStore {
|
||||
pub async fn handle_close_buffer(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::CloseBuffer>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<()> {
|
||||
let peer_id = envelope.sender_id;
|
||||
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
|
||||
@@ -1830,7 +1829,7 @@ impl BufferStore {
|
||||
pub async fn handle_buffer_saved(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::BufferSaved>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<()> {
|
||||
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
|
||||
let version = deserialize_version(&envelope.payload.version);
|
||||
@@ -1858,7 +1857,7 @@ impl BufferStore {
|
||||
pub async fn handle_buffer_reloaded(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::BufferReloaded>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<()> {
|
||||
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
|
||||
let version = deserialize_version(&envelope.payload.version);
|
||||
@@ -1891,7 +1890,7 @@ impl BufferStore {
|
||||
pub async fn handle_blame_buffer(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::BlameBuffer>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<proto::BlameBufferResponse> {
|
||||
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
|
||||
let version = deserialize_version(&envelope.payload.version);
|
||||
@@ -1912,7 +1911,7 @@ impl BufferStore {
|
||||
pub async fn handle_get_permalink_to_line(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::GetPermalinkToLine>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<proto::GetPermalinkToLineResponse> {
|
||||
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
|
||||
// let version = deserialize_version(&envelope.payload.version);
|
||||
@@ -1937,7 +1936,7 @@ impl BufferStore {
|
||||
pub async fn handle_get_staged_text(
|
||||
this: Entity<Self>,
|
||||
request: TypedEnvelope<proto::GetStagedText>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<proto::GetStagedTextResponse> {
|
||||
let buffer_id = BufferId::new(request.payload.buffer_id)?;
|
||||
let change_set = this
|
||||
@@ -1966,7 +1965,7 @@ impl BufferStore {
|
||||
pub async fn handle_update_diff_base(
|
||||
this: Entity<Self>,
|
||||
request: TypedEnvelope<proto::UpdateDiffBase>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<()> {
|
||||
let buffer_id = BufferId::new(request.payload.buffer_id)?;
|
||||
let Some((buffer, change_set)) = this.update(&mut cx, |this, _| {
|
||||
@@ -2011,7 +2010,7 @@ impl BufferStore {
|
||||
async fn handle_reload_buffers(
|
||||
this: Entity<Self>,
|
||||
envelope: TypedEnvelope<proto::ReloadBuffers>,
|
||||
mut cx: AsyncAppContext,
|
||||
mut cx: AsyncApp,
|
||||
) -> Result<proto::ReloadBuffersResponse> {
|
||||
let sender_id = envelope.original_sender_id().unwrap_or_default();
|
||||
let reload = this.update(&mut cx, |this, cx| {
|
||||
|
||||
Reference in New Issue
Block a user