mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +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 } => {
|
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();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue