summaryrefslogtreecommitdiff
path: root/support/texlab/crates/texlab/src/features/completion/component_environment.rs
blob: 85c29558ca113720805b60ccef41d674c4aff3c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::util::{components::COMPONENT_DATABASE, cursor::CursorContext};

use super::builder::CompletionBuilder;

pub fn complete<'db>(
    context: &'db CursorContext,
    builder: &mut CompletionBuilder<'db>,
) -> Option<()> {
    let range = context.find_environment_name()?;

    for component in COMPONENT_DATABASE.linked_components(&context.project) {
        for name in &component.environments {
            builder.component_environment(range, name, &component.file_names);
        }
    }

    Some(())
}