aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/project_model.rs
blob: 6800eb1388cf3b38bf1bf5c107e8572288c3f437 (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::{WorkerHandle, Worker};

use crate::Result;

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

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