Fix missed renames in #22632 (#23688)

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:
Mikayla Maki 2025-01-26 15:37:34 -08:00 committed by GitHub
parent 83141d07e9
commit a6b1514246
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
118 changed files with 708 additions and 757 deletions

View file

@ -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| {

View file

@ -3,7 +3,7 @@ use anyhow::Result;
use client::Client;
use collections::{HashMap, HashSet};
use futures::{FutureExt, StreamExt};
use gpui::{App, AppContext as _, AsyncAppContext, Context, Entity, Global, Task, WeakEntity};
use gpui::{App, AppContext as _, AsyncApp, Context, Entity, Global, Task, WeakEntity};
use postage::stream::Stream;
use rpc::proto;
use std::{sync::Arc, time::Duration};
@ -133,7 +133,7 @@ impl Manager {
async fn maintain_connection(
this: WeakEntity<Self>,
client: Arc<Client>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
let mut client_status = client.status();
loop {

View file

@ -394,7 +394,7 @@ impl ImageStoreImpl for Entity<LocalImageStore> {
reload_task: None,
})?;
let image_id = cx.read_model(&model, |model, _| model.id)?;
let image_id = cx.read_entity(&model, |model, _| model.id)?;
this.update(&mut cx, |this, cx| {
image_store.update(cx, |image_store, cx| {

View file

@ -12,7 +12,7 @@ use client::proto::{self, PeerId};
use clock::Global;
use collections::HashSet;
use futures::future;
use gpui::{App, AsyncAppContext, Entity};
use gpui::{App, AsyncApp, Entity};
use language::{
language_settings::{language_settings, InlayHintKind, LanguageSettings},
point_from_lsp, point_to_lsp,
@ -122,7 +122,7 @@ pub trait LspCommand: 'static + Sized + Send + std::fmt::Debug {
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Self::Response>;
fn to_proto(&self, project_id: u64, buffer: &Buffer) -> Self::ProtoRequest;
@ -131,7 +131,7 @@ pub trait LspCommand: 'static + Sized + Send + std::fmt::Debug {
message: Self::ProtoRequest,
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Self>;
fn response_to_proto(
@ -147,7 +147,7 @@ pub trait LspCommand: 'static + Sized + Send + std::fmt::Debug {
message: <Self::ProtoRequest as proto::RequestMessage>::Response,
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Self::Response>;
fn buffer_id_from_proto(message: &Self::ProtoRequest) -> Result<BufferId>;
@ -297,7 +297,7 @@ impl LspCommand for PrepareRename {
_: Entity<LspStore>,
buffer: Entity<Buffer>,
_: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<PrepareRenameResponse> {
buffer.update(&mut cx, |buffer, _| {
match message {
@ -339,7 +339,7 @@ impl LspCommand for PrepareRename {
message: proto::PrepareRename,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -393,7 +393,7 @@ impl LspCommand for PrepareRename {
message: proto::PrepareRenameResponse,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<PrepareRenameResponse> {
if message.can_rename {
buffer
@ -453,7 +453,7 @@ impl LspCommand for PerformRename {
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<ProjectTransaction> {
if let Some(edit) = message {
let (lsp_adapter, lsp_server) =
@ -488,7 +488,7 @@ impl LspCommand for PerformRename {
message: proto::PerformRename,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -526,7 +526,7 @@ impl LspCommand for PerformRename {
message: proto::PerformRenameResponse,
lsp_store: Entity<LspStore>,
_: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<ProjectTransaction> {
let message = message
.transaction
@ -582,7 +582,7 @@ impl LspCommand for GetDefinition {
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
location_links_from_lsp(message, lsp_store, buffer, server_id, cx).await
}
@ -602,7 +602,7 @@ impl LspCommand for GetDefinition {
message: proto::GetDefinition,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -634,7 +634,7 @@ impl LspCommand for GetDefinition {
message: proto::GetDefinitionResponse,
lsp_store: Entity<LspStore>,
_: Entity<Buffer>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
location_links_from_proto(message.links, lsp_store, cx).await
}
@ -681,7 +681,7 @@ impl LspCommand for GetDeclaration {
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
location_links_from_lsp(message, lsp_store, buffer, server_id, cx).await
}
@ -701,7 +701,7 @@ impl LspCommand for GetDeclaration {
message: proto::GetDeclaration,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -733,7 +733,7 @@ impl LspCommand for GetDeclaration {
message: proto::GetDeclarationResponse,
lsp_store: Entity<LspStore>,
_: Entity<Buffer>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
location_links_from_proto(message.links, lsp_store, cx).await
}
@ -773,7 +773,7 @@ impl LspCommand for GetImplementation {
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
location_links_from_lsp(message, lsp_store, buffer, server_id, cx).await
}
@ -793,7 +793,7 @@ impl LspCommand for GetImplementation {
message: proto::GetImplementation,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -825,7 +825,7 @@ impl LspCommand for GetImplementation {
message: proto::GetImplementationResponse,
project: Entity<LspStore>,
_: Entity<Buffer>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
location_links_from_proto(message.links, project, cx).await
}
@ -872,7 +872,7 @@ impl LspCommand for GetTypeDefinition {
project: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
location_links_from_lsp(message, project, buffer, server_id, cx).await
}
@ -892,7 +892,7 @@ impl LspCommand for GetTypeDefinition {
message: proto::GetTypeDefinition,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -924,7 +924,7 @@ impl LspCommand for GetTypeDefinition {
message: proto::GetTypeDefinitionResponse,
project: Entity<LspStore>,
_: Entity<Buffer>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
location_links_from_proto(message.links, project, cx).await
}
@ -938,7 +938,7 @@ fn language_server_for_buffer(
lsp_store: &Entity<LspStore>,
buffer: &Entity<Buffer>,
server_id: LanguageServerId,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<(Arc<CachedLspAdapter>, Arc<LanguageServer>)> {
lsp_store
.update(cx, |lsp_store, cx| {
@ -952,7 +952,7 @@ fn language_server_for_buffer(
async fn location_links_from_proto(
proto_links: Vec<proto::LocationLink>,
lsp_store: Entity<LspStore>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
let mut links = Vec::new();
@ -1018,7 +1018,7 @@ async fn location_links_from_lsp(
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Vec<LocationLink>> {
let message = match message {
Some(message) => message,
@ -1187,7 +1187,7 @@ impl LspCommand for GetReferences {
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Vec<Location>> {
let mut references = Vec::new();
let (lsp_adapter, language_server) =
@ -1240,7 +1240,7 @@ impl LspCommand for GetReferences {
message: proto::GetReferences,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -1288,7 +1288,7 @@ impl LspCommand for GetReferences {
message: proto::GetReferencesResponse,
project: Entity<LspStore>,
_: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Vec<Location>> {
let mut locations = Vec::new();
for location in message.locations {
@ -1359,7 +1359,7 @@ impl LspCommand for GetDocumentHighlights {
_: Entity<LspStore>,
buffer: Entity<Buffer>,
_: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Vec<DocumentHighlight>> {
buffer.update(&mut cx, |buffer, _| {
let mut lsp_highlights = lsp_highlights.unwrap_or_default();
@ -1397,7 +1397,7 @@ impl LspCommand for GetDocumentHighlights {
message: proto::GetDocumentHighlights,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -1441,7 +1441,7 @@ impl LspCommand for GetDocumentHighlights {
message: proto::GetDocumentHighlightsResponse,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Vec<DocumentHighlight>> {
let mut highlights = Vec::new();
for highlight in message.highlights {
@ -1512,7 +1512,7 @@ impl LspCommand for GetSignatureHelp {
_: Entity<LspStore>,
buffer: Entity<Buffer>,
_: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self::Response> {
let language = buffer.update(&mut cx, |buffer, _| buffer.language().cloned())?;
Ok(message.and_then(|message| SignatureHelp::new(message, language)))
@ -1532,7 +1532,7 @@ impl LspCommand for GetSignatureHelp {
payload: Self::ProtoRequest,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
buffer
.update(&mut cx, |buffer, _| {
@ -1568,7 +1568,7 @@ impl LspCommand for GetSignatureHelp {
response: proto::GetSignatureHelpResponse,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self::Response> {
let language = buffer.update(&mut cx, |buffer, _| buffer.language().cloned())?;
Ok(response
@ -1619,7 +1619,7 @@ impl LspCommand for GetHover {
_: Entity<LspStore>,
buffer: Entity<Buffer>,
_: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self::Response> {
let Some(hover) = message else {
return Ok(None);
@ -1699,7 +1699,7 @@ impl LspCommand for GetHover {
message: Self::ProtoRequest,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -1765,7 +1765,7 @@ impl LspCommand for GetHover {
message: proto::GetHoverResponse,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self::Response> {
let contents: Vec<_> = message
.contents
@ -1843,7 +1843,7 @@ impl LspCommand for GetCompletions {
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self::Response> {
let mut response_list = None;
let mut completions = if let Some(completions) = completions {
@ -2035,7 +2035,7 @@ impl LspCommand for GetCompletions {
message: proto::GetCompletions,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let version = deserialize_version(&message.version);
buffer
@ -2080,7 +2080,7 @@ impl LspCommand for GetCompletions {
message: proto::GetCompletionsResponse,
_project: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self::Response> {
buffer
.update(&mut cx, |buffer, _| {
@ -2224,7 +2224,7 @@ impl LspCommand for GetCodeActions {
_: Entity<LspStore>,
_: Entity<Buffer>,
server_id: LanguageServerId,
_: AsyncAppContext,
_: AsyncApp,
) -> Result<Vec<CodeAction>> {
let requested_kinds_set = if let Some(kinds) = self.kinds {
Some(kinds.into_iter().collect::<HashSet<_>>())
@ -2271,7 +2271,7 @@ impl LspCommand for GetCodeActions {
message: proto::GetCodeActions,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let start = message
.start
@ -2314,7 +2314,7 @@ impl LspCommand for GetCodeActions {
message: proto::GetCodeActionsResponse,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Vec<CodeAction>> {
buffer
.update(&mut cx, |buffer, _| {
@ -2405,7 +2405,7 @@ impl LspCommand for OnTypeFormatting {
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Option<Transaction>> {
if let Some(edits) = message {
let (lsp_adapter, lsp_server) =
@ -2441,7 +2441,7 @@ impl LspCommand for OnTypeFormatting {
message: proto::OnTypeFormatting,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -2485,7 +2485,7 @@ impl LspCommand for OnTypeFormatting {
message: proto::OnTypeFormattingResponse,
_: Entity<LspStore>,
_: Entity<Buffer>,
_: AsyncAppContext,
_: AsyncApp,
) -> Result<Option<Transaction>> {
let Some(transaction) = message.transaction else {
return Ok(None);
@ -2505,7 +2505,7 @@ impl InlayHints {
server_id: LanguageServerId,
resolve_state: ResolveState,
force_no_type_left_padding: bool,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> anyhow::Result<InlayHint> {
let kind = lsp_hint.kind.and_then(|kind| match kind {
lsp::InlayHintKind::TYPE => Some(InlayHintKind::Type),
@ -2914,7 +2914,7 @@ impl LspCommand for InlayHints {
lsp_store: Entity<LspStore>,
buffer: Entity<Buffer>,
server_id: LanguageServerId,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> anyhow::Result<Vec<InlayHint>> {
let (lsp_adapter, lsp_server) =
language_server_for_buffer(&lsp_store, &buffer, server_id, &mut cx)?;
@ -2969,7 +2969,7 @@ impl LspCommand for InlayHints {
message: proto::InlayHints,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let start = message
.start
@ -3009,7 +3009,7 @@ impl LspCommand for InlayHints {
message: proto::InlayHintsResponse,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> anyhow::Result<Vec<InlayHint>> {
buffer
.update(&mut cx, |buffer, _| {
@ -3073,7 +3073,7 @@ impl LspCommand for LinkedEditingRange {
_: Entity<LspStore>,
buffer: Entity<Buffer>,
_server_id: LanguageServerId,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Vec<Range<Anchor>>> {
if let Some(lsp::LinkedEditingRanges { mut ranges, .. }) = message {
ranges.sort_by_key(|range| range.start);
@ -3107,7 +3107,7 @@ impl LspCommand for LinkedEditingRange {
message: proto::LinkedEditingRange,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Self> {
let position = message
.position
@ -3148,7 +3148,7 @@ impl LspCommand for LinkedEditingRange {
message: proto::LinkedEditingRangeResponse,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Vec<Range<Anchor>>> {
buffer
.update(&mut cx, |buffer, _| {

View file

@ -1,7 +1,7 @@
use crate::{lsp_command::LspCommand, lsp_store::LspStore, make_text_document_identifier};
use anyhow::{Context as _, Result};
use async_trait::async_trait;
use gpui::{App, AsyncAppContext, Entity};
use gpui::{App, AsyncApp, Entity};
use language::{point_to_lsp, proto::deserialize_anchor, Buffer};
use lsp::{LanguageServer, LanguageServerId};
use rpc::proto::{self, PeerId};
@ -70,7 +70,7 @@ impl LspCommand for ExpandMacro {
_: Entity<LspStore>,
_: Entity<Buffer>,
_: LanguageServerId,
_: AsyncAppContext,
_: AsyncApp,
) -> anyhow::Result<ExpandedMacro> {
Ok(message
.map(|message| ExpandedMacro {
@ -94,7 +94,7 @@ impl LspCommand for ExpandMacro {
message: Self::ProtoRequest,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> anyhow::Result<Self> {
let position = message
.position
@ -123,7 +123,7 @@ impl LspCommand for ExpandMacro {
message: proto::LspExtExpandMacroResponse,
_: Entity<LspStore>,
_: Entity<Buffer>,
_: AsyncAppContext,
_: AsyncApp,
) -> anyhow::Result<ExpandedMacro> {
Ok(ExpandedMacro {
name: message.name,
@ -200,7 +200,7 @@ impl LspCommand for OpenDocs {
_: Entity<LspStore>,
_: Entity<Buffer>,
_: LanguageServerId,
_: AsyncAppContext,
_: AsyncApp,
) -> anyhow::Result<DocsUrls> {
Ok(message
.map(|message| DocsUrls {
@ -224,7 +224,7 @@ impl LspCommand for OpenDocs {
message: Self::ProtoRequest,
_: Entity<LspStore>,
buffer: Entity<Buffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> anyhow::Result<Self> {
let position = message
.position
@ -253,7 +253,7 @@ impl LspCommand for OpenDocs {
message: proto::LspExtOpenDocsResponse,
_: Entity<LspStore>,
_: Entity<Buffer>,
_: AsyncAppContext,
_: AsyncApp,
) -> anyhow::Result<DocsUrls> {
Ok(DocsUrls {
web: message.web,
@ -314,7 +314,7 @@ impl LspCommand for SwitchSourceHeader {
_: Entity<LspStore>,
_: Entity<Buffer>,
_: LanguageServerId,
_: AsyncAppContext,
_: AsyncApp,
) -> anyhow::Result<SwitchSourceHeaderResult> {
Ok(message
.map(|message| SwitchSourceHeaderResult(message.0))
@ -332,7 +332,7 @@ impl LspCommand for SwitchSourceHeader {
_: Self::ProtoRequest,
_: Entity<LspStore>,
_: Entity<Buffer>,
_: AsyncAppContext,
_: AsyncApp,
) -> anyhow::Result<Self> {
Ok(Self {})
}
@ -354,7 +354,7 @@ impl LspCommand for SwitchSourceHeader {
message: proto::LspExtSwitchSourceHeaderResponse,
_: Entity<LspStore>,
_: Entity<Buffer>,
_: AsyncAppContext,
_: AsyncApp,
) -> anyhow::Result<SwitchSourceHeaderResult> {
Ok(SwitchSourceHeaderResult(message.target_file))
}

View file

@ -25,8 +25,7 @@ use futures::{
};
use globset::{Glob, GlobBuilder, GlobMatcher, GlobSet, GlobSetBuilder};
use gpui::{
App, AppContext as _, AsyncAppContext, Context, Entity, EventEmitter, PromptLevel, Task,
WeakEntity,
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, PromptLevel, Task, WeakEntity,
};
use http_client::HttpClient;
use itertools::Itertools as _;
@ -1089,7 +1088,7 @@ impl LocalLspStore {
target: &LspFormatTarget,
push_to_history: bool,
trigger: FormatTrigger,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> anyhow::Result<ProjectTransaction> {
// Do not allow multiple concurrent formatting requests for the
// same buffer.
@ -1437,7 +1436,7 @@ impl LocalLspStore {
adapters_and_servers: &[(Arc<CachedLspAdapter>, Arc<LanguageServer>)],
push_to_history: bool,
transaction: &mut ProjectTransaction,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<Option<FormatOperation>, anyhow::Error> {
let result = match formatter {
Formatter::LanguageServer { name } => {
@ -1527,7 +1526,7 @@ impl LocalLspStore {
abs_path: &Path,
language_server: &Arc<LanguageServer>,
settings: &LanguageSettings,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<Vec<(Range<Anchor>, String)>> {
let capabilities = &language_server.capabilities();
let range_formatting_provider = capabilities.document_range_formatting_provider.as_ref();
@ -1598,7 +1597,7 @@ impl LocalLspStore {
abs_path: &Path,
language_server: &Arc<LanguageServer>,
settings: &LanguageSettings,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<Vec<(Range<Anchor>, String)>> {
let uri = lsp::Url::from_file_path(abs_path)
.map_err(|_| anyhow!("failed to convert abs path to uri"))?;
@ -1651,7 +1650,7 @@ impl LocalLspStore {
buffer: &FormattableBuffer,
command: &str,
arguments: Option<&[String]>,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<Option<Diff>> {
let working_dir_path = buffer.handle.update(cx, |buffer, cx| {
let file = File::from_dyn(buffer.file())?;
@ -2029,7 +2028,7 @@ impl LocalLspStore {
buffer: &Entity<Buffer>,
push_to_history: bool,
project_transaction: &mut ProjectTransaction,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<(), anyhow::Error> {
for (lsp_adapter, language_server) in adapters_and_servers.iter() {
let code_actions = code_actions.clone();
@ -2107,7 +2106,7 @@ impl LocalLspStore {
push_to_history: bool,
_: Arc<CachedLspAdapter>,
language_server: Arc<LanguageServer>,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<Option<Transaction>> {
let edits = this
.update(cx, |this, cx| {
@ -2253,7 +2252,7 @@ impl LocalLspStore {
push_to_history: bool,
lsp_adapter: Arc<CachedLspAdapter>,
language_server: Arc<LanguageServer>,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<ProjectTransaction> {
let fs = this.read_with(cx, |this, _| this.as_local().unwrap().fs.clone())?;
@ -2478,7 +2477,7 @@ impl LocalLspStore {
params: lsp::ApplyWorkspaceEditParams,
server_id: LanguageServerId,
adapter: Arc<CachedLspAdapter>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<lsp::ApplyWorkspaceEditResponse> {
let this = this
.upgrade()
@ -5134,7 +5133,7 @@ impl LspStore {
pub(crate) async fn refresh_workspace_configurations(
this: &WeakEntity<Self>,
fs: Arc<dyn Fs>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) {
maybe!(async move {
let servers = this
@ -5679,7 +5678,7 @@ impl LspStore {
async fn handle_lsp_command<T: LspCommand>(
this: Entity<Self>,
envelope: TypedEnvelope<T::ProtoRequest>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<<T::ProtoRequest as proto::RequestMessage>::Response>
where
<T::LspRequest as lsp::request::Request>::Params: Send,
@ -5721,7 +5720,7 @@ impl LspStore {
async fn handle_multi_lsp_query(
this: Entity<Self>,
envelope: TypedEnvelope<proto::MultiLspQuery>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::MultiLspQueryResponse> {
let response_from_ssh = this.update(&mut cx, |this, _| {
let (upstream_client, project_id) = this.upstream_client()?;
@ -5872,7 +5871,7 @@ impl LspStore {
async fn handle_apply_code_action(
this: Entity<Self>,
envelope: TypedEnvelope<proto::ApplyCodeAction>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ApplyCodeActionResponse> {
let sender_id = envelope.original_sender_id().unwrap_or_default();
let action = Self::deserialize_code_action(
@ -5905,7 +5904,7 @@ impl LspStore {
async fn handle_register_buffer_with_language_servers(
this: Entity<Self>,
envelope: TypedEnvelope<proto::RegisterBufferWithLanguageServers>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::Ack> {
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
let peer_id = envelope.original_sender_id.unwrap_or(envelope.sender_id);
@ -5934,7 +5933,7 @@ impl LspStore {
async fn handle_rename_project_entry(
this: Entity<Self>,
envelope: TypedEnvelope<proto::RenameProjectEntry>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ProjectEntryResponse> {
let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id);
let (worktree_id, worktree, old_path, is_dir) = this
@ -5980,7 +5979,7 @@ impl LspStore {
async fn handle_update_diagnostic_summary(
this: Entity<Self>,
envelope: TypedEnvelope<proto::UpdateDiagnosticSummary>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
this.update(&mut cx, |this, cx| {
let worktree_id = WorktreeId::from_proto(envelope.payload.worktree_id);
@ -6041,7 +6040,7 @@ impl LspStore {
async fn handle_start_language_server(
this: Entity<Self>,
envelope: TypedEnvelope<proto::StartLanguageServer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
let server = envelope
.payload
@ -6072,7 +6071,7 @@ impl LspStore {
async fn handle_update_language_server(
this: Entity<Self>,
envelope: TypedEnvelope<proto::UpdateLanguageServer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
this.update(&mut cx, |this, cx| {
let language_server_id = LanguageServerId(envelope.payload.language_server_id as usize);
@ -6134,7 +6133,7 @@ impl LspStore {
async fn handle_language_server_log(
this: Entity<Self>,
envelope: TypedEnvelope<proto::LanguageServerLog>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
let language_server_id = LanguageServerId(envelope.payload.language_server_id as usize);
let log_type = envelope
@ -6298,7 +6297,7 @@ impl LspStore {
old_path: &Path,
new_path: &Path,
is_dir: bool,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Task<()> {
let old_uri = lsp::Url::from_file_path(old_path).ok().map(String::from);
let new_uri = lsp::Url::from_file_path(new_path).ok().map(String::from);
@ -6587,7 +6586,7 @@ impl LspStore {
pub async fn handle_resolve_completion_documentation(
this: Entity<Self>,
envelope: TypedEnvelope<proto::ResolveCompletionDocumentation>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ResolveCompletionDocumentationResponse> {
let lsp_completion = serde_json::from_slice(&envelope.payload.lsp_completion)?;
@ -6666,7 +6665,7 @@ impl LspStore {
async fn handle_on_type_formatting(
this: Entity<Self>,
envelope: TypedEnvelope<proto::OnTypeFormatting>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::OnTypeFormattingResponse> {
let on_type_formatting = this.update(&mut cx, |this, cx| {
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
@ -6694,7 +6693,7 @@ impl LspStore {
async fn handle_refresh_inlay_hints(
this: Entity<Self>,
_: TypedEnvelope<proto::RefreshInlayHints>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::Ack> {
this.update(&mut cx, |_, cx| {
cx.emit(LspStoreEvent::RefreshInlayHints);
@ -6705,7 +6704,7 @@ impl LspStore {
async fn handle_inlay_hints(
this: Entity<Self>,
envelope: TypedEnvelope<proto::InlayHints>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::InlayHintsResponse> {
let sender_id = envelope.original_sender_id().unwrap_or_default();
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
@ -6750,7 +6749,7 @@ impl LspStore {
async fn handle_resolve_inlay_hint(
this: Entity<Self>,
envelope: TypedEnvelope<proto::ResolveInlayHint>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ResolveInlayHintResponse> {
let proto_hint = envelope
.payload
@ -6781,7 +6780,7 @@ impl LspStore {
async fn handle_open_buffer_for_symbol(
this: Entity<Self>,
envelope: TypedEnvelope<proto::OpenBufferForSymbol>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::OpenBufferForSymbolResponse> {
let peer_id = envelope.original_sender_id().unwrap_or_default();
let symbol = envelope
@ -6850,7 +6849,7 @@ impl LspStore {
pub async fn handle_get_project_symbols(
this: Entity<Self>,
envelope: TypedEnvelope<proto::GetProjectSymbols>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::GetProjectSymbolsResponse> {
let symbols = this
.update(&mut cx, |this, cx| {
@ -6866,7 +6865,7 @@ impl LspStore {
pub async fn handle_restart_language_servers(
this: Entity<Self>,
envelope: TypedEnvelope<proto::RestartLanguageServers>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::Ack> {
this.update(&mut cx, |this, cx| {
let buffers = this.buffer_ids_to_buffers(envelope.payload.buffer_ids.into_iter(), cx);
@ -6879,7 +6878,7 @@ impl LspStore {
pub async fn handle_cancel_language_server_work(
this: Entity<Self>,
envelope: TypedEnvelope<proto::CancelLanguageServerWork>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::Ack> {
this.update(&mut cx, |this, cx| {
if let Some(work) = envelope.payload.work {
@ -6918,7 +6917,7 @@ impl LspStore {
async fn handle_apply_additional_edits_for_completion(
this: Entity<Self>,
envelope: TypedEnvelope<proto::ApplyCompletionAdditionalEdits>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ApplyCompletionAdditionalEditsResponse> {
let (buffer, completion) = this.update(&mut cx, |this, cx| {
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
@ -7094,7 +7093,7 @@ impl LspStore {
async fn handle_format_buffers(
this: Entity<Self>,
envelope: TypedEnvelope<proto::FormatBuffers>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::FormatBuffersResponse> {
let sender_id = envelope.original_sender_id().unwrap_or_default();
let format = this.update(&mut cx, |this, cx| {
@ -7125,7 +7124,7 @@ impl LspStore {
async fn shutdown_language_server(
server_state: Option<LanguageServerState>,
name: LanguageServerName,
cx: AsyncAppContext,
cx: AsyncApp,
) {
let server = match server_state {
Some(LanguageServerState::Starting(task)) => {
@ -8435,7 +8434,7 @@ impl LspAdapter for SshLspAdapter {
&self,
_: &dyn LspAdapterDelegate,
_: Arc<dyn LanguageToolchainStore>,
_: &AsyncAppContext,
_: &AsyncApp,
) -> Option<LanguageServerBinary> {
Some(self.binary.clone())
}

View file

@ -12,7 +12,7 @@ use futures::{
stream::FuturesUnordered,
FutureExt,
};
use gpui::{AsyncAppContext, Context, Entity, EventEmitter, Task, WeakEntity};
use gpui::{AsyncApp, Context, Entity, EventEmitter, Task, WeakEntity};
use language::{
language_settings::{Formatter, LanguageSettings, SelectedFormatter},
Buffer, LanguageRegistry, LocalFile,
@ -387,7 +387,7 @@ impl PrettierStore {
prettier: &Prettier,
worktree_id: Option<WorktreeId>,
new_server_id: LanguageServerId,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) {
let prettier_dir = prettier.prettier_dir();
let is_default = prettier.is_default();
@ -707,7 +707,7 @@ pub fn prettier_plugins_for_language(
pub(super) async fn format_with_prettier(
prettier_store: &WeakEntity<PrettierStore>,
buffer: &Entity<Buffer>,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Option<Result<crate::lsp_store::FormatOperation>> {
let prettier_instance = prettier_store
.update(cx, |prettier_store, cx| {

View file

@ -48,8 +48,8 @@ use ::git::{
status::FileStatus,
};
use gpui::{
AnyEntity, App, AppContext as _, AsyncAppContext, BorrowAppContext, Context, Entity,
EventEmitter, Hsla, SharedString, Task, WeakEntity, Window,
AnyEntity, App, AppContext as _, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter,
Hsla, SharedString, Task, WeakEntity, Window,
};
use itertools::Itertools;
use language::{
@ -898,7 +898,7 @@ impl Project {
user_store: Entity<UserStore>,
languages: Arc<LanguageRegistry>,
fs: Arc<dyn Fs>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Entity<Self>> {
let project =
Self::in_room(remote_id, client, user_store, languages, fs, cx.clone()).await?;
@ -916,7 +916,7 @@ impl Project {
user_store: Entity<UserStore>,
languages: Arc<LanguageRegistry>,
fs: Arc<dyn Fs>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<Entity<Self>> {
client.authenticate_and_connect(true, &cx).await?;
@ -958,7 +958,7 @@ impl Project {
user_store: Entity<UserStore>,
languages: Arc<LanguageRegistry>,
fs: Arc<dyn Fs>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<Entity<Self>> {
let remote_id = response.payload.project_id;
let role = response.payload.role();
@ -1156,7 +1156,7 @@ impl Project {
#[cfg(any(test, feature = "test-support"))]
pub async fn example(
root_paths: impl IntoIterator<Item = &Path>,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Entity<Project> {
use clock::FakeSystemClock;
@ -2018,7 +2018,7 @@ impl Project {
async fn send_buffer_ordered_messages(
this: WeakEntity<Self>,
rx: UnboundedReceiver<BufferOrderedMessage>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
const MAX_BATCH_SIZE: usize = 128;
@ -2028,7 +2028,7 @@ impl Project {
operations_by_buffer_id: &mut HashMap<BufferId, Vec<proto::Operation>>,
needs_resync_with_host: &mut bool,
is_local: bool,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<()> {
for (buffer_id, operations) in operations_by_buffer_id.drain() {
let request = this.update(cx, |this, _| {
@ -3541,7 +3541,7 @@ impl Project {
async fn handle_unshare_project(
this: Entity<Self>,
_: TypedEnvelope<proto::UnshareProject>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
this.update(&mut cx, |this, cx| {
if this.is_local() || this.is_via_ssh() {
@ -3556,7 +3556,7 @@ impl Project {
async fn handle_add_collaborator(
this: Entity<Self>,
mut envelope: TypedEnvelope<proto::AddProjectCollaborator>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
let collaborator = envelope
.payload
@ -3581,7 +3581,7 @@ impl Project {
async fn handle_update_project_collaborator(
this: Entity<Self>,
envelope: TypedEnvelope<proto::UpdateProjectCollaborator>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
let old_peer_id = envelope
.payload
@ -3624,7 +3624,7 @@ impl Project {
async fn handle_remove_collaborator(
this: Entity<Self>,
envelope: TypedEnvelope<proto::RemoveProjectCollaborator>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
this.update(&mut cx, |this, cx| {
let peer_id = envelope
@ -3652,7 +3652,7 @@ impl Project {
async fn handle_update_project(
this: Entity<Self>,
envelope: TypedEnvelope<proto::UpdateProject>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
this.update(&mut cx, |this, cx| {
// Don't handle messages that were sent before the response to us joining the project
@ -3666,7 +3666,7 @@ impl Project {
async fn handle_toast(
this: Entity<Self>,
envelope: TypedEnvelope<proto::Toast>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
this.update(&mut cx, |_, cx| {
cx.emit(Event::Toast {
@ -3680,7 +3680,7 @@ impl Project {
async fn handle_language_server_prompt_request(
this: Entity<Self>,
envelope: TypedEnvelope<proto::LanguageServerPromptRequest>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::LanguageServerPromptResponse> {
let (tx, mut rx) = smol::channel::bounded(1);
let actions: Vec<_> = envelope
@ -3727,7 +3727,7 @@ impl Project {
async fn handle_hide_toast(
this: Entity<Self>,
envelope: TypedEnvelope<proto::HideToast>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
this.update(&mut cx, |_, cx| {
cx.emit(Event::HideToast {
@ -3741,7 +3741,7 @@ impl Project {
async fn handle_update_worktree(
this: Entity<Self>,
envelope: TypedEnvelope<proto::UpdateWorktree>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
this.update(&mut cx, |this, cx| {
let worktree_id = WorktreeId::from_proto(envelope.payload.worktree_id);
@ -3758,7 +3758,7 @@ impl Project {
async fn handle_update_buffer_from_ssh(
this: Entity<Self>,
envelope: TypedEnvelope<proto::UpdateBuffer>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<proto::Ack> {
let buffer_store = this.read_with(&cx, |this, cx| {
if let Some(remote_id) = this.remote_id() {
@ -3776,7 +3776,7 @@ impl Project {
async fn handle_update_buffer(
this: Entity<Self>,
envelope: TypedEnvelope<proto::UpdateBuffer>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<proto::Ack> {
let buffer_store = this.read_with(&cx, |this, cx| {
if let Some(ssh) = &this.ssh_client {
@ -3812,7 +3812,7 @@ impl Project {
async fn handle_create_buffer_for_peer(
this: Entity<Self>,
envelope: TypedEnvelope<proto::CreateBufferForPeer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<()> {
this.update(&mut cx, |this, cx| {
this.buffer_store.update(cx, |buffer_store, cx| {
@ -3829,7 +3829,7 @@ impl Project {
async fn handle_synchronize_buffers(
this: Entity<Self>,
envelope: TypedEnvelope<proto::SynchronizeBuffers>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::SynchronizeBuffersResponse> {
let response = this.update(&mut cx, |this, cx| {
let client = this.client.clone();
@ -3844,7 +3844,7 @@ impl Project {
async fn handle_search_candidate_buffers(
this: Entity<Self>,
envelope: TypedEnvelope<proto::FindSearchCandidates>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::FindSearchCandidatesResponse> {
let peer_id = envelope.original_sender_id()?;
let message = envelope.payload;
@ -3874,7 +3874,7 @@ impl Project {
async fn handle_open_buffer_by_id(
this: Entity<Self>,
envelope: TypedEnvelope<proto::OpenBufferById>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::OpenBufferResponse> {
let peer_id = envelope.original_sender_id()?;
let buffer_id = BufferId::new(envelope.payload.id)?;
@ -3887,7 +3887,7 @@ impl Project {
async fn handle_open_buffer_by_path(
this: Entity<Self>,
envelope: TypedEnvelope<proto::OpenBufferByPath>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::OpenBufferResponse> {
let peer_id = envelope.original_sender_id()?;
let worktree_id = WorktreeId::from_proto(envelope.payload.worktree_id);
@ -3908,7 +3908,7 @@ impl Project {
async fn handle_open_new_buffer(
this: Entity<Self>,
envelope: TypedEnvelope<proto::OpenNewBuffer>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::OpenBufferResponse> {
let buffer = this
.update(&mut cx, |this, cx| this.create_buffer(cx))?
@ -3922,7 +3922,7 @@ impl Project {
this: Entity<Self>,
buffer: Entity<Buffer>,
peer_id: proto::PeerId,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Result<proto::OpenBufferResponse> {
this.update(cx, |this, cx| {
let is_private = buffer

View file

@ -1,7 +1,7 @@
use anyhow::Context as _;
use collections::HashMap;
use fs::Fs;
use gpui::{App, AsyncAppContext, BorrowAppContext, Context, Entity, EventEmitter};
use gpui::{App, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter};
use lsp::LanguageServerName;
use paths::{
local_settings_file_relative_path, local_tasks_file_relative_path,
@ -323,7 +323,7 @@ impl SettingsObserver {
async fn handle_update_worktree_settings(
this: Entity<Self>,
envelope: TypedEnvelope<proto::UpdateWorktreeSettings>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> anyhow::Result<()> {
let kind = match envelope.payload.kind {
Some(kind) => proto::LocalSettingsKind::from_i32(kind)

View file

@ -4,7 +4,7 @@ use anyhow::Context as _;
use collections::HashMap;
use fs::Fs;
use futures::StreamExt as _;
use gpui::{App, AsyncAppContext, Context, Entity, EventEmitter, Task, WeakEntity};
use gpui::{App, AsyncApp, Context, Entity, EventEmitter, Task, WeakEntity};
use language::{
proto::{deserialize_anchor, serialize_anchor},
ContextProvider as _, LanguageToolchainStore, Location,
@ -58,7 +58,7 @@ impl TaskStore {
async fn handle_task_context_for_location(
store: Entity<Self>,
envelope: TypedEnvelope<proto::TaskContextForLocation>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> anyhow::Result<proto::TaskContext> {
let location = envelope
.payload

View file

@ -5,8 +5,7 @@ use anyhow::{bail, Result};
use async_trait::async_trait;
use collections::BTreeMap;
use gpui::{
App, AppContext as _, AsyncAppContext, Context, Entity, EventEmitter, Subscription, Task,
WeakEntity,
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity,
};
use language::{LanguageName, LanguageRegistry, LanguageToolchainStore, Toolchain, ToolchainList};
use rpc::{proto, AnyProtoClient, TypedEnvelope};
@ -112,7 +111,7 @@ impl ToolchainStore {
async fn handle_activate_toolchain(
this: Entity<Self>,
envelope: TypedEnvelope<proto::ActivateToolchain>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::Ack> {
this.update(&mut cx, |this, cx| {
let language_name = LanguageName::from_proto(envelope.payload.language_name);
@ -134,7 +133,7 @@ impl ToolchainStore {
async fn handle_active_toolchain(
this: Entity<Self>,
envelope: TypedEnvelope<proto::ActiveToolchain>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ActiveToolchainResponse> {
let toolchain = this
.update(&mut cx, |this, cx| {
@ -156,7 +155,7 @@ impl ToolchainStore {
async fn handle_list_toolchains(
this: Entity<Self>,
envelope: TypedEnvelope<proto::ListToolchains>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ListToolchainsResponse> {
let toolchains = this
.update(&mut cx, |this, cx| {
@ -221,7 +220,7 @@ impl language::LanguageToolchainStore for LocalStore {
self: Arc<Self>,
worktree_id: WorktreeId,
language_name: LanguageName,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Option<Toolchain> {
self.0
.update(cx, |this, cx| {
@ -238,7 +237,7 @@ impl language::LanguageToolchainStore for RemoteStore {
self: Arc<Self>,
worktree_id: WorktreeId,
language_name: LanguageName,
cx: &mut AsyncAppContext,
cx: &mut AsyncApp,
) -> Option<Toolchain> {
self.0
.update(cx, |this, cx| {
@ -256,7 +255,7 @@ impl language::LanguageToolchainStore for EmptyToolchainStore {
self: Arc<Self>,
_: WorktreeId,
_: LanguageName,
_: &mut AsyncAppContext,
_: &mut AsyncApp,
) -> Option<Toolchain> {
None
}

View file

@ -12,7 +12,7 @@ use futures::{
future::{BoxFuture, Shared},
FutureExt, SinkExt,
};
use gpui::{App, AsyncAppContext, Context, Entity, EntityId, EventEmitter, Task, WeakEntity};
use gpui::{App, AsyncApp, Context, Entity, EntityId, EventEmitter, Task, WeakEntity};
use postage::oneshot;
use rpc::{
proto::{self, SSH_PROJECT_ID},
@ -1041,7 +1041,7 @@ impl WorktreeStore {
pub async fn handle_create_project_entry(
this: Entity<Self>,
envelope: TypedEnvelope<proto::CreateProjectEntry>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ProjectEntryResponse> {
let worktree = this.update(&mut cx, |this, cx| {
let worktree_id = WorktreeId::from_proto(envelope.payload.worktree_id);
@ -1054,7 +1054,7 @@ impl WorktreeStore {
pub async fn handle_copy_project_entry(
this: Entity<Self>,
envelope: TypedEnvelope<proto::CopyProjectEntry>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ProjectEntryResponse> {
let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id);
let worktree = this.update(&mut cx, |this, cx| {
@ -1067,7 +1067,7 @@ impl WorktreeStore {
pub async fn handle_delete_project_entry(
this: Entity<Self>,
envelope: TypedEnvelope<proto::DeleteProjectEntry>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ProjectEntryResponse> {
let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id);
let worktree = this.update(&mut cx, |this, cx| {
@ -1080,7 +1080,7 @@ impl WorktreeStore {
pub async fn handle_expand_project_entry(
this: Entity<Self>,
envelope: TypedEnvelope<proto::ExpandProjectEntry>,
mut cx: AsyncAppContext,
mut cx: AsyncApp,
) -> Result<proto::ExpandProjectEntryResponse> {
let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id);
let worktree = this
@ -1092,7 +1092,7 @@ impl WorktreeStore {
pub async fn handle_git_branches(
this: Entity<Self>,
branches: TypedEnvelope<proto::GitBranches>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<proto::GitBranchesResponse> {
let project_path = branches
.payload
@ -1123,7 +1123,7 @@ impl WorktreeStore {
pub async fn handle_update_branch(
this: Entity<Self>,
update_branch: TypedEnvelope<proto::UpdateGitBranch>,
cx: AsyncAppContext,
cx: AsyncApp,
) -> Result<proto::Ack> {
let project_path = update_branch
.payload