From c9fdc48e865f0be88b71a52ff4c3a8b5b270de37 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sun, 2 Mar 2025 09:19:25 -0500 Subject: [PATCH] Add `identifier` to pull diagnostic LSP capabilities This field in the server capabilities instructs the client to maintain the diagnostics received from a `textDocument/diagnostic` pull request as a separate set from other diagnostics: namely those sent with classic "push" diagnostics, `textDocument/publishDiagnostic`. rust-analyzer emits "native" diagnostics (computed by rust-analyzer itself) in pull diagnostics and separately emits cargo-based diagnostics with push, so push and pull diagnostics should be different sets. Setting this field instructs the client to avoid clearing push diagnostics when new pull diagnostics arrive and vice versa. --- crates/rust-analyzer/src/lsp/capabilities.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rust-analyzer/src/lsp/capabilities.rs b/crates/rust-analyzer/src/lsp/capabilities.rs index b1136dbbdac3..9c6b69d73129 100644 --- a/crates/rust-analyzer/src/lsp/capabilities.rs +++ b/crates/rust-analyzer/src/lsp/capabilities.rs @@ -165,7 +165,7 @@ pub fn server_capabilities(config: &Config) -> ServerCapabilities { })), diagnostic_provider: Some(lsp_types::DiagnosticServerCapabilities::Options( lsp_types::DiagnosticOptions { - identifier: None, + identifier: Some("rust-analyzer".to_owned()), inter_file_dependencies: true, // FIXME workspace_diagnostics: false,