ssh-remoting: Fix go to definition out of worktree (#18094)
Release Notes: - ssh-remoting: Fixed go to definition outside of worktree --------- Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
00b1c81c9f
commit
fbbf0393cb
7 changed files with 251 additions and 158 deletions
|
@ -44,7 +44,11 @@ impl HeadlessProject {
|
|||
pub fn new(session: Arc<SshSession>, fs: Arc<dyn Fs>, cx: &mut ModelContext<Self>) -> Self {
|
||||
let languages = Arc::new(LanguageRegistry::new(cx.background_executor().clone()));
|
||||
|
||||
let worktree_store = cx.new_model(|_| WorktreeStore::new(true, fs.clone()));
|
||||
let worktree_store = cx.new_model(|cx| {
|
||||
let mut store = WorktreeStore::new(None, true, fs.clone());
|
||||
store.shared(SSH_PROJECT_ID, session.clone().into(), cx);
|
||||
store
|
||||
});
|
||||
let buffer_store = cx.new_model(|cx| {
|
||||
let mut buffer_store =
|
||||
BufferStore::new(worktree_store.clone(), Some(SSH_PROJECT_ID), cx);
|
||||
|
@ -196,18 +200,11 @@ impl HeadlessProject {
|
|||
.await?;
|
||||
|
||||
this.update(&mut cx, |this, cx| {
|
||||
let session = this.session.clone();
|
||||
this.worktree_store.update(cx, |worktree_store, cx| {
|
||||
worktree_store.add(&worktree, cx);
|
||||
});
|
||||
worktree.update(cx, |worktree, cx| {
|
||||
worktree.observe_updates(0, cx, move |update| {
|
||||
session.send(update).ok();
|
||||
futures::future::ready(true)
|
||||
});
|
||||
proto::AddWorktreeResponse {
|
||||
worktree_id: worktree.id().to_proto(),
|
||||
}
|
||||
worktree.update(cx, |worktree, _| proto::AddWorktreeResponse {
|
||||
worktree_id: worktree.id().to_proto(),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue