summaryrefslogtreecommitdiff
path: root/support/texlab/crates/texlab/src/features/completion/component_command.rs
blob: fd7ad5f9f47164366c6cc4519dd38df666f5d64c (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
use crate::util::cursor::CursorContext;

use super::builder::CompletionBuilder;

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

    for package in context.included_packages() {
        for command in &package.commands {
            builder.component_command(
                range,
                &command.name,
                command.image.as_deref(),
                command.glyph.as_deref(),
                &package.file_names,
            );
        }
    }

    Some(())
}