aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/project_model.rs
blob: ad59cde64c3e22e28075ed38acde2c68a9d13140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::path::PathBuf;

use thread_worker::Worker;

use crate::Result;

pub use ra_project_model::{
    CargoWorkspace, Package, ProjectWorkspace, Sysroot, Target, TargetKind,
};

pub fn workspace_loader(with_sysroot: bool) -> Worker<PathBuf, Result<ProjectWorkspace>> {
    Worker::<PathBuf, Result<ProjectWorkspace>>::spawn(
        "workspace loader",
        1,
        move |input_receiver, output_sender| {
            input_receiver
                .into_iter()
                .map(|path| ProjectWorkspace::discover_with_sysroot(path.as_path(), with_sysroot))
                .try_for_each(|it| output_sender.send(it))
                .unwrap()
        },
    )
}