diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-05-26 02:10:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-26 08:10:18 +0200 |
commit | 25cbd97ab7ef1866e58238f1c28ec0d86062aee8 (patch) | |
tree | d4c8e585f5cc0f8e66598df5be1747aa27ef5a36 /cli/lsp/client.rs | |
parent | e95f098ae350f17450d06270ce37032688447f96 (diff) |
chore(lsp/tests): diagnostic synchronization (reland) (#19270)
Merge on approval as it fixes the flaky test.
Diffstat (limited to 'cli/lsp/client.rs')
-rw-r--r-- | cli/lsp/client.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cli/lsp/client.rs b/cli/lsp/client.rs index 4923a4585..5f1a7fcef 100644 --- a/cli/lsp/client.rs +++ b/cli/lsp/client.rs @@ -62,6 +62,20 @@ impl Client { }); } + /// This notification is sent to the client during internal testing + /// purposes only in order to let the test client know when the latest + /// diagnostics have been published. + pub fn send_diagnostic_batch_notification( + &self, + params: lsp_custom::DiagnosticBatchNotificationParams, + ) { + // do on a task in case the caller currently is in the lsp lock + let client = self.0.clone(); + spawn(async move { + client.send_diagnostic_batch_notification(params).await; + }); + } + pub fn send_test_notification(&self, params: TestingNotification) { // do on a task in case the caller currently is in the lsp lock let client = self.0.clone(); @@ -160,6 +174,10 @@ trait ClientTrait: Send + Sync { &self, params: lsp_custom::RegistryStateNotificationParams, ); + async fn send_diagnostic_batch_notification( + &self, + params: lsp_custom::DiagnosticBatchNotificationParams, + ); async fn send_test_notification(&self, params: TestingNotification); async fn specifier_configurations( &self, @@ -197,6 +215,16 @@ impl ClientTrait for TowerClient { .await } + async fn send_diagnostic_batch_notification( + &self, + params: lsp_custom::DiagnosticBatchNotificationParams, + ) { + self + .0 + .send_notification::<lsp_custom::DiagnosticBatchNotification>(params) + .await + } + async fn send_test_notification(&self, notification: TestingNotification) { match notification { TestingNotification::Module(params) => { @@ -311,6 +339,12 @@ impl ClientTrait for ReplClient { ) { } + async fn send_diagnostic_batch_notification( + &self, + _params: lsp_custom::DiagnosticBatchNotificationParams, + ) { + } + async fn send_test_notification(&self, _params: TestingNotification) {} async fn specifier_configurations( |