Skip to content

Commit

Permalink
Merge pull request rust-lang#18432 from Veykril/lw-yptzmuxyvxxt
Browse files Browse the repository at this point in the history
fix: Fix the server not honoring diagnostic refresh support
  • Loading branch information
Veykril authored Oct 29, 2024
2 parents a1eb6b3 + 1407065 commit c21de28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@ impl ClientCapabilities {
.unwrap_or_default()
}

pub fn diagnostics_refresh(&self) -> bool {
(|| -> _ { self.0.workspace.as_ref()?.diagnostic.as_ref()?.refresh_support })()
.unwrap_or_default()
}

pub fn inlay_hint_resolve_support_properties(&self) -> FxHashSet<&str> {
self.0
.text_document
Expand Down
6 changes: 2 additions & 4 deletions src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,6 @@ impl GlobalState {
}
}

let supports_diagnostic_pull_model = self.config.text_document_diagnostic();

let client_refresh = became_quiescent || state_changed;
if client_refresh {
// Refresh semantic tokens if the client supports it.
Expand All @@ -437,7 +435,7 @@ impl GlobalState {
self.send_request::<lsp_types::request::InlayHintRefreshRequest>((), |_, _| ());
}

if supports_diagnostic_pull_model {
if self.config.diagnostics_refresh() {
self.send_request::<lsp_types::request::WorkspaceDiagnosticRefresh>(
(),
|_, _| (),
Expand All @@ -448,7 +446,7 @@ impl GlobalState {
let project_or_mem_docs_changed =
became_quiescent || state_changed || memdocs_added_or_removed;
if project_or_mem_docs_changed
&& !supports_diagnostic_pull_model
&& !self.config.text_document_diagnostic()
&& self.config.publish_diagnostics(None)
{
self.update_diagnostics();
Expand Down

0 comments on commit c21de28

Please sign in to comment.