Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1407065

Browse files
committed
fix: Fix the server not honoring diagnostic refresh support
1 parent 25b0846 commit 1407065

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,11 @@ impl ClientCapabilities {
463463
.unwrap_or_default()
464464
}
465465

466+
pub fn diagnostics_refresh(&self) -> bool {
467+
(|| -> _ { self.0.workspace.as_ref()?.diagnostic.as_ref()?.refresh_support })()
468+
.unwrap_or_default()
469+
}
470+
466471
pub fn inlay_hint_resolve_support_properties(&self) -> FxHashSet<&str> {
467472
self.0
468473
.text_document

src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ impl GlobalState {
417417
}
418418
}
419419

420-
let supports_diagnostic_pull_model = self.config.text_document_diagnostic();
421-
422420
let client_refresh = became_quiescent || state_changed;
423421
if client_refresh {
424422
// Refresh semantic tokens if the client supports it.
@@ -437,7 +435,7 @@ impl GlobalState {
437435
self.send_request::<lsp_types::request::InlayHintRefreshRequest>((), |_, _| ());
438436
}
439437

440-
if supports_diagnostic_pull_model {
438+
if self.config.diagnostics_refresh() {
441439
self.send_request::<lsp_types::request::WorkspaceDiagnosticRefresh>(
442440
(),
443441
|_, _| (),
@@ -448,7 +446,7 @@ impl GlobalState {
448446
let project_or_mem_docs_changed =
449447
became_quiescent || state_changed || memdocs_added_or_removed;
450448
if project_or_mem_docs_changed
451-
&& !supports_diagnostic_pull_model
449+
&& !self.config.text_document_diagnostic()
452450
&& self.config.publish_diagnostics(None)
453451
{
454452
self.update_diagnostics();

0 commit comments

Comments
 (0)