diff --git a/Cargo.lock b/Cargo.lock index 0ce1c9bd97..59d2c6847e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9069,6 +9069,7 @@ dependencies = [ "shellexpand 2.1.2", "smol", "toml 0.8.19", + "util", "worktree", ] diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index cea10094a9..ee02492dd8 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -3314,6 +3314,12 @@ impl LspStore { } cx.emit(LspStoreEvent::DiskBasedDiagnosticsStarted { language_server_id }); + cx.emit(LspStoreEvent::LanguageServerUpdate { + language_server_id, + message: proto::update_language_server::Variant::DiskBasedDiagnosticsUpdating( + Default::default(), + ), + }) } pub fn disk_based_diagnostics_finished( @@ -3328,6 +3334,12 @@ impl LspStore { } cx.emit(LspStoreEvent::DiskBasedDiagnosticsFinished { language_server_id }); + cx.emit(LspStoreEvent::LanguageServerUpdate { + language_server_id, + message: proto::update_language_server::Variant::DiskBasedDiagnosticsUpdated( + Default::default(), + ), + }) } // After saving a buffer using a language server that doesn't provide a disk-based progress token, diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 9185670b05..14524180ab 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -2188,32 +2188,11 @@ impl Project { cx.emit(Event::DiskBasedDiagnosticsStarted { language_server_id: *language_server_id, }); - if self.is_local_or_ssh() { - self.enqueue_buffer_ordered_message(BufferOrderedMessage::LanguageServerUpdate { - language_server_id: *language_server_id, - message: proto::update_language_server::Variant::DiskBasedDiagnosticsUpdating( - Default::default(), - ), - }) - .ok(); - } } LspStoreEvent::DiskBasedDiagnosticsFinished { language_server_id } => { cx.emit(Event::DiskBasedDiagnosticsFinished { language_server_id: *language_server_id, }); - if self.is_local_or_ssh() { - self.enqueue_buffer_ordered_message( - BufferOrderedMessage::LanguageServerUpdate { - language_server_id: *language_server_id, - message: - proto::update_language_server::Variant::DiskBasedDiagnosticsUpdated( - Default::default(), - ), - }, - ) - .ok(); - } } LspStoreEvent::LanguageServerUpdate { language_server_id, diff --git a/crates/remote_server/Cargo.toml b/crates/remote_server/Cargo.toml index ad5ffbcbfa..f5efa21bd0 100644 --- a/crates/remote_server/Cargo.toml +++ b/crates/remote_server/Cargo.toml @@ -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"] } diff --git a/crates/remote_server/src/headless_project.rs b/crates/remote_server/src/headless_project.rs index d85e3a184d..58f5cb0c20 100644 --- a/crates/remote_server/src/headless_project.rs +++ b/crates/remote_server/src/headless_project.rs @@ -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, + event: &LspStoreEvent, + _cx: &mut ModelContext, + ) { + 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, message: TypedEnvelope,