summaryrefslogtreecommitdiff
path: root/support/texlab/src/highlight/mod.rs
blob: e47a7f99c2e7f3c2f931720d57852b842b8321b3 (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
mod latex_label;

use self::latex_label::LatexLabelHighlightProvider;
use crate::{
    feature::{ConcatProvider, FeatureProvider, FeatureRequest},
    protocol::{DocumentHighlight, TextDocumentPositionParams},
};
use async_trait::async_trait;

pub struct HighlightProvider {
    provider: ConcatProvider<TextDocumentPositionParams, DocumentHighlight>,
}

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

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

#[async_trait]
impl FeatureProvider for HighlightProvider {
    type Params = TextDocumentPositionParams;
    type Output = Vec<DocumentHighlight>;

    async fn execute<'a>(&'a self, req: &'a FeatureRequest<Self::Params>) -> Self::Output {
        self.provider.execute(req).await
    }
}