summaryrefslogtreecommitdiff
path: root/support/texlab/src/workspace.rs
blob: 12924e2cf40de8ba02cee53077e62510276c6699 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
mod api;
mod children_expand;
mod document;
mod parent_expand;
mod storage;
mod watch;

use std::sync::Arc;

use anyhow::Result;

use crate::ServerContext;

pub use self::{api::*, document::*};
use self::{
    children_expand::ChildrenExpander, parent_expand::ParentExpander, storage::Storage,
    watch::DocumentWatcher,
};

pub fn create_workspace_fast(context: Arc<ServerContext>) -> Result<impl Workspace> {
    let workspace = Storage::new(context);
    let workspace = ChildrenExpander::new(Arc::new(workspace));
    Ok(workspace)
}

pub fn create_workspace_full(context: Arc<ServerContext>) -> Result<impl Workspace> {
    let workspace = Storage::new(context);
    let workspace = DocumentWatcher::new(Arc::new(workspace))?;
    let workspace = ParentExpander::new(workspace);
    let workspace = ChildrenExpander::new(Arc::new(workspace));
    Ok(workspace)
}