summaryrefslogtreecommitdiff
path: root/support/texlab/crates/highlights/src/lib.rs
blob: 9d7a63b0964b231ffd49bd11e7b3ba6e56ef6e33 (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
use base_db::FeatureParams;
use rowan::{TextRange, TextSize};

mod label;

#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Highlight {
    pub range: TextRange,
    pub kind: HighlightKind,
}

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
pub enum HighlightKind {
    Write,
    Read,
}

#[derive(Debug)]
pub struct HighlightParams<'a> {
    pub feature: FeatureParams<'a>,
    pub offset: TextSize,
}

pub fn find_all(params: &HighlightParams) -> Vec<Highlight> {
    let mut results = Vec::new();
    label::find_highlights(params, &mut results);
    results
}

#[cfg(test)]
mod tests;