summaryrefslogtreecommitdiff
path: root/support/texlab/src/environment.rs
blob: 54b6279f304c4e6a7abb6ae936a9de9646e2cc85 (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
33
use std::{path::PathBuf, sync::Arc};

use lsp_types::{ClientCapabilities, ClientInfo};

use crate::{distro::Resolver, Options};

#[derive(Debug, Clone)]
pub struct Environment {
    pub current_directory: Arc<PathBuf>,
    pub client_capabilities: Arc<ClientCapabilities>,
    pub client_info: Option<Arc<ClientInfo>>,
    pub options: Arc<Options>,
    pub resolver: Arc<Resolver>,
}

impl Environment {
    #[must_use]
    pub fn new(current_directory: Arc<PathBuf>) -> Self {
        Self {
            current_directory,
            client_capabilities: Arc::new(ClientCapabilities::default()),
            client_info: None,
            options: Arc::new(Options::default()),
            resolver: Arc::new(Resolver::default()),
        }
    }
}

impl Default for Environment {
    fn default() -> Self {
        Self::new(Arc::new(std::env::temp_dir()))
    }
}