See language server status on remote (#17912)

Release Notes:

- ssh-remoting: Show LSP status in status bar

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Conrad Irwin 2024-09-16 17:05:26 -06:00 committed by GitHub
parent 243629cce8
commit e7d18ef359
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 22 deletions

View file

@ -37,6 +37,7 @@ shellexpand.workspace = true
smol.workspace = true
worktree.workspace = true
language.workspace = true
util.workspace = true
[dev-dependencies]
client = { workspace = true, features = ["test-support"] }

View file

@ -7,7 +7,7 @@ use project::{
project_settings::SettingsObserver,
search::SearchQuery,
worktree_store::WorktreeStore,
LspStore, ProjectPath, WorktreeId,
LspStore, LspStoreEvent, ProjectPath, WorktreeId,
};
use remote::SshSession;
use rpc::{
@ -19,6 +19,7 @@ use std::{
path::{Path, PathBuf},
sync::{atomic::AtomicUsize, Arc},
};
use util::ResultExt;
use worktree::Worktree;
pub struct HeadlessProject {
@ -73,6 +74,8 @@ impl HeadlessProject {
lsp_store
});
cx.subscribe(&lsp_store, Self::on_lsp_store_event).detach();
cx.subscribe(
&buffer_store,
|_this, _buffer_store, event, cx| match event {
@ -141,6 +144,29 @@ impl HeadlessProject {
}
}
fn on_lsp_store_event(
&mut self,
_lsp_store: Model<LspStore>,
event: &LspStoreEvent,
_cx: &mut ModelContext<Self>,
) {
match event {
LspStoreEvent::LanguageServerUpdate {
language_server_id,
message,
} => {
self.session
.send(proto::UpdateLanguageServer {
project_id: SSH_PROJECT_ID,
language_server_id: language_server_id.to_proto(),
variant: Some(message.clone()),
})
.log_err();
}
_ => {}
}
}
pub async fn handle_add_worktree(
this: Model<Self>,
message: TypedEnvelope<proto::AddWorktree>,