summaryrefslogtreecommitdiff
path: root/support/texlab/crates/texlab/src/features/highlight.rs
blob: 63fc8ef9e27bf76102a980e1ec3ef7a92fe8c8e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mod label;

use base_db::Workspace;
use lsp_types::DocumentHighlight;

use crate::util::line_index_ext::LineIndexExt;

pub fn find_all(
    workspace: &Workspace,
    params: &lsp_types::DocumentHighlightParams,
) -> Option<Vec<DocumentHighlight>> {
    let uri = &params.text_document_position_params.text_document.uri;
    let document = workspace.lookup(uri)?;
    let position = params.text_document_position_params.position;
    let offset = document.line_index.offset_lsp(position);
    label::find_highlights(document, offset)
}