Skip to content

Commit b4bd27b

Browse files
committed
Don't send error notifications for workspace failures if server status is supported
1 parent c978648 commit b4bd27b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

crates/rust-analyzer/src/main_loop.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,12 @@ impl GlobalState {
409409
if self.last_reported_status.as_ref() != Some(&status) {
410410
self.last_reported_status = Some(status.clone());
411411

412-
if let (lsp_ext::Health::Error, Some(message)) = (status.health, &status.message) {
413-
self.show_message(lsp_types::MessageType::ERROR, message.clone());
414-
}
415-
416412
if self.config.server_status_notification() {
417413
self.send_notification::<lsp_ext::ServerStatusNotification>(status);
414+
} else {
415+
if let (lsp_ext::Health::Error, Some(message)) = (status.health, &status.message) {
416+
self.show_message(lsp_types::MessageType::ERROR, message.clone());
417+
}
418418
}
419419
}
420420

crates/rust-analyzer/src/reload.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ impl GlobalState {
202202
tracing::info!(%cause, "will switch workspaces");
203203

204204
if let Err(error_message) = self.fetch_workspace_error() {
205-
self.show_and_log_error(error_message, None);
205+
if !self.config.server_status_notification() {
206+
self.show_and_log_error(error_message, None);
207+
}
206208
if !self.workspaces.is_empty() {
207209
// It only makes sense to switch to a partially broken workspace
208210
// if we don't have any workspace at all yet.

0 commit comments

Comments
 (0)