};
use rustc_hash::{FxHashMap, FxHashSet};
-fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) -> Option<Flycheck> {
+fn create_flycheck(
+ workspaces: &[ProjectWorkspace],
+ config: &FlycheckConfig,
+ progress_src: &ProgressSource<(), String>,
+) -> Option<Flycheck> {
// FIXME: Figure out the multi-workspace situation
- workspaces.iter().find_map(|w| match w {
+ workspaces.iter().find_map(move |w| match w {
ProjectWorkspace::Cargo { cargo, .. } => {
let cargo_project_root = cargo.workspace_root().to_path_buf();
Some(Flycheck::new(config.clone(), cargo_project_root.into()))
}
change.set_crate_graph(crate_graph);
- let flycheck = config.check.as_ref().and_then(|c| create_flycheck(&workspaces, c));
+ let (flycheck_progress_receiver, flycheck_progress_src) =
+ ProgressSource::real_if(config.client_caps.work_done_progress);
+ let flycheck = config
+ .check
+ .as_ref()
+ .and_then(|c| create_flycheck(&workspaces, c, &flycheck_progress_src));
let mut analysis_host = AnalysisHost::new(lru_capacity);
analysis_host.apply_change(change);
loader,
task_receiver,
flycheck,
+ flycheck_progress_src,
+ flycheck_progress_receiver,
diagnostics: Default::default(),
mem_docs: FxHashSet::default(),
vfs: Arc::new(RwLock::new((vfs, FxHashMap::default()))),
pub(crate) fn update_configuration(&mut self, config: Config) {
self.analysis_host.update_lru_capacity(config.lru_capacity);
if config.check != self.config.check {
- self.flycheck =
- config.check.as_ref().and_then(|it| create_flycheck(&self.workspaces, it));
+ self.flycheck = config
+ .check
+ .as_ref()
+ .and_then(|it| create_flycheck(&self.workspaces, it, &self.flycheck_progress_src));
}
self.config = config;