mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Merge #4935
4935: Simplify r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
0262dba97e
2 changed files with 4 additions and 10 deletions
|
@ -18,7 +18,7 @@ use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsTask, Watch};
|
||||||
use stdx::format_to;
|
use stdx::format_to;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::Config,
|
config::{Config, FilesWatcher},
|
||||||
diagnostics::{CheckFixes, DiagnosticCollection},
|
diagnostics::{CheckFixes, DiagnosticCollection},
|
||||||
main_loop::pending_requests::{CompletedRequest, LatestRequests},
|
main_loop::pending_requests::{CompletedRequest, LatestRequests},
|
||||||
to_proto::url_from_abs_path,
|
to_proto::url_from_abs_path,
|
||||||
|
@ -76,7 +76,6 @@ impl GlobalState {
|
||||||
workspaces: Vec<ProjectWorkspace>,
|
workspaces: Vec<ProjectWorkspace>,
|
||||||
lru_capacity: Option<usize>,
|
lru_capacity: Option<usize>,
|
||||||
exclude_globs: &[Glob],
|
exclude_globs: &[Glob],
|
||||||
watch: Watch,
|
|
||||||
config: Config,
|
config: Config,
|
||||||
) -> GlobalState {
|
) -> GlobalState {
|
||||||
let mut change = AnalysisChange::new();
|
let mut change = AnalysisChange::new();
|
||||||
|
@ -111,6 +110,7 @@ impl GlobalState {
|
||||||
|
|
||||||
let (task_sender, task_receiver) = unbounded();
|
let (task_sender, task_receiver) = unbounded();
|
||||||
let task_sender = Box::new(move |t| task_sender.send(t).unwrap());
|
let task_sender = Box::new(move |t| task_sender.send(t).unwrap());
|
||||||
|
let watch = Watch(matches!(config.files.watcher, FilesWatcher::Notify));
|
||||||
let (mut vfs, vfs_roots) = Vfs::new(roots, task_sender, watch);
|
let (mut vfs, vfs_roots) = Vfs::new(roots, task_sender, watch);
|
||||||
|
|
||||||
let mut extern_source_roots = FxHashMap::default();
|
let mut extern_source_roots = FxHashMap::default();
|
||||||
|
|
|
@ -27,7 +27,7 @@ use ra_flycheck::{CheckTask, Status};
|
||||||
use ra_ide::{Canceled, FileId, LineIndex};
|
use ra_ide::{Canceled, FileId, LineIndex};
|
||||||
use ra_prof::profile;
|
use ra_prof::profile;
|
||||||
use ra_project_model::{PackageRoot, ProjectWorkspace};
|
use ra_project_model::{PackageRoot, ProjectWorkspace};
|
||||||
use ra_vfs::{VfsTask, Watch};
|
use ra_vfs::VfsTask;
|
||||||
use rustc_hash::FxHashSet;
|
use rustc_hash::FxHashSet;
|
||||||
use serde::{de::DeserializeOwned, Serialize};
|
use serde::{de::DeserializeOwned, Serialize};
|
||||||
use threadpool::ThreadPool;
|
use threadpool::ThreadPool;
|
||||||
|
@ -160,13 +160,7 @@ pub fn main_loop(config: Config, connection: Connection) -> Result<()> {
|
||||||
connection.sender.send(request.into()).unwrap();
|
connection.sender.send(request.into()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalState::new(
|
GlobalState::new(workspaces, config.lru_capacity, &globs, config)
|
||||||
workspaces,
|
|
||||||
config.lru_capacity,
|
|
||||||
&globs,
|
|
||||||
Watch(matches!(config.files.watcher, FilesWatcher::Notify)),
|
|
||||||
config,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
loop_state.roots_total = global_state.vfs.read().n_roots();
|
loop_state.roots_total = global_state.vfs.read().n_roots();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue