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

use self::latex_label::LatexLabelHighlightProvider;
use crate::workspace::*;
use futures_boxed::boxed;
use lsp_types::{DocumentHighlight, TextDocumentPositionParams};

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()
    }
}

impl FeatureProvider for HighlightProvider {
    type Params = TextDocumentPositionParams;
    type Output = Vec<DocumentHighlight>;

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