diff options
Diffstat (limited to 'cli/lsp/client.rs')
-rw-r--r-- | cli/lsp/client.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cli/lsp/client.rs b/cli/lsp/client.rs index 92a5dfffb..b5728961f 100644 --- a/cli/lsp/client.rs +++ b/cli/lsp/client.rs @@ -16,6 +16,14 @@ use crate::lsp::repl::get_repl_workspace_settings; use super::config::SpecifierSettings; use super::config::SETTINGS_SECTION; use super::lsp_custom; +use super::testing::lsp_custom as testing_lsp_custom; + +#[derive(Debug)] +pub enum TestingNotification { + Module(testing_lsp_custom::TestModuleNotificationParams), + DeleteModule(testing_lsp_custom::TestModuleDeleteNotificationParams), + Progress(testing_lsp_custom::TestRunProgressParams), +} #[derive(Clone)] pub struct Client(Arc<dyn ClientTrait>); @@ -51,6 +59,10 @@ impl Client { self.0.send_registry_state_notification(params).await; } + pub fn send_test_notification(&self, params: TestingNotification) { + self.0.send_test_notification(params); + } + pub async fn specifier_configurations( &self, specifiers: Vec<lsp::Url>, @@ -118,6 +130,7 @@ trait ClientTrait: Send + Sync { &self, params: lsp_custom::RegistryStateNotificationParams, ) -> AsyncReturn<()>; + fn send_test_notification(&self, params: TestingNotification); fn specifier_configurations( &self, uris: Vec<lsp::Url>, @@ -164,6 +177,31 @@ impl ClientTrait for LspowerClient { }) } + fn send_test_notification(&self, notification: TestingNotification) { + let client = self.0.clone(); + tokio::task::spawn(async move { + match notification { + TestingNotification::Module(params) => { + client + .send_custom_notification::<testing_lsp_custom::TestModuleNotification>( + params, + ) + .await + } + TestingNotification::DeleteModule(params) => client + .send_custom_notification::<testing_lsp_custom::TestModuleDeleteNotification>( + params, + ) + .await, + TestingNotification::Progress(params) => client + .send_custom_notification::<testing_lsp_custom::TestRunProgressNotification>( + params, + ) + .await, + } + }); + } + fn specifier_configurations( &self, uris: Vec<lsp::Url>, @@ -260,6 +298,8 @@ impl ClientTrait for ReplClient { Box::pin(future::ready(())) } + fn send_test_notification(&self, _params: TestingNotification) {} + fn specifier_configurations( &self, uris: Vec<lsp::Url>, |