mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 14:13:58 +00:00
Coalesce flycheck events
This commit is contained in:
parent
59c4975b54
commit
f52abbe62d
1 changed files with 60 additions and 46 deletions
|
@ -289,9 +289,13 @@ impl GlobalState {
|
|||
}
|
||||
}
|
||||
}
|
||||
Event::Flycheck(task) => match task {
|
||||
Event::Flycheck(mut task) => {
|
||||
let _p = profile::span("GlobalState::handle_event/flycheck");
|
||||
loop {
|
||||
match task {
|
||||
flycheck::Message::AddDiagnostic { workspace_root, diagnostic } => {
|
||||
let diagnostics = crate::diagnostics::to_proto::map_rust_diagnostic_to_lsp(
|
||||
let diagnostics =
|
||||
crate::diagnostics::to_proto::map_rust_diagnostic_to_lsp(
|
||||
&self.config.diagnostics_map,
|
||||
&diagnostic,
|
||||
&workspace_root,
|
||||
|
@ -304,7 +308,10 @@ impl GlobalState {
|
|||
diag.fixes,
|
||||
),
|
||||
Err(err) => {
|
||||
log::error!("File with cargo diagnostic not found in VFS: {}", err);
|
||||
log::error!(
|
||||
"File with cargo diagnostic not found in VFS: {}",
|
||||
err
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -337,7 +344,14 @@ impl GlobalState {
|
|||
};
|
||||
self.report_progress(&title, state, message, None);
|
||||
}
|
||||
},
|
||||
}
|
||||
// Coalesce many flycheck updates into a single loop turn
|
||||
task = match self.flycheck_receiver.try_recv() {
|
||||
Ok(task) => task,
|
||||
Err(_) => break,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let state_changed = self.process_changes();
|
||||
|
|
Loading…
Reference in a new issue