Merge clangd's inactiveRegions with existing diagnostics (#26737)

Closes: https://github.com/zed-industries/zed/issues/13089

This PR attempts to resolve the issues discussed in my previous PR
#26146.

Release Notes:

- Fixed: `inactiveRegions` doesn't replace existing diagnostics anymore
This commit is contained in:
Naim A. 2025-03-25 15:13:53 +02:00 committed by GitHub
parent 8f1023360d
commit d9dcc59334
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 164 additions and 23 deletions

View file

@ -255,7 +255,12 @@ impl LspAdapter for RustLspAdapter {
Some("rust-analyzer/flycheck".into())
}
fn process_diagnostics(&self, params: &mut lsp::PublishDiagnosticsParams) {
fn process_diagnostics(
&self,
params: &mut lsp::PublishDiagnosticsParams,
_: LanguageServerId,
_: Option<&'_ Buffer>,
) {
static REGEX: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"(?m)`([^`]+)\n`$").expect("Failed to create REGEX"));
@ -959,7 +964,7 @@ mod tests {
},
],
};
RustLspAdapter.process_diagnostics(&mut params);
RustLspAdapter.process_diagnostics(&mut params, LanguageServerId(0), None);
assert_eq!(params.diagnostics[0].message, "use of moved value `a`");