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:
Conrad Irwin 2024-09-19 14:04:46 -06:00 committed by GitHub
parent 00b1c81c9f
commit fbbf0393cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 251 additions and 158 deletions

View file

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