summaryrefslogtreecommitdiff
path: root/support/texlab/crates/texlab/src/features/completion/component_command.rs
blob: 3810224a3891be3f6fe09e18b6466265e7251d31 (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,
                command.glyph.as_deref(),
                &package.file_names,
            );
        }
    }

    Some(())
}