mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Scale progress down
There are two reasons why we don't want a generic ra_progress crate just yet: *First*, it introduces a common interface between separate components, and that is usually undesirable (b/c components start to fit the interface, rather than doing what makes most sense for each particular component). *Second*, it introduces a separate async channel for progress, which makes it harder to correlate progress reports with the work done. Ie, when we see 100% progress, it's not blindly obvious that the work has actually finished, we might have some pending messages still.
This commit is contained in:
parent
76a530242a
commit
874a5f80c7
11 changed files with 101 additions and 353 deletions
|
@ -27,11 +27,7 @@ use crate::{
|
|||
};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
|
||||
fn create_flycheck(
|
||||
workspaces: &[ProjectWorkspace],
|
||||
config: &FlycheckConfig,
|
||||
progress_src: &ProgressSource<(), String>,
|
||||
) -> Option<Flycheck> {
|
||||
fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) -> Option<Flycheck> {
|
||||
// FIXME: Figure out the multi-workspace situation
|
||||
workspaces.iter().find_map(move |w| match w {
|
||||
ProjectWorkspace::Cargo { cargo, .. } => {
|
||||
|
@ -147,12 +143,7 @@ impl GlobalState {
|
|||
}
|
||||
change.set_crate_graph(crate_graph);
|
||||
|
||||
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 flycheck = config.check.as_ref().and_then(|c| create_flycheck(&workspaces, c));
|
||||
|
||||
let mut analysis_host = AnalysisHost::new(lru_capacity);
|
||||
analysis_host.apply_change(change);
|
||||
|
@ -162,8 +153,6 @@ 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()))),
|
||||
|
@ -181,10 +170,8 @@ 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_progress_src));
|
||||
self.flycheck =
|
||||
config.check.as_ref().and_then(|it| create_flycheck(&self.workspaces, it));
|
||||
}
|
||||
|
||||
self.config = config;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue