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

@ -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())
}