blob: a9a385c3c93a43e416f6b6be6e060dccc8bc7905 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
use lsp_types::CompletionParams;
use rowan::ast::AstNode;
use crate::{features::cursor::CursorContext, syntax::latex, LANGUAGE_DATA};
use super::types::{InternalCompletionItem, InternalCompletionItemData};
pub fn complete_colors<'a>(
context: &'a CursorContext<CompletionParams>,
items: &mut Vec<InternalCompletionItem<'a>>,
) -> Option<()> {
let (_, range, group) = context.find_curly_group_word()?;
latex::ColorReference::cast(group.syntax().parent()?)?;
for name in &LANGUAGE_DATA.colors {
items.push(InternalCompletionItem::new(
range,
InternalCompletionItemData::Color { name },
));
}
Some(())
}
|