Skip to content

Commit

Permalink
Merge #8478
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bors[bot] and matklad committed Apr 12, 2021
2 parents a526d0a + 29d5f29 commit cae920a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions crates/rust-analyzer/src/reload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ impl GlobalState {
}
}
pub(crate) fn report_new_status_if_needed(&mut self) {
if !self.config.server_status_notification() {
return;
}

let mut status = lsp_ext::ServerStatusParams {
health: lsp_ext::Health::Ok,
quiescent: self.is_quiescent(),
Expand All @@ -129,7 +125,14 @@ impl GlobalState {

if self.last_reported_status.as_ref() != Some(&status) {
self.last_reported_status = Some(status.clone());
self.send_notification::<lsp_ext::ServerStatusNotification>(status);

if let (lsp_ext::Health::Error, Some(message)) = (status.health, &status.message) {
self.show_message(lsp_types::MessageType::Error, message.clone());
}

if self.config.server_status_notification() {
self.send_notification::<lsp_ext::ServerStatusNotification>(status);
}
}
}

Expand Down Expand Up @@ -225,15 +228,13 @@ impl GlobalState {

if let Some(error_message) = self.fetch_workspace_error() {
log::error!("failed to switch workspaces: {}", error_message);
self.show_message(lsp_types::MessageType::Error, error_message);
if !self.workspaces.is_empty() {
return;
}
}

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

let workspaces = self
Expand Down

0 comments on commit cae920a

Please sign in to comment.