parent
2d16d2d036
commit
ffe36c9beb
15 changed files with 8 additions and 459 deletions
|
@ -24,9 +24,7 @@ mod yarn;
|
|||
|
||||
use anyhow::{anyhow, Context as _, Result};
|
||||
use buffer_store::{BufferStore, BufferStoreEvent};
|
||||
use client::{
|
||||
proto, Client, Collaborator, PendingEntitySubscription, ProjectId, TypedEnvelope, UserStore,
|
||||
};
|
||||
use client::{proto, Client, Collaborator, PendingEntitySubscription, TypedEnvelope, UserStore};
|
||||
use clock::ReplicaId;
|
||||
use collections::{BTreeSet, HashMap, HashSet};
|
||||
use debounced_delay::DebouncedDelay;
|
||||
|
@ -154,7 +152,6 @@ pub struct Project {
|
|||
remotely_created_models: Arc<Mutex<RemotelyCreatedModels>>,
|
||||
terminals: Terminals,
|
||||
node: Option<NodeRuntime>,
|
||||
hosted_project_id: Option<ProjectId>,
|
||||
search_history: SearchHistory,
|
||||
search_included_history: SearchHistory,
|
||||
search_excluded_history: SearchHistory,
|
||||
|
@ -678,7 +675,6 @@ impl Project {
|
|||
local_handles: Vec::new(),
|
||||
},
|
||||
node: Some(node),
|
||||
hosted_project_id: None,
|
||||
search_history: Self::new_search_history(),
|
||||
environment,
|
||||
remotely_created_models: Default::default(),
|
||||
|
@ -796,7 +792,6 @@ impl Project {
|
|||
local_handles: Vec::new(),
|
||||
},
|
||||
node: Some(node),
|
||||
hosted_project_id: None,
|
||||
search_history: Self::new_search_history(),
|
||||
environment,
|
||||
remotely_created_models: Default::default(),
|
||||
|
@ -993,7 +988,6 @@ impl Project {
|
|||
local_handles: Vec::new(),
|
||||
},
|
||||
node: None,
|
||||
hosted_project_id: None,
|
||||
search_history: Self::new_search_history(),
|
||||
search_included_history: Self::new_search_history(),
|
||||
search_excluded_history: Self::new_search_history(),
|
||||
|
@ -1045,47 +1039,6 @@ impl Project {
|
|||
Ok(this)
|
||||
}
|
||||
|
||||
pub async fn hosted(
|
||||
remote_id: ProjectId,
|
||||
user_store: Model<UserStore>,
|
||||
client: Arc<Client>,
|
||||
languages: Arc<LanguageRegistry>,
|
||||
fs: Arc<dyn Fs>,
|
||||
cx: AsyncAppContext,
|
||||
) -> Result<Model<Self>> {
|
||||
client.authenticate_and_connect(true, &cx).await?;
|
||||
|
||||
let subscriptions = [
|
||||
EntitySubscription::Project(client.subscribe_to_entity::<Self>(remote_id.0)?),
|
||||
EntitySubscription::BufferStore(
|
||||
client.subscribe_to_entity::<BufferStore>(remote_id.0)?,
|
||||
),
|
||||
EntitySubscription::WorktreeStore(
|
||||
client.subscribe_to_entity::<WorktreeStore>(remote_id.0)?,
|
||||
),
|
||||
EntitySubscription::LspStore(client.subscribe_to_entity::<LspStore>(remote_id.0)?),
|
||||
EntitySubscription::SettingsObserver(
|
||||
client.subscribe_to_entity::<SettingsObserver>(remote_id.0)?,
|
||||
),
|
||||
];
|
||||
let response = client
|
||||
.request_envelope(proto::JoinHostedProject {
|
||||
project_id: remote_id.0,
|
||||
})
|
||||
.await?;
|
||||
Self::from_join_project_response(
|
||||
response,
|
||||
subscriptions,
|
||||
client,
|
||||
true,
|
||||
user_store,
|
||||
languages,
|
||||
fs,
|
||||
cx,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
fn new_search_history() -> SearchHistory {
|
||||
SearchHistory::new(
|
||||
Some(MAX_PROJECT_SEARCH_HISTORY_SIZE),
|
||||
|
@ -1290,10 +1243,6 @@ impl Project {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn hosted_project_id(&self) -> Option<ProjectId> {
|
||||
self.hosted_project_id
|
||||
}
|
||||
|
||||
pub fn supports_terminal(&self, _cx: &AppContext) -> bool {
|
||||
if self.is_local() {
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue