From d8ddde27f9c37ba23b4eaab24759e2c1459e8ad4 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 17 Dec 2022 23:29:25 +0100 Subject: [PATCH] Make cancelFlycheck request a notification --- crates/rust-analyzer/src/lsp_ext.rs | 3 +-- crates/rust-analyzer/src/main_loop.rs | 2 +- editors/code/src/commands.ts | 2 +- editors/code/src/lsp_ext.ts | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs index a2d539cf6ca..f03b8398c1d 100644 --- a/crates/rust-analyzer/src/lsp_ext.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs @@ -132,9 +132,8 @@ pub struct ExpandedMacro { pub enum CancelFlycheck {} -impl Request for CancelFlycheck { +impl Notification for CancelFlycheck { type Params = (); - type Result = (); const METHOD: &'static str = "rust-analyzer/cancelFlycheck"; } diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 8d621cc36aa..add999504d8 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -635,7 +635,6 @@ impl GlobalState { .on_sync_mut::(handlers::handle_workspace_reload) .on_sync_mut::(handlers::handle_memory_usage) .on_sync_mut::(handlers::handle_shuffle_crate_graph) - .on_sync_mut::(handlers::handle_cancel_flycheck) .on_sync::(handlers::handle_join_lines) .on_sync::(handlers::handle_on_enter) .on_sync::(handlers::handle_selection_range) @@ -822,6 +821,7 @@ impl GlobalState { } Ok(()) })? + .on::(handlers::handle_cancel_flycheck)? .on::(|this, params| { if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) { match this.mem_docs.get_mut(&path) { diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index e0b4bb63c31..283771f270f 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -788,7 +788,7 @@ export function openDocs(ctx: CtxInit): Cmd { export function cancelFlycheck(ctx: CtxInit): Cmd { return async () => { - await ctx.client.sendRequest(ra.cancelFlycheck); + await ctx.client.sendNotification(ra.cancelFlycheck); }; } diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts index 78da4e959c6..6f63084108a 100644 --- a/editors/code/src/lsp_ext.ts +++ b/editors/code/src/lsp_ext.ts @@ -79,7 +79,7 @@ export const relatedTests = new lc.RequestType("rust-analyzer/cancelFlycheck"); +export const cancelFlycheck = new lc.NotificationType0("rust-analyzer/cancelFlycheck"); export const runFlycheck = new lc.NotificationType<{ textDocument: lc.TextDocumentIdentifier | null;