diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2024-10-29 10:32:11 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-29 10:32:11 +0000 |
| commit | c21de289114c23993d2c3f46057bbc88c82bee82 (patch) | |
| tree | 9aa944fd4d25da7e1ba990f5cef4aa70cd73bcd8 | |
| parent | a1eb6b3e7d8c3f1587f0c412411727ced0233d9f (diff) | |
| parent | 14070659fd9b53959f7a6df5c9d00799439fb721 (diff) | |
| download | rust-c21de289114c23993d2c3f46057bbc88c82bee82.tar.gz rust-c21de289114c23993d2c3f46057bbc88c82bee82.zip | |
Merge pull request #18432 from Veykril/lw-yptzmuxyvxxt
fix: Fix the server not honoring diagnostic refresh support
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs | 5 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs index 271a9c0f3d1..1db616898e8 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs @@ -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 diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs index 9a51df80fe1..73fce42437f 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs @@ -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. @@ -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>( (), |_, _| (), @@ -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(); |
