internal: incentivize rust-analyzed developers to fix panics

It's good that rust-analyzer doesn't belly-up on a panic in some random
assist.

It is less good that rust-analyzer devs only know that the assists are
buggy when they are actively looking at the logs.
This commit is contained in:
Aleksey Kladov
2021-08-22 17:41:09 +03:00
parent c6baf3dcf8
commit 85fbbc5372
4 changed files with 68 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
//! The main loop of `rust-analyzer` responsible for dispatching LSP
//! requests/replies and notifications back to the client.
use std::{
env, fmt,
fmt,
sync::Arc,
time::{Duration, Instant},
};
@@ -487,12 +487,10 @@ impl GlobalState {
let loop_duration = loop_start.elapsed();
if loop_duration > Duration::from_millis(100) {
log::warn!("overly long loop turn: {:?}", loop_duration);
if env::var("RA_PROFILE").is_ok() {
self.show_message(
lsp_types::MessageType::Error,
format!("overly long loop turn: {:?}", loop_duration),
)
}
self.poke_rust_analyzer_developer(format!(
"overly long loop turn: {:?}",
loop_duration
));
}
Ok(())
}