about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2022-12-17 23:29:25 +0100
committerLukas Wirth <lukastw97@gmail.com>2022-12-17 23:29:31 +0100
commitd8ddde27f9c37ba23b4eaab24759e2c1459e8ad4 (patch)
tree392df5e4caf9878a59019bbedd534f389e4081d1
parentcdfe98fe94d1dab0a6626cc24ebfbaf45f321a83 (diff)
downloadrust-d8ddde27f9c37ba23b4eaab24759e2c1459e8ad4.tar.gz
rust-d8ddde27f9c37ba23b4eaab24759e2c1459e8ad4.zip
Make cancelFlycheck request a notification
-rw-r--r--crates/rust-analyzer/src/lsp_ext.rs3
-rw-r--r--crates/rust-analyzer/src/main_loop.rs2
-rw-r--r--editors/code/src/commands.ts2
-rw-r--r--editors/code/src/lsp_ext.ts2
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::<lsp_ext::ReloadWorkspace>(handlers::handle_workspace_reload)
             .on_sync_mut::<lsp_ext::MemoryUsage>(handlers::handle_memory_usage)
             .on_sync_mut::<lsp_ext::ShuffleCrateGraph>(handlers::handle_shuffle_crate_graph)
-            .on_sync_mut::<lsp_ext::CancelFlycheck>(handlers::handle_cancel_flycheck)
             .on_sync::<lsp_ext::JoinLines>(handlers::handle_join_lines)
             .on_sync::<lsp_ext::OnEnter>(handlers::handle_on_enter)
             .on_sync::<lsp_types::request::SelectionRangeRequest>(handlers::handle_selection_range)
@@ -822,6 +821,7 @@ impl GlobalState {
                 }
                 Ok(())
             })?
+            .on::<lsp_ext::CancelFlycheck>(handlers::handle_cancel_flycheck)?
             .on::<lsp_types::notification::DidChangeTextDocument>(|this, params| {
                 if let Ok(path) = from_proto::vfs_path(&params.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<lc.TextDocumentPositionParams, Te
     "rust-analyzer/relatedTests"
 );
 
-export const cancelFlycheck = new lc.RequestType0<void, void>("rust-analyzer/cancelFlycheck");
+export const cancelFlycheck = new lc.NotificationType0("rust-analyzer/cancelFlycheck");
 
 export const runFlycheck = new lc.NotificationType<{
     textDocument: lc.TextDocumentIdentifier | null;