Merge branch 'Veetaha-feat/sync-branch'

This commit is contained in:
Aleksey Kladov 2020-06-25 07:56:47 +02:00
commit 76a530242a
12 changed files with 299 additions and 133 deletions

View file

@ -27,9 +27,13 @@ use crate::{
};
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()))
@ -143,7 +147,12 @@ impl GlobalState {
}
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);
@ -153,6 +162,8 @@ impl GlobalState {
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()))),
@ -170,8 +181,10 @@ impl GlobalState {
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;