diff options
Diffstat (limited to 'cli/lsp/language_server.rs')
-rw-r--r-- | cli/lsp/language_server.rs | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 9a2b067c6..7c4191c82 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -46,6 +46,7 @@ use super::completions; use super::config::Config; use super::config::SETTINGS_SECTION; use super::diagnostics; +use super::diagnostics::DiagnosticServerUpdateMessage; use super::diagnostics::DiagnosticsServer; use super::documents::to_hover_text; use super::documents::to_lsp_range; @@ -342,6 +343,22 @@ impl LanguageServer { } } + /// This request is only used by the lsp integration tests to + /// coordinate the tests receiving the latest diagnostics. + pub async fn latest_diagnostic_batch_index_request( + &self, + ) -> LspResult<Option<Value>> { + Ok( + self + .0 + .read() + .await + .diagnostics_server + .latest_batch_index() + .map(|v| v.into()), + ) + } + pub async fn performance_request(&self) -> LspResult<Option<Value>> { Ok(Some(self.0.read().await.get_performance())) } @@ -2932,11 +2949,11 @@ impl Inner { } fn send_diagnostics_update(&self) { - let snapshot = ( - self.snapshot(), - self.config.snapshot(), - self.lint_options.clone(), - ); + let snapshot = DiagnosticServerUpdateMessage { + snapshot: self.snapshot(), + config: self.config.snapshot(), + lint_options: self.lint_options.clone(), + }; if let Err(err) = self.diagnostics_server.update(snapshot) { error!("Cannot update diagnostics: {}", err); } |