Rename other references from "handle" to "model"

Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Mikayla <mikayla@zed.dev>
This commit is contained in:
Antonio Scandurra 2023-10-30 19:53:48 +01:00
parent ba789fc0c4
commit bc4f8fbf4e
13 changed files with 128 additions and 128 deletions

View file

@ -26,8 +26,8 @@ use futures::{
};
use globset::{Glob, GlobSet, GlobSetBuilder};
use gpui2::{
AnyHandle, AppContext, AsyncAppContext, Context, EventEmitter, Executor, Model, ModelContext,
Task, WeakHandle,
AnyModel, AppContext, AsyncAppContext, Context, EventEmitter, Executor, Model, ModelContext,
Task, WeakModel,
};
use itertools::Itertools;
use language2::{
@ -153,7 +153,7 @@ pub struct Project {
incomplete_remote_buffers: HashMap<u64, Option<Model<Buffer>>>,
buffer_snapshots: HashMap<u64, HashMap<LanguageServerId, Vec<LspBufferSnapshot>>>, // buffer_id -> server_id -> vec of snapshots
buffers_being_formatted: HashSet<u64>,
buffers_needing_diff: HashSet<WeakHandle<Buffer>>,
buffers_needing_diff: HashSet<WeakModel<Buffer>>,
git_diff_debouncer: DelayedDebounced,
nonce: u128,
_maintain_buffer_languages: Task<()>,
@ -245,14 +245,14 @@ enum LocalProjectUpdate {
enum OpenBuffer {
Strong(Model<Buffer>),
Weak(WeakHandle<Buffer>),
Weak(WeakModel<Buffer>),
Operations(Vec<Operation>),
}
#[derive(Clone)]
enum WorktreeHandle {
Strong(Model<Worktree>),
Weak(WeakHandle<Worktree>),
Weak(WeakModel<Worktree>),
}
enum ProjectClientState {
@ -1671,7 +1671,7 @@ impl Project {
&mut self,
path: impl Into<ProjectPath>,
cx: &mut ModelContext<Self>,
) -> Task<Result<(ProjectEntryId, AnyHandle)>> {
) -> Task<Result<(ProjectEntryId, AnyModel)>> {
let task = self.open_buffer(path, cx);
cx.spawn(move |_, mut cx| async move {
let buffer = task.await?;
@ -1681,7 +1681,7 @@ impl Project {
})?
.ok_or_else(|| anyhow!("no project entry"))?;
let buffer: &AnyHandle = &buffer;
let buffer: &AnyModel = &buffer;
Ok((project_entry_id, buffer.clone()))
})
}
@ -2158,7 +2158,7 @@ impl Project {
}
async fn send_buffer_ordered_messages(
this: WeakHandle<Self>,
this: WeakModel<Self>,
rx: UnboundedReceiver<BufferOrderedMessage>,
mut cx: AsyncAppContext,
) -> Result<()> {
@ -2166,7 +2166,7 @@ impl Project {
let mut operations_by_buffer_id = HashMap::default();
async fn flush_operations(
this: &WeakHandle<Project>,
this: &WeakModel<Project>,
operations_by_buffer_id: &mut HashMap<u64, Vec<proto::Operation>>,
needs_resync_with_host: &mut bool,
is_local: bool,
@ -2931,7 +2931,7 @@ impl Project {
}
async fn setup_and_insert_language_server(
this: WeakHandle<Self>,
this: WeakModel<Self>,
initialization_options: Option<serde_json::Value>,
pending_server: PendingLanguageServer,
adapter: Arc<CachedLspAdapter>,
@ -2970,7 +2970,7 @@ impl Project {
}
async fn setup_pending_language_server(
this: WeakHandle<Self>,
this: WeakModel<Self>,
initialization_options: Option<serde_json::Value>,
pending_server: PendingLanguageServer,
adapter: Arc<CachedLspAdapter>,
@ -3748,7 +3748,7 @@ impl Project {
}
async fn on_lsp_workspace_edit(
this: WeakHandle<Self>,
this: WeakModel<Self>,
params: lsp2::ApplyWorkspaceEditParams,
server_id: LanguageServerId,
adapter: Arc<CachedLspAdapter>,
@ -4360,7 +4360,7 @@ impl Project {
}
async fn format_via_lsp(
this: &WeakHandle<Self>,
this: &WeakModel<Self>,
buffer: &Model<Buffer>,
abs_path: &Path,
language_server: &Arc<LanguageServer>,

View file

@ -1,5 +1,5 @@
use crate::Project;
use gpui2::{AnyWindowHandle, Context, Model, ModelContext, WeakHandle};
use gpui2::{AnyWindowHandle, Context, Model, ModelContext, WeakModel};
use settings2::Settings;
use std::path::{Path, PathBuf};
use terminal2::{
@ -11,7 +11,7 @@ use terminal2::{
use std::os::unix::ffi::OsStrExt;
pub struct Terminals {
pub(crate) local_handles: Vec<WeakHandle<terminal2::Terminal>>,
pub(crate) local_handles: Vec<WeakModel<terminal2::Terminal>>,
}
impl Project {
@ -121,7 +121,7 @@ impl Project {
}
}
pub fn local_terminal_handles(&self) -> &Vec<WeakHandle<terminal2::Terminal>> {
pub fn local_terminal_handles(&self) -> &Vec<WeakModel<terminal2::Terminal>> {
&self.terminals.local_handles
}
}