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/mod.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/mod.rs')
-rw-r--r-- | cli/lsp/mod.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/cli/lsp/mod.rs b/cli/lsp/mod.rs index 0d5552519..d13c90089 100644 --- a/cli/lsp/mod.rs +++ b/cli/lsp/mod.rs @@ -8,6 +8,8 @@ use crate::lsp::language_server::LanguageServer; pub use repl::ReplCompletionItem; pub use repl::ReplLanguageServer; +use self::diagnostics::should_send_diagnostic_batch_index_notifications; + mod analysis; mod cache; mod capabilities; @@ -36,7 +38,7 @@ pub async fn start() -> Result<(), AnyError> { let stdin = tokio::io::stdin(); let stdout = tokio::io::stdout(); - let (service, socket) = LspService::build(|client| { + let builder = LspService::build(|client| { language_server::LanguageServer::new(client::Client::from_tower(client)) }) .custom_method(lsp_custom::CACHE_REQUEST, LanguageServer::cache_request) @@ -58,8 +60,18 @@ pub async fn start() -> Result<(), AnyError> { lsp_custom::VIRTUAL_TEXT_DOCUMENT, LanguageServer::virtual_text_document, ) - .custom_method(lsp_custom::INLAY_HINT, LanguageServer::inlay_hint) - .finish(); + .custom_method(lsp_custom::INLAY_HINT, LanguageServer::inlay_hint); + + let builder = if should_send_diagnostic_batch_index_notifications() { + builder.custom_method( + lsp_custom::LATEST_DIAGNOSTIC_BATCH_INDEX, + LanguageServer::latest_diagnostic_batch_index_request, + ) + } else { + builder + }; + + let (service, socket) = builder.finish(); Server::new(stdin, stdout, socket).serve(service).await; |