summaryrefslogtreecommitdiff
path: root/support/texlab/src/link/mod.rs
blob: 33d555633291201fd0c16d3618587c430d964615 (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
34
35
36
37
mod latex_include;

use crate::link::latex_include::LatexIncludeLinkProvider;
use crate::workspace::*;
use futures_boxed::boxed;
use lsp_types::{DocumentLink, DocumentLinkParams};

pub struct LinkProvider {
    provider: ConcatProvider<DocumentLinkParams, DocumentLink>,
}

impl LinkProvider {
    pub fn new() -> Self {
        Self {
            provider: ConcatProvider::new(vec![Box::new(LatexIncludeLinkProvider)]),
        }
    }
}

impl Default for LinkProvider {
    fn default() -> Self {
        Self::new()
    }
}

impl FeatureProvider for LinkProvider {
    type Params = DocumentLinkParams;
    type Output = Vec<DocumentLink>;

    #[boxed]
    async fn execute<'a>(
        &'a self,
        request: &'a FeatureRequest<DocumentLinkParams>,
    ) -> Vec<DocumentLink> {
        self.provider.execute(request).await
    }
}