Better private file sharing for remote projects (#12002)
Release Notes: - N/A --------- Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
3a79aa85f4
commit
1732ea95c2
2 changed files with 41 additions and 35 deletions
|
@ -3,16 +3,13 @@ use client::DevServerProjectId;
|
|||
use client::{user::UserStore, Client, ClientSettings};
|
||||
use fs::Fs;
|
||||
use futures::Future;
|
||||
use gpui::{
|
||||
AppContext, AsyncAppContext, Context, Global, Model, ModelContext, Task, UpdateGlobal,
|
||||
WeakModel,
|
||||
};
|
||||
use gpui::{AppContext, AsyncAppContext, Context, Global, Model, ModelContext, Task, WeakModel};
|
||||
use language::LanguageRegistry;
|
||||
use node_runtime::NodeRuntime;
|
||||
use postage::stream::Stream;
|
||||
use project::{Project, WorktreeSettings};
|
||||
use project::Project;
|
||||
use rpc::{proto, ErrorCode, TypedEnvelope};
|
||||
use settings::{Settings, SettingsStore};
|
||||
use settings::Settings;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
|
||||
|
@ -40,15 +37,6 @@ pub fn init(client: Arc<Client>, app_state: AppState, cx: &mut AppContext) -> Ta
|
|||
let dev_server = cx.new_model(|cx| DevServer::new(client.clone(), app_state, cx));
|
||||
cx.set_global(GlobalDevServer(dev_server.clone()));
|
||||
|
||||
// Dev server cannot have any private files for now
|
||||
SettingsStore::update_global(cx, |store, _cx| {
|
||||
let old_settings = store.get::<WorktreeSettings>(None);
|
||||
store.override_global(WorktreeSettings {
|
||||
private_files: Some(vec![]),
|
||||
..old_settings.clone()
|
||||
});
|
||||
});
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
{
|
||||
use signal_hook::consts::{SIGINT, SIGTERM};
|
||||
|
@ -229,12 +217,16 @@ impl DevServer {
|
|||
|
||||
let path = shellexpand::tilde(&dev_server_project.path).to_string();
|
||||
|
||||
project
|
||||
let (worktree, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_local_worktree(&path, true, cx)
|
||||
})?
|
||||
.await?;
|
||||
|
||||
worktree.update(cx, |worktree, cx| {
|
||||
worktree.as_local_mut().unwrap().share_private_files(cx)
|
||||
})?;
|
||||
|
||||
let worktrees =
|
||||
project.read_with(cx, |project, cx| project.worktree_metadata_protos(cx))?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue