Skip to content

Commit cae920a

Browse files
bors[bot]matklad
andauthored
Merge #8478
8478: fix: don't spam repeated error messages when `cargo check` fails r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 parents a526d0a + 29d5f29 commit cae920a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

crates/rust-analyzer/src/reload.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ impl GlobalState {
100100
}
101101
}
102102
pub(crate) fn report_new_status_if_needed(&mut self) {
103-
if !self.config.server_status_notification() {
104-
return;
105-
}
106-
107103
let mut status = lsp_ext::ServerStatusParams {
108104
health: lsp_ext::Health::Ok,
109105
quiescent: self.is_quiescent(),
@@ -129,7 +125,14 @@ impl GlobalState {
129125

130126
if self.last_reported_status.as_ref() != Some(&status) {
131127
self.last_reported_status = Some(status.clone());
132-
self.send_notification::<lsp_ext::ServerStatusNotification>(status);
128+
129+
if let (lsp_ext::Health::Error, Some(message)) = (status.health, &status.message) {
130+
self.show_message(lsp_types::MessageType::Error, message.clone());
131+
}
132+
133+
if self.config.server_status_notification() {
134+
self.send_notification::<lsp_ext::ServerStatusNotification>(status);
135+
}
133136
}
134137
}
135138

@@ -225,15 +228,13 @@ impl GlobalState {
225228

226229
if let Some(error_message) = self.fetch_workspace_error() {
227230
log::error!("failed to switch workspaces: {}", error_message);
228-
self.show_message(lsp_types::MessageType::Error, error_message);
229231
if !self.workspaces.is_empty() {
230232
return;
231233
}
232234
}
233235

234236
if let Some(error_message) = self.build_data_error() {
235237
log::error!("failed to switch build data: {}", error_message);
236-
self.show_message(lsp_types::MessageType::Error, error_message);
237238
}
238239

239240
let workspaces = self

0 commit comments

Comments
 (0)