summaryrefslogtreecommitdiff
path: root/support/texlab/crates/texlab/src/features/completion/component_environment.rs
blob: 496fb7ed857f1f8e0372ffd4d41a73dcc1ff8179 (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(())
}