diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs index f03b8398c1..65620b4209 100644 --- a/crates/rust-analyzer/src/lsp_ext.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs @@ -144,6 +144,13 @@ impl Notification for RunFlycheck { const METHOD: &'static str = "rust-analyzer/runFlycheck"; } +pub enum ClearFlycheck {} + +impl Notification for ClearFlycheck { + type Params = (); + const METHOD: &'static str = "rust-analyzer/clearFlycheck"; +} + #[derive(Deserialize, Serialize, Debug)] #[serde(rename_all = "camelCase")] pub struct RunFlycheckParams { diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index add999504d..47776f734b 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -861,6 +861,10 @@ impl GlobalState { } Ok(()) })? + .on::(|this, ()| { + this.diagnostics.clear_check_all(); + Ok(()) + })? .on::(|this, params| { if let Some(text_document) = params.text_document { if let Ok(vfs_path) = from_proto::vfs_path(&text_document.uri) { diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 308a92bebe..1bbb4c2323 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md @@ -1,5 +1,5 @@