Coalesce flycheck events
This commit is contained in:
@@ -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 } => {
|
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,
|
&self.config.diagnostics_map,
|
||||||
&diagnostic,
|
&diagnostic,
|
||||||
&workspace_root,
|
&workspace_root,
|
||||||
@@ -304,7 +308,10 @@ impl GlobalState {
|
|||||||
diag.fixes,
|
diag.fixes,
|
||||||
),
|
),
|
||||||
Err(err) => {
|
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);
|
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();
|
let state_changed = self.process_changes();
|
||||||
|
|||||||
Reference in New Issue
Block a user