about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2022-12-17 23:43:26 +0100
committerLukas Wirth <lukastw97@gmail.com>2022-12-17 23:43:26 +0100
commitcf8d89e46bdd636d0b28f047360943d21e3c6124 (patch)
tree02295c9ef6f926055c3a0fb58bbb82416fa5ca7a /editors/code/src
parentd8ddde27f9c37ba23b4eaab24759e2c1459e8ad4 (diff)
downloadrust-cf8d89e46bdd636d0b28f047360943d21e3c6124.tar.gz
rust-cf8d89e46bdd636d0b28f047360943d21e3c6124.zip
Add a command to clear flycheck diagnostics
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/commands.ts6
-rw-r--r--editors/code/src/lsp_ext.ts2
-rw-r--r--editors/code/src/main.ts1
3 files changed, 8 insertions, 1 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 283771f270f..cb4e13e2c60 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -792,6 +792,12 @@ export function cancelFlycheck(ctx: CtxInit): Cmd {
     };
 }
 
+export function clearFlycheck(ctx: CtxInit): Cmd {
+    return async () => {
+        await ctx.client.sendNotification(ra.clearFlycheck);
+    };
+}
+
 export function runFlycheck(ctx: CtxInit): Cmd {
     return async () => {
         const editor = ctx.activeRustEditor;
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts
index 6f63084108a..29349cc20f5 100644
--- a/editors/code/src/lsp_ext.ts
+++ b/editors/code/src/lsp_ext.ts
@@ -80,7 +80,7 @@ export const relatedTests = new lc.RequestType<lc.TextDocumentPositionParams, Te
 );
 
 export const cancelFlycheck = new lc.NotificationType0("rust-analyzer/cancelFlycheck");
-
+export const clearFlycheck = new lc.NotificationType0("rust-analyzer/clearFlycheck");
 export const runFlycheck = new lc.NotificationType<{
     textDocument: lc.TextDocumentIdentifier | null;
 }>("rust-analyzer/runFlycheck");
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index c5fc44b4f9f..9a9667b2cd2 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -150,6 +150,7 @@ function createCommands(): Record<string, CommandFactory> {
         moveItemUp: { enabled: commands.moveItemUp },
         moveItemDown: { enabled: commands.moveItemDown },
         cancelFlycheck: { enabled: commands.cancelFlycheck },
+        clearFlycheck: { enabled: commands.clearFlycheck },
         runFlycheck: { enabled: commands.runFlycheck },
         ssr: { enabled: commands.ssr },
         serverVersion: { enabled: commands.serverVersion },