diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-05-25 23:01:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-26 05:01:33 +0200 |
commit | 89026abe395c22eb2ace4ea5f948189daa1dadf1 (patch) | |
tree | 8f2ecedf1b83508414034e0ca04852fcd2ca1f6d /cli/lsp/lsp_custom.rs | |
parent | 0a3d355ce6311df6519dbffe7394ed2682d8a633 (diff) |
chore(lsp/tests): diagnostic synchronization (#19264)
Fixes the flaky lsp test by having better synchronization of diagnostics
between the client and server for testing purposes.
Diffstat (limited to 'cli/lsp/lsp_custom.rs')
-rw-r--r-- | cli/lsp/lsp_custom.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/lsp/lsp_custom.rs b/cli/lsp/lsp_custom.rs index 70a245a66..24c4bc131 100644 --- a/cli/lsp/lsp_custom.rs +++ b/cli/lsp/lsp_custom.rs @@ -10,6 +10,8 @@ pub const TASK_REQUEST: &str = "deno/task"; pub const RELOAD_IMPORT_REGISTRIES_REQUEST: &str = "deno/reloadImportRegistries"; pub const VIRTUAL_TEXT_DOCUMENT: &str = "deno/virtualTextDocument"; +pub const LATEST_DIAGNOSTIC_BATCH_INDEX: &str = + "deno/internalLatestDiagnosticBatchIndex"; // While lsp_types supports inlay hints currently, tower_lsp does not. pub const INLAY_HINT: &str = "textDocument/inlayHint"; @@ -44,3 +46,19 @@ impl lsp::notification::Notification for RegistryStateNotification { pub struct VirtualTextDocumentParams { pub text_document: lsp::TextDocumentIdentifier, } + +#[derive(Debug, Deserialize, Serialize)] +pub struct DiagnosticBatchNotificationParams { + pub batch_index: usize, + pub messages_len: usize, +} + +/// This notification is only sent for testing purposes +/// in order to know what the latest diagnostics are. +pub enum DiagnosticBatchNotification {} + +impl lsp::notification::Notification for DiagnosticBatchNotification { + type Params = DiagnosticBatchNotificationParams; + + const METHOD: &'static str = "deno/internalTestDiagnosticBatch"; +} |